lean4-htt/tests/lean/run/structInst3.lean
2022-09-13 07:09:08 -07:00

41 lines
639 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.

universe u
namespace Ex1
structure A (α : Type u) :=
(x : α) (f : αα := λ x => x)
structure B (α : Type u) extends A α :=
(y : α := f (f x)) (g : ααα := λ x y => f x)
structure C (α : Type u) extends B α :=
(z : α := g x y) (x := f z)
end Ex1
open Ex1
def c1 : C Nat := { x := 1 }
#check { c1 with z := 2 }
#check { c1 with z := 2 }
theorem ex1 : { c1 with z := 2 }.z = 2 :=
rfl
#check ex1
theorem ex2 : { c1 with z := 2 }.x = c1.x :=
rfl
#check ex2
def c2 : C (Nat × Nat) := { z := (1, 1) }
#check { c2 with x.fst := 2 }
#check { c2 with x.1 := 3 }
#check show C _ from { c2.toB with .. }