lean4-htt/tests/elab/structInst3.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

79 lines
1.5 KiB
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
set_option pp.structureInstanceTypes true
namespace Ex1
structure A (α : Type u) where
(x : α) (f : αα := λ x => x)
structure B (α : Type u) extends A α where
(y : α := f (f x)) (g : ααα := λ x y => f x)
structure C (α : Type u) extends B α where
(z : α := g x y) (x := f z)
end Ex1
open Ex1
def c1 : C Nat := { x := 1 }
/--
info: let __src := c1;
{ toB := __src.toB, z := 2 : C Nat } : C Nat
-/
#guard_msgs in #check { c1 with z := 2 }
theorem ex1 : { c1 with z := 2 }.z = 2 :=
rfl
/--
info: ex1 :
(have __src := c1;
{ toB := __src.toB, z := 2 : C Nat }).z =
2
-/
#guard_msgs in #check ex1
theorem ex2 : { c1 with z := 2 }.x = c1.x :=
rfl
/--
info: ex2 :
(have __src := c1;
{ toB := __src.toB, z := 2 : C Nat }).x =
c1.x
-/
#guard_msgs in #check ex2
def c2 : C (Nat × Nat) := { z := (1, 1) }
/--
info: let __src := c2;
{
x :=
let __src := __src.x;
(2, __src.snd),
f := __src.f, y := __src.y, g := __src.g, z := __src.z : C (Nat × Nat) } : C (Nat × Nat)
-/
#guard_msgs in #check { c2 with x.fst := 2 }
/--
info: let __src := c2;
{
x :=
let __src := __src.x;
(3, __src.snd),
f := __src.f, y := __src.y, g := __src.g, z := __src.z : C (Nat × Nat) } : C (Nat × Nat)
-/
#guard_msgs in #check { c2 with x.1 := 3 }
/--
info: have this :=
let __src := c2.toB;
{ toB := __src, z := __src.g __src.x __src.y : C (Nat × Nat) };
this : C (Nat × Nat)
-/
#guard_msgs in #check show C _ from { c2.toB with .. }