Documentation

Lean.Parser.Tactic

match performs case analysis on one or more expressions. See Induction and Recursion. The syntax for the match tactic is the same as term-mode match, except that the match arms are tactics instead of expressions.

example (n : Nat) : n = n := by
  match n with
  | 0 => rfl
  | i+1 => simp
Instances For

    Introduces one or more hypotheses, optionally naming and/or pattern-matching them. For each hypothesis to be introduced, the remaining main goal's target type must be a let or function type.

    • intro by itself introduces one anonymous hypothesis, which can be accessed by e.g. assumption. It is equivalent to intro _.
    • intro x y introduces two hypotheses and names them. Individual hypotheses can be anonymized via _, given a type ascription, or matched against a pattern:
      -- ... ⊢ α × β → ...
      intro (a, b)
      -- ..., a : α, b : β ⊢ ...
      
    • intro rfl is short for intro h; subst h, if h is an equality where the left-hand or right-hand side is a variable.
    • Alternatively, intro can be combined with pattern matching much like fun:
      intro
      | n + 1, 0 => tac
      | ...
      
    Instances For