feat: remaining introduction patterns and case destruction patterns#496
Open
alvinylt wants to merge 53 commits into
Open
feat: remaining introduction patterns and case destruction patterns#496alvinylt wants to merge 53 commits into
alvinylt wants to merge 53 commits into
Conversation
So that `bi` does not have to be an argument when `iCasesCore` is used
Currently requires `!%` to be the last pattern
…te whether to use `iclear` or `iframe`
For more accurate printing of error messages
…ting, TODO solved
… case destruction pattern generalisation
2 tasks
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 introduction patterns and case destruction patterns.
Addresses #213 and #239.
Features that are only used with
iintroon the top level are implemented as introduction patterns inIntroPattern.leanandIntro.lean.IntroPat*)all(*)**)allwand(**)!%)pureintro(!%)ipureintro. This does not necessarily have to be the last in the introduction pattern sequence. If there are further introduction patterns, attempt to enter IPM again and handle the rest of the patterns. This means applyingiintro !% %_ !%to⊢@{PROP} ⌜⌜ϕ⌝ ⊢@{PROP} ⌜ϕ⌝⌝works./=)simp(/=)dsimp. Usingdsimpinstead ofsimphere so that it resembles the use ofsimplin Rocq. To solve the goal directly, one can use//=instead (see below).//=)simptrivial(//=)/=and then//.{ selPat })clear({ selPatFrame* })selPatFrameis an optional!followed by a selection pattern. Hypotheses chosen by selection pattern without!are cleared from the context.{ $selPat })clear({ selPatFrame* })!are framed. Using!instead of$because the latter is used for anti-quotation in Lean, which would otherwise cause parsing errors, particularly for$#,$∗, etc.One feature that is not only used with
iintrobut also with other tactics (e.g.,icases) is implemented as a case destruction pattern inCasesPattern.leanandCases.lean.iCasesPat<-,->)rewrite(←,→)ϕexists as a pure premise or⌜ϕ⌝exists as a wand premise.Another feature is related to
ipureand other tactics involving case destruction patterns.ipureand other IPM tactics so that pure hypotheses can be destructed using the built-in destruction patterns in Lean. For example, givenp ∧ q → ⊢ □ ⌜((a ∧ b) ∧ c)⌝ -∗ P -∗ Q -∗ R, one should be able to applyiintro %⟨hp, hq⟩ %⟨⟨ha, hb⟩, hc⟩ HP HQ.Here we are re-using the built-in syntax
rcasesPatand functions inRCases.leanforrintro/rcases, which is more expressive thanintro/cases.Other Changes
Clear.leanandPure.leanso that features in relation toiclearcan be reused for the new introduction patterns.iFrameinFrame.leanandiCasesCoreinCases.lean, the argumentsbiandeare made implicit as they can always be inferred using other arguments.SelPattern.leanto useaddLocalVarInfofor prettier syntax highlighting of pure hypotheses in the selection patterns.kforiIntroCoreinIntro.leanso that the leveluis universally quantified. Similar to the change toProofModeContinuationin PR feat: iinduction #430.iIntroCoreandiCasesCoretakes a string (tactic name) as an argument so that they print more accurate error messages. Same for some functions thatiIntroCoreandiCasesCoreuse.ref : Syntaxis introduced intoiCasesPatso thatiCasesCoreuseswithReffor more precise syntax highlighting of errors. This resolves a to-do comment added in a previous commit.Before using
withRefiniCasesCore:After using
withRefiniCasesCore:syntaxdeclarations in relation tocasesPat,introPatandspecPatfor pop-up descriptions when one hovers over the patterns. Similar to PR doc: tactic descriptions with docstrings #464, where docstrings annotate elaborations for tactics..onecase iniCasesCore, useHyps.addWithInfoinstead of.mkHypand.mkSep. The previous approach ensures that, when theHypsinstance is an.emp, the new hypothesis is added using.mkHyprather than.mkSep. The functionHyps.add(which is in turn used byHyps.addWithInfo) was not able to handle this automatically, which preventediCasesCorefrom usingHyps.addWithInfodirectly. The functionHyps.addWithInfois now updated to handle this. See commit c59afb6 for the relevant changes. This resolves two to-do comments made in a previous commit.Checklist
authorssection of any appropriate files