The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V34. The tactics of Mathlib

Mathlib.Tactic.SwapVar

2 declarations. Mathlib docs · Source

Defines the swap_var tactic

Swap the names of two hypotheses.

def Mathlib.Tactic.swapRule E1 #

Lean.ParserDescr

The parser for swap rules

def Mathlib.Tactic.«tacticSwap_var__,,» E1 #

Lean.ParserDescr

swap_var swap_rule₁, swap_rule₂, ⋯ applies swap_rule₁ then swap_rule₂ then ⋯.

A swap_rule is of the form x y or x ↔ y, and "applying it" means swapping the variable name x by y and vice-versa on all hypotheses and the goal.

example {P Q : Prop} (q : P) (p : Q) : P ∧ Q := by
  swap_var p ↔ q
  exact ⟨p, q⟩