22 lines
647 B
Text
22 lines
647 B
Text
/- Rewriting -/
|
||
|
||
example (f : Nat → Nat) (k : Nat) (h₁ : f 0 = 0) (h₂ : k = 0) : f k = 0 := by
|
||
rw [h₂] -- replace k with 0
|
||
rw [h₁] -- replace f 0 with 0
|
||
|
||
example (f : Nat → Nat) (k : Nat) (h₁ : f 0 = 0) (h₂ : k = 0) : f k = 0 := by
|
||
rw [h₂, h₁]
|
||
|
||
example (f : Nat → Nat) (a b : Nat) (h₁ : a = b) (h₂ : f a = 0) : f b = 0 := by
|
||
rw [← h₁, h₂]
|
||
|
||
example (f : Nat → Nat) (a : Nat) (h : 0 + a = 0) : f a = f 0 := by
|
||
rw [Nat.zero_add] at h
|
||
rw [h]
|
||
|
||
def Tuple (α : Type) (n : Nat) :=
|
||
{ as : List α // as.length = n }
|
||
|
||
example (n : Nat) (h : n = 0) (t : Tuple α n) : Tuple α 0 := by
|
||
rw [h] at t
|
||
exact t
|