lean4-htt/tests/lean/run/335.lean
Joachim Breitner 378b02921d
refactor: port recOn construction to Lean (#4516)
this is the simplest of the constructions to be ported from C++ to Lean,
so I’ll PR this one first.

This begins to put each construction into its own file, as it was the
case with C++.

For validation I developed this in a separate repository at
https://github.com/nomeata/lean-constructions/tree/fad715e
and checked that all `.recOn` declarations found in Lean and Mathlib are
identical (per `==`) to the ones produced by the C code.
2024-06-23 07:36:27 +00:00

48 lines
1.2 KiB
Text

set_option pp.mvars false
opaque foo : {x : Nat} → Type
opaque bar : {T : Type} → ({x : T} → Type) → Type
structure Baz where
baz : {x : Nat} → Type
/-- info: bar fun {x} => foo : Type -/
#guard_msgs in
#check bar foo
/-- info: fun b => bar fun {x} => b.baz : Baz → Type -/
#guard_msgs in
#check fun (b : Baz) => bar b.baz
structure Ty where
ctx : Type
ty : ctx → Type
structure Tm where
ty : Ty
tm : ∀ {Γ}, ty.ty Γ
/--
info: fun Γ A x x_1 xTy =>
Eq.rec (motive := fun ty x => {Γ : ty.ctx} → ty.ty Γ) (fun {Γ} => x_1.tm)
xTy : (Γ : Type) → (A : Ty) → (x : Γ = A.ctx) → (x_1 : Tm) → (xTy : x_1.ty = A) → A.ty (?_ Γ A x x_1 xTy)
-/
#guard_msgs in
#check fun (Γ : Type)
(A : Ty)
(_ : Γ = A.ctx)
(x : Tm)
(xTy : x.ty = A)
=> Eq.rec (motive := fun ty _ => ∀ {Γ:ty.ctx}, ty.ty Γ) (fun {Γ} => x.tm (Γ:=Γ)) xTy
/--
info: fun Γ A x x_1 xTy =>
Eq.rec (motive := fun ty x => {Γ : ty.ctx} → ty.ty Γ) (fun {Γ} => x_1.tm)
xTy : (Γ : Type) → (A : Ty) → (x : Γ = A.ctx) → (x_1 : Tm) → (xTy : x_1.ty = A) → A.ty (?_ Γ A x x_1 xTy)
-/
#guard_msgs in
#check fun (Γ : Type)
(A : Ty)
(_ : Γ = A.ctx)
(x : Tm)
(xTy : x.ty = A)
=> Eq.rec (motive := fun ty _ => ∀ {Γ:ty.ctx}, ty.ty Γ) x.tm xTy