lean4-htt/tests/lean/run/partialApp.lean
2020-10-27 18:29:19 -07:00

44 lines
923 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.

def f (x : Nat) (y : Nat := 1) (w : Nat := 2) (z : Nat) :=
x + y + w - z
theorem ex1 (x z : Nat) : f (z := z) x = x + 1 + 2 - z :=
rfl
theorem ex2 (x z : Nat) : f x (z := z) = x + 1 + 2 - z :=
rfl
theorem ex3 (x y : Nat) : f x y = fun z => x + y + 2 - z :=
rfl
theorem ex4 : f = (fun x z => x + 1 + 2 - z) :=
rfl
theorem ex5 (x : Nat) : f x = fun z => x + 1 + 2 - z :=
rfl
theorem ex6 (y : Nat) : f (y := 5) = fun x z => x + 5 + 2 - z :=
rfl
def g {α} [Add α] (a : α) (b? : Option α := none) (c : α) : α :=
match b? with
| none => a + c
| some b => a + b + c
variables {α} [Add α]
theorem ex7 : g = fun (a c : α) => a + c :=
rfl
theorem ex8 (x : α) : g (c := x) = fun (a : α) => a + x :=
rfl
theorem ex9 (x : α) : g (b? := some x) = fun (a c : α) => a + x + c :=
rfl
theorem ex10 (x : α) : g x = fun (c : α) => x + c :=
rfl
theorem ex11 (x y : α) : g x y = fun (c : α) => x + y + c :=
rfl