feat: icombine#392
Conversation
| {p : Q(Bool)} | ||
| {out' : Q($prop)} | ||
| (newHyps : Hyps bi newE) | ||
| (init : Q(Bool) := q(false)) |
There was a problem hiding this comment.
Can you get rid of this boolean by special casing the 0 argument case and if there is at least one hypothesis, initialize this structure with the first hypothesis?
| (newHyps : Hyps bi newE) | ||
| (init : Q(Bool) := q(false)) | ||
| (pf1 : Q($origE ⊢ $newE ∗ □?$p $out')) | ||
| pf : Q(($newE ∗ □?$p $out' ⊢ $goal) → ($origE ⊢ $goal)) |
There was a problem hiding this comment.
What are pf and pf1 and why are both necessary?
| {out' : Q($prop)} | ||
| (hyps : Hyps bi e) | ||
| (pf1 : Q($e ⊢ $e ∗ □ $out')) | ||
| pf : Q(($e ∗ □ $out' ⊢ $goal) → ($e ⊢ $goal)) |
There was a problem hiding this comment.
Can you combine CombineGivesState and CombineAsState into a single state and also combine the two combine... functions such that one needs to do a single pass instead of two like in Rocq? I thought there was a comment in the Rocq version explaining why they need to do it in a single pass.
| Note that `icombine` combines propositions from left to right. | ||
| For example, when `□ P1`, `□ P2` and `P3` are combined, it may result in | ||
| `□ (P1 ∗ P2) ∗ P3`. -/ | ||
| instance (priority := default - 10) combineSepAs_assoc [BI PROP] (P Q R S : PROP) |
There was a problem hiding this comment.
I am not sure if this instance fully solves the problem. Can you instead call instance search in a different order in the tactic to get the behavior we want? E.g. by reversing order in which the list of hypothesis is processed?
Currently using an instance combineSepAs_default for the simplest way to combine two propositions with separation conjunction
…ntuitionstically>, <absorb>, <pers> modalities
…and relevant instances for monotonicity
…e (iCombineCoreList)
… hypothesis for synthesis in CombineSepsAs_cons
iCombineCore works recursively on the list of hypotheses to be combined
…avoid typing problem
Some arguments can be inferred by the prover
…context by icombine
…CombineGivesCore is used Does not affect the behaviour correctness of the tactic but prettier
…ursion Proofs to be completed
Description
This reopens the accidentally closed pull request #388.
Implements the
icombinetactic, available in three formats:icombine <hypotheses> as <pattern>icombine <hypotheses> gives <pattern>icombine <hypotheses> as <pattern> gives <pattern>Addresses #359.
The functions
combineAsProofModeHypandcombineGivesProofModeHyputilise the type classesCombineSepAsandCombineSepGives, respectively. Since these two functions already handle the list of hypotheses recursively, there is no need to rely on type classes for recursion.The following type classes and type class instances are all located under the
ProofModedirectory.CombineSepAsClasses.leanCombineSepAsclasses.vCombineSepGivesClasses.leanCombineSepGivesclasses.vFour instances of the type class
CombineSepAsare namedcombine_sep_as_*insteadcombine_sep_gives_*in Rocq. Their Lean counterparts are namedcombineSepGives_*for consistency.combineSepAs_defaultInstances.leanmaybe_combine_sep_as_defaultclasses.vcombineSepAs_affinelyInstances.leanmaybe_combine_sep_as_affinelyclass_instances.vcombineSepAs_intuitionisticallyInstances.leanmaybe_combine_sep_as_intuitionisticallyclass_instances.vcombineSepAs_absorbinglyInstances.leanmaybe_combine_sep_as_absorbinglyclass_instances.vcombineSepAs_persistentlyInstances.leanmaybe_combine_sep_as_persistentlyclass_instances.vcombineSepAs_laterInstancesLater.leanmaybe_combine_sep_as_laterclass_instances_later.vcombineSepAs_laterNInstancesLater.leanmaybe_combine_sep_as_laterNclass_instances_later.vcombineSepAs_except0InstancesLater.leanmaybe_combine_sep_as_except_0class_instances_later.vcombineSepGives_affinelyInstances.leancombine_sep_as_affinelyclass_instances.vcombineSepGives_intuitionisticallyInstances.leancombine_sep_as_intuitionisticallyclass_instances.vcombineSepGives_absorbinglyInstances.leancombine_sep_as_absorbinglyclass_instances.vcombineSepGives_persistentlyInstances.leancombine_sep_as_persistentlyclass_instances.vcombineSepGives_laterInstancesLater.leanmaybe_combine_sep_gives_laterclass_instances_later.vcombineSepGives_laterNInstancesLater.leanmaybe_combine_sep_gives_laterNclass_instances_later.vcombineSepGives_except0InstancesLater.leanmaybe_combine_sep_gives_except_0class_instances_later.vThe tactic should exhibit the following behaviour, consistent with that in Rocq (correct me if I am wrong):
HP : Pin the intuitionistic context, thenicombine HP HP HP as HNewresults inHNew : P ∗ P ∗ Pbeing introduced.HP : PandHQ : Qin the intuitionistic context as well asHR : Rin the spatial context, thenicombine HR HQ HP HR as HNewproducesHnew : R ∗ Q ∗ P ∗ Rin the spatial context.P,QandRshould giveP ∗ Q ∗ Rinstead of(P ∗ Q) ∗ R.Regarding the last point, it appears that this is handled automatically by the type class instance for recursion in Rocq. Since the iterative process is handled by
combineGivesProofModeHypin Lean instead, we currently have the type class instancecombineSepAs_assocfor this purpose.Checklist
PORTING.mdas appropriateauthorssection of any appropriate files