-
Notifications
You must be signed in to change notification settings - Fork 1
Intro Patterns
Vladimir Gladstein edited this page Mar 22, 2024
·
12 revisions
SSReflect intro patterns come after => tactical. The general syntax here would be tac=> intro_pats. This first executes tac, and then intro_pats. All intro patterns listed below are equivalent to their SSReflect counterparts (if there are such).
-
name(introduce with a given name),?(introduce with an autogenerated name),_(clear),->(rewrite left),<-(rewrite right). All listed patterns are applied to the to element of the goal stack. -
*(introduce everything),>(introduce all named variables) -
!applies a correspondent existential lemma (marked with@[ext]) to the goal -
/t: appliestto the top element on the goal stack -
/(_ t): applies top element on the goal stack tot -
/[swap],/[dup],/[apply]: swaps first two top hypothesis on the stack, duplicates top hypothesis on the stack, applies the first top hypothesis to the second top hypothesis -
[]: equivalent toscase -
![]: iterative version of[]. Destructs the top element on the goal stack and all its nested structures. Equivalent to[x .. [.. [y]]], e.g. to destruct∃ (x y : Nat) -
[ branch_1 | branch_2 | .. | branch_n ]: equivalent toscase, but runsbranch_ion thei-th subgoal, which appears after case analysis -
⟨ branch_1 | branch_2 | .. | branch_n ⟩: equivalent toconstructor, but runsbranch_ion thei-th subgoal, which appears after applying a corresponding constructor analysis -
?[]: destructs the top element on the goal stack and suggests you to use[ | ... | ]with a correct number of alternations instead. -
{ name_1 name_2 .. name_n }: clears allname_is -
{}name: equivalent toclear name; intro name -
/=,/==: equivalent todsimpandsimpcorrespondingly -
//: callsssr_trivtactic (combination ofsimp_allandtrivial). If you want to augment it with an extra tactictac, you can write:
macro_rules : tactic
| `(tactic| ssr_triv) => `(tactic| tac)Note that // will never fail. If it cannot solve the goal, it will leave it unchanged.
-
//=,//==: equivalent to// /=and// /== -
/[tac t]: calls tactict
Moreover, intro patterns are extensible. If you want to add your own intro pattern pat, just write:
syntax <pat> : ssrIntro.
elab_rules : tactic
| `(ssrIntro| pat) => <implementation>