lean4-htt/tests/lean/run/struct_value.lean
2017-03-09 18:41:19 -08:00

43 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.

#check { prod . fst := 10, snd := 20 }
#check ({ fst := 10, snd := 20 } : nat × nat)
definition p : nat × nat :=
{ snd := 20, fst := 10 }
#print p
definition attr : user_attribute :=
{ name := `foo, descr := "hello world" }
#print attr
definition p2 :=
{ p with fst := 20 }
#print p2
structure point :=
(x : nat) (y : nat)
structure point3d extends point :=
(z : nat)
definition p1 : point := { x := 1, y := 1 }
definition p3 : point3d := { p1 with z := 10 }
#print p3
#check { point3d . x := 1, y := 2, z := 3 }
#check (⟨10, rfl⟩ : Σ' x : nat, x = x)
#check ((| 10, rfl |) : Σ' x : nat, x = x)
#check ({ fst := 10, snd := rfl } : Σ' x : nat, x = x)
definition f (a : nat) : Σ' x : nat, x = x :=
{ fst := a, snd := rfl }
#print f