This fixes #2901, a bug in the old compiler which causes a segfault. The issue is that when visiting `noConfusion` applications, it assumes that each constructor case has `nfields` arguments, e.g. `head1 = head2 -> tail1 = tail2 -> P` has two arguments because `List.cons` has 2 fields, but in fact propositional fields are skipped by the noConfusion type generator, so for example `Subtype.noConfusionType` is: ```lean @[reducible] protected def Subtype.noConfusionType.{u_1, u} : {α : Sort u} → {p : α → Prop} → Sort u_1 → Subtype p → Subtype p → Sort u_1 := fun {α} {p} P v1 v2 ↦ Subtype.casesOn v1 fun val property ↦ Subtype.casesOn v2 fun val_1 property ↦ (val = val_1 → P) → P ``` where `val = val_1 → P` only has the one argument even though `Subtype.mk` has two fields, presumably because it is useless to have an equality of propositions. Unfortunately there isn't any easy cache or getter to use here to get the number of non-propositional fields, so we just calculate it on the spot.
14 lines
511 B
Text
14 lines
511 B
Text
def Vector (α : Type u) (n : Nat) :=
|
||
{ l : List α // l.length = n }
|
||
|
||
inductive HVect : (n : Nat) -> (Vector (Type v) n) -> Type (v+1) where
|
||
| Nil : HVect 0 ⟨ [], simp ⟩
|
||
| Cons : (t : Type v) -> (x : t) -> HVect n ⟨ts, p⟩ -> HVect (n+1) ⟨t::ts, by simp [p]⟩
|
||
|
||
def printHOK (v : HVect (n+1) ⟨String::ts, p'⟩) : String :=
|
||
match v with
|
||
| HVect.Cons _ x _ => (x : String)
|
||
|
||
def printHKO (v : HVect (n+1) ⟨String::ts, p'⟩) : String :=
|
||
match v with
|
||
| HVect.Cons _ x _ => "Hi"
|