Expand description
Tactic values and the combinators that compose them — the language layer over
the primitive ProofState methods. The backtracking combinators (first,
try_, repeat) speculate on a clone of the state and commit only on success,
so a partial failure never corrupts the proof.
Functions§
- all_
goals - any_
goals t1 <;> t2-style: applytto EVERY goal currently open (not just the focused one). Each goal is focused in turn; the subgoalstproduces for it become the new open set, in original goal order.any_goals t: runton every open goal, keeping the goals it left and the goals it declined alike, and succeed iff it succeeded on AT LEAST ONE.- apply
apply name(modus ponens against a named rule) as a tactic value.- assumption
assumptionas a tactic value.- auto
auto(the backward chainer) as a tactic value.- by_
contra by_contra has a tactic value.- by_rule
by_rule Ras a tactic value — discharge the goal with the NAMED inference rule.- calc
calc h1 h2 …as a tactic value — compose the named chain.- cases
cases name(∧/∨/∃ elimination) as a tactic value.- cases_
with cases name with a bas a tactic value.- crush
crushas a tactic value.- decide
decideas a tactic value.- exact
exact nameas a tactic value.- exact_
term exact <term>as a tactic value.- exists
exists witness(∃I) as a tactic value.- exists_
term exists <term>as a tactic value, with the witness resolved against the goal’s scope.- first
first [t1, t2, …]: try each tactic on a speculative copy and commit the first that succeeds; fail only if none apply.- focus
· t/focus t/next t: runton the focused goal ALONE, and make it an error for the block to leave that goal open.- have
have name from <term>as a tactic value.- induction
induction(structural induction overNat) as a tactic value.- induction_
on induction nameas a tactic value.- induction_
over induction_over(generic structural induction overind_type) as a tactic value.- intro
intro nameas a tactic value.- left
left(∨I) as a tactic value.- linarith
omegaas a tactic value.linarith(rational Fourier-Motzkin with a Farkas certificate) as a tactic value.- omega
- refine
refine <term>as a tactic value.- repeat
repeat t: applytas long as it keeps applying (committing each success), then stop. Always succeeds. Bounded to avoid a non-progressing tactic looping forever.- rewrite
- rewrite_
at rewrite name(Leibniz substitution by an equality) as a tactic value.rewrite h at kas a tactic value — thek-th occurrence, 0-based.- rewrite_
hyp_ at rewrite h at hp— the LOCATION form, rewriting a HYPOTHESIS rather than the goal.- rfl
rfl(closet = tby reflexivity) as a tactic value.- right
right(∨I) as a tactic value.- ring
ring(commutative-ring normalisation) as a tactic value.- seq
t1; t2; …: run each tactic in turn; fail (without committing the rest) at the first that does not apply.- simp
simpas a tactic value, its rule set drawn from everything in scope (premises, intro’d hypotheses, cited lemmas) — the script-level default.- simp_
only simp only [a, b]as a tactic value — the rule set is exactly the named hypotheses.- simp_
with simp [a, b]as a tactic value — Lean’s “these AS WELL”, which for a default set that is already the whole scope adds nothing. The names are still resolved, so a typo is an error rather than a silently ignored rule.- split
split(∧I) as a tactic value.- then_
all t1 <;> t2: runt1on the focused goal, thent2on exactly the goalst1PRODUCED — not on every goal that happens to be open.- try_
try t: runtif it applies, otherwise leave the state unchanged. Always succeeds.