-
Notifications
You must be signed in to change notification settings - Fork 248
[ refactor ] (more) decidable Data.Fin.Properties
#2744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Data.Fin.Properties
Data.Fin.Properties
src/Data/Fin/Properties.agda
Outdated
Q⊆P⇒Q∘suc⊆P∘suc f {x} = f {suc x} | ||
dec[Q⊆P] : Dec (Q ⊆ P) | ||
dec[Q⊆P] with Q? zero | ||
... | false because [¬Q0] = let ¬q₀ = invert [¬Q0] in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not just use yes
and no
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it's my obsessive avoidance of yes
and no
in favour of their lazier versions... as discussed at length in previous PRs...
src/Data/Fin/Properties.agda
Outdated
|
||
syntax MinimalCounterexample P = μ⟨¬ P ⟩ | ||
|
||
min? : ∀ {p} {P : Pred (Fin n) p} → Decidable P → Π[ P ] ⊎ μ⟨¬ P ⟩ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to come up with a better name for this. I guess find minimum?
This return type is also going to be somewhat baffling. Is writing Π[ P ] ⊎ μ⟨¬ P ⟩
really more informative than Universal P ⊎ MinimalCounterexample P
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding naming, the analogous proof for List
is Data.List.Relation.Unary.All.search
, but doesn't have a minimality property (we don't prove that it returns the first counterexample)
Regarding the type, yes, I'm aware that not everyone likes the Unary
quantifiers Π[_]
etc., whereas I find them convenient shorthand. Will reconsider...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding min?
itself as a name:
- postfix
?
to denote that this is a decision procedure (but maybe we should reserve such usage for functions returningDec _
results?) min
/μ
by association with Kleene's minimisation operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findMinimum
seems like a good name. searchForMin
is another viable option. postfix ?
to me always indicates Dec
.
Thanks @MatthewDaggitt for the feedback:
I'll move to DRAFT for the time being, and remove from v2.3, while I reconsider things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the code seems fine. Only issues are that things seem to have moved without a good reason to.
-- Quantification | ||
------------------------------------------------------------------------ | ||
|
||
module _ {P : Pred (Fin (suc n)) p} where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these here? None of these are about a decidable predicate. I think these should be either in the main file or, at worst, a .Core
version, but not here.
|
||
|
||
------------------------------------------------------------------------ | ||
-- Effectful |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, there does not seem to be a good reason to move these here from the main file. This almost feels like a cut-and-paste error?
Hmmm... @JacquesCarette the code motion was in response to earlier review comments from @MatthewDaggitt , but maybe I misunderstood his intention. Nevertheless, the |
I had seen some of the conversation. This is why maybe a larger break up ( |
This PR refactors some proofs about
Decidable
predicates onFin n
, to clarify some, and to add others, including some additionalsyntax
, around a independently interesting minimisation principle from which certain others follow.A downstream refactoring might reconsider these things in terms of specialisation of lemmas in
Induction.InfiniteDescent
.Outstanding issue: could be more systematic about use of
variable
s to clean the whole module up?