lean4-htt/tests/lean/415.lean
Sebastian Ullrich 3a56db2812 chore: fix tests
2022-06-27 22:37:02 +02:00

39 lines
758 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.

structure Point where
x : Nat
y : Nat
def f (x : Nat) : Point :=
let y := x + 1
{ x, y }
theorem ex1 : f x = { x, y := x + 1 } :=
rfl
def g (p : Point) : Nat :=
p.x + p.y
def Set (α : Type u) : Type u :=
α → Prop
def Set.empty : Set α :=
fun a => False
def Set.insert (s : Set α) (a : α) : Set α :=
fun x => x = a s a
syntax (name := finSet) "{" term,* "}" : term
macro_rules (kind := finSet)
| `({ $as,* }) => do
as.getElems.foldlM (β := Lean.TSyntax _) (init := ← `(Set.empty)) fun s a => `(Set.insert $s $a)
#check { 1, 2, 3 }
#check fun x y => g {x, y}
#check fun x y : Nat => {x, y}
#check fun x y : Nat => {x, y : Point}
theorem ex2 (x y : Nat) : { x, y } = (Set.empty.insert x |>.insert y) :=
rfl