lean4-htt/tests/lean/run/funext.lean
James Gallicchio 65db25bf49
feat: funext no arg tactic (#2027)
* feat: `funext` no arg tactic

Description of funext tactic includes behavior that is not implemented. This implements the behavior.

* fix

* feat: test new funext tactic

* use repeat for clarity of intent
2023-01-15 08:53:49 -08:00

26 lines
920 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

theorem ex1 : (fun y => y + 0) = (fun x => 0 + x) := by
funext x
simp
theorem ex2 : (fun y x => y + x + 0) = (fun x y => y + x) := by
funext x y
rw [Nat.add_zero, Nat.add_comm]
theorem ex3 : (fun (x : Nat × Nat) => x.1 + x.2) = (fun (x : Nat × Nat) => x.2 + x.1) := by
funext (a, b)
show a + b = b + a
rw [Nat.add_comm]
theorem ex4 : (fun (x : Nat × Nat) (y : Nat × Nat) => x.1 + y.2) = (fun (x : Nat × Nat) (z : Nat × Nat) => z.2 + x.1) := by
funext (a, b) (c, d)
show a + d = d + a
rw [Nat.add_comm]
theorem ex5 : (fun (x : Id Nat) => x.succ + 0) = (fun (x : Id Nat) => 0 + x.succ) := by
funext (x : Nat)
have y := x + 1 -- if `(x : Nat)` is not used at `funext`, then `x+1` would fail to be elaborated since we don't have the instance `Add (Id Nat)`
rw [Nat.add_comm]
theorem ex6 : (fun (x : Nat) y z => x + y + z) = (fun x y z => x + (y + z)) := by
funext
rw [Nat.add_assoc]