lean4-htt/tests/lean/run/1260.lean

32 lines
1.1 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.

inductive dvec {X : Type} (Y : X → Type) : list X → Type
| dnil {} : dvec []
| dcons : Π {x : X}, Y x → Π {xs : list X}, dvec xs → dvec (x::xs)
namespace dvec
notation `⟦` l:(foldr `, ` (h t, dvec.dcons h t) dvec.dnil `⟧`) := l
def get {X : Type} [decidable_eq X] {Y : X → Type} (x₀ : X) [inhabited (Y x₀)]
: Π {xs : list X}, dvec Y xs → → Y x₀
| [] _ _ := default (Y x₀)
| (x::xs) (dvec.dcons y ys) 0 := if H : x = x₀ then eq.rec_on H y else default (Y x₀)
| (x::xs) (dvec.dcons y ys) (n+1) := get ys n
end dvec
constant tensor : list → Type
noncomputable instance inhabited_tensor (shape : list ) : inhabited (tensor shape) := sorry
constant f {shape : list } : tensor shape → tensor shape → tensor shape
noncomputable def bar {shape : list } (μσ : dvec tensor [shape, shape]) : tensor shape :=
let μ := dvec.get shape μσ 0, σ := dvec.get shape μσ 1 in f μ σ
lemma foo {shape : list } (μ σ : tensor shape) :
bar ⟦μ, σ⟧ = bar ⟦μ, σ⟧ :=
suffices H_suffices : true, from
begin
dunfold bar, dsimp,
dunfold dvec.get,
reflexivity
end,
trivial