Documentation

Mathlib.Tactic.Set

The set tactic #

This file defines the set tactic and its variant set!.

set a := t with h is a variant of let a := t. It adds the hypothesis h : a = t to the local context and replaces t with a everywhere it can. set a := t with ← h will add h : t = a instead. set! a := t with h does not do any replacing.

set a := t with h is a variant of let a := t. It adds the hypothesis h : a = t to the local context and replaces t with a everywhere it can.

set a := t with ← h will add h : t = a instead.

set! a := t with h does not do any replacing.

example (x : Nat) (h : x + x - x = 3) : x + x - x = 3 := by
  set y := x with ← h2
  sorry
/-
x : Nat
y : Nat := x
h : y + y - y = 3
h2 : x = y
⊢ y + y - y = 3
-/
Equations
    Instances For

      set a := t with h is a variant of let a := t. It adds the hypothesis h : a = t to the local context and replaces t with a everywhere it can.

      set a := t with ← h will add h : t = a instead.

      set! a := t with h does not do any replacing.

      example (x : Nat) (h : x + x - x = 3) : x + x - x = 3 := by
        set y := x with ← h2
        sorry
      /-
      x : Nat
      y : Nat := x
      h : y + y - y = 3
      h2 : x = y
      ⊢ y + y - y = 3
      -/
      
      Equations
        Instances For