feat: remaining specialisation patterns#500
Open
alvinylt wants to merge 87 commits into
Open
Conversation
…frame .spatial` Proofs for `.autoframe .spatial` not yet complete
…ted `iSpecializeCore` and `iHave` signature
42 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the remaining specialisation patterns.
Addresses #215 and #239.
SpecPat.identwith specialisation patterns)processWandandiSpecializeCoreare now mutual definitions. Similarly,pmTermandspecPatare defined by mutual induction, so the definitions inProofModeTerm.leanare moved intoSpecPattern.lean..goalwithkind := .persistent)[# $H₁ … $Hₙ ], whereH₁ … Hₙare framed. Every hypotheses must be preceded by$as persistent premises do not consume spatial hypotheses, otherwiseprocessWandthrows a runtime error..autoframe .persistent)[#$]..goalwithkind := .modal)[> $H₁ … $Hₙ ]. This requires porting the type classAddModaland its instances. One of the instances useswandM, which is being ported in PR #470 foriinv..autoframe .modal)[>$].The original
SpecializeStatecontains the fieldpf : Q($orig ⊢ $e ∗ □?$p $out), butorig ⊢ e ∗ □?p outdoes not hold in general when the specialisation patterns involve.autoframe .modalor.goalwithkind := .modal. The assertion therefore has to be weakened as(e ∗ □?p out ⊢ goal) → orig ⊢ goal. The problem is thate ∗ □?p out ⊢ goalis still required by the theoremspecialize_dup_contextfor context duplication. The current solution is to have(e ∗ □?p out ⊢ goal) → orig ⊢ goalas a mandatory field andorig ⊢ e ∗ □?p outas an optional field inSpecializeState. Context duplication is possible only when the prooforig ⊢ e ∗ □?p outexists. Context duplication is mutually exclusive with specialisation patterns involving modalities.The missing
AddModalinstances are also being ported. This addresses #237 in full, as well as #255 and #400 in part.AddModalinstanceadd_modal_fupd_wpweakestpre.vWeakestPre.leanadd_modal_forallclass_instances.vInstances.leanadd_modal_tforallclass_instances.vInstances.leanadd_modal_wandclass_instances.vInstances.leanadd_modal_wandMclass_instances.vInstances.leanadd_modal_except_0class_instances_later.vInstancesLater.leanadd_modal_except_0_laterclass_instances_later.vInstancesLater.leanadd_modal_laterclass_instances_later.vInstancesLater.leanadd_modal_later_except_0class_instances_later.vInstancesLater.leanadd_modal_bupdclass_instances_updates.vInstancesUpdates.leanadd_modal_fupdclass_instances_updates.vInstancesUpdates.leanadd_modal_idclasses.vClasses.leanThere are also several modules yet to be ported in which
AddModalinstances are located:program_logic/total_weakestpre.v:add_modal_fupd_twpproofmode/class_instances_embedding.v:add_modal_embed_bupd_goal,add_modal_embed_fupd_goalproofmode/monpred.v:add_modal_at_bupd_goal,add_modal_at_fupd_goalOther Changes
SpecPat.parseis extended to return a pair forSyntaxandspecPatvalues so thatprocessWandcan usewithRefto provide more precise syntax highlighting for error messages.ProofModeM.trySynthInstanceinstead of the built-in synthesiser (trySynthInstance) for type classes with theipm_classannotation.ipm_backtrackannotations to the type class instancesintoAnd_sep,intoAnd_sep_affineandintoAbsorbingly_absorbing.eforiFrameis made implicit as it can always be inferred usinghyps.Checklist
authorssection of any appropriate files