casesm, cases_type, constructorm tactics #
These tactics implement repeated cases / constructor on anything satisfying a predicate.
Core tactic for casesm and cases_type. Calls cases on all fvars in g for which
matcher ldecl.type returns true.
recursive: if true, it calls itself repeatedly on the resulting subgoalsallowSplit: if false, it will skip any hypotheses wherecasesreturns more than one subgoal.throwOnNoMatch: if true, then throws an error if no match is found
Equations
- One or more equations did not get rendered due to their size.
Instances For
Elaborate a list of terms with holes into a list of patterns.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns true if any of the patterns match the expression.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Common implementation of casesm and casesm!.
Equations
- One or more equations did not get rendered due to their size.
Instances For
casesm p searches for the first hypothesis h : type where type matches the term p,
and splits the main goal by cases on h. Use holes in p to indicate arbitrary subexpressions,
for example casesm _ ∧ _ will match any conjunction. casesm p fails if no hypothesis type
matches p.
casesm p_1, ..., p_nsearches for a hypothesish : typewheretypematches one or more of the given patternsp_1, ...p_n, and splits the main goal by cases onh.casesm* prepeatedly performs case splits until no more hypothesis type matchesp. This is a more efficient and compact version of· repeat casesm p. It is more efficient because the pattern is compiled once.casesm! pandcasesm!* pskip a hypothesis if the main goal would be replaced with two or more subgoals.
Example:
example (h : a ∧ b ∨ c ∧ d) (h2 : e ∧ f) : True := by
-- The following tactic destructs all conjunctions and disjunctions in the current context.
casesm* _∨_, _∧_
· clear ‹a› ‹b› ‹e› ‹f›; (fail_if_success clear ‹c›); trivial
· clear ‹c› ‹d› ‹e› ‹f›; trivial
Equations
- One or more equations did not get rendered due to their size.
Instances For
casesm p searches for the first hypothesis h : type where type matches the term p,
and splits the main goal by cases on h. Use holes in p to indicate arbitrary subexpressions,
for example casesm _ ∧ _ will match any conjunction. casesm p fails if no hypothesis type
matches p.
casesm p_1, ..., p_nsearches for a hypothesish : typewheretypematches one or more of the given patternsp_1, ...p_n, and splits the main goal by cases onh.casesm* prepeatedly performs case splits until no more hypothesis type matchesp. This is a more efficient and compact version of· repeat casesm p. It is more efficient because the pattern is compiled once.casesm! pandcasesm!* pskip a hypothesis if the main goal would be replaced with two or more subgoals.
Example:
example (h : a ∧ b ∨ c ∧ d) (h2 : e ∧ f) : True := by
-- The following tactic destructs all conjunctions and disjunctions in the current context.
casesm* _∨_, _∧_
· clear ‹a› ‹b› ‹e› ‹f›; (fail_if_success clear ‹c›); trivial
· clear ‹c› ‹d› ‹e› ‹f›; trivial
Equations
- One or more equations did not get rendered due to their size.
Instances For
Common implementation of cases_type and cases_type!.
Equations
- One or more equations did not get rendered due to their size.
Instances For
cases_type I searches for a hypothesis h : type where I has the form (I ...), and splits the
main goal by cases on h. cases_type p fails if no hypothesis type has the identifier I as its
head symbol.
cases_type I_1 ... I_nsearches for a hypothesish : typewheretypehas one or more ofI_1, ...,I_nas its head symbol, and splits the main goal by cases onh.cases_type* Irepeatedly performs case splits until no more hypothesis type hasIas its head symbol. This shorthand for· repeat cases_type I.cases_type! pandcases_type!* pskip a hypothesis if the main goal would be replaced with two or more subgoals.
Example:
example (h : a ∧ b ∨ c ∧ d) (h2 : e ∧ f) : True := by
-- The following tactic destructs all conjunctions and disjunctions in the current context.
cases_type* Or And
· clear ‹a› ‹b› ‹e› ‹f›; (fail_if_success clear ‹c›); trivial
· clear ‹c› ‹d› ‹e› ‹f›; trivial
Equations
- One or more equations did not get rendered due to their size.
Instances For
cases_type I searches for a hypothesis h : type where I has the form (I ...), and splits the
main goal by cases on h. cases_type p fails if no hypothesis type has the identifier I as its
head symbol.
cases_type I_1 ... I_nsearches for a hypothesish : typewheretypehas one or more ofI_1, ...,I_nas its head symbol, and splits the main goal by cases onh.cases_type* Irepeatedly performs case splits until no more hypothesis type hasIas its head symbol. This shorthand for· repeat cases_type I.cases_type! pandcases_type!* pskip a hypothesis if the main goal would be replaced with two or more subgoals.
Example:
example (h : a ∧ b ∨ c ∧ d) (h2 : e ∧ f) : True := by
-- The following tactic destructs all conjunctions and disjunctions in the current context.
cases_type* Or And
· clear ‹a› ‹b› ‹e› ‹f›; (fail_if_success clear ‹c›); trivial
· clear ‹c› ‹d› ‹e› ‹f›; trivial
Equations
- One or more equations did not get rendered due to their size.
Instances For
Core tactic for constructorm. Calls constructor on all subgoals for which
matcher ldecl.type returns true.
recursive: if true, it calls itself repeatedly on the resulting subgoalsthrowOnNoMatch: if true, throws an error if no match is found
Equations
- One or more equations did not get rendered due to their size.
Instances For
constructorm p_1, ..., p_n, where the main goal has type type, applies the first matching
constructor for type, if type matches one of the given patterns. If type does not match any
of the patterns, constructorm fails.
constructorm* p_1, ..., p_nrepeatedly applies a constructor until the goal no longer matchesp_1, ...,p_n. This is a more efficient and compact version of· repeat constructorm p_1, ..., p_n. It is more efficient because the pattern is compiled once.
Examples:
example : True ∧ (True ∨ True) := by
constructorm* _ ∨ _, _ ∧ _, True
Equations
- One or more equations did not get rendered due to their size.