@@ -13,23 +13,42 @@ Set Implicit Arguments.
1313Set Strict Implicit .
1414Set Asymmetric Patterns.
1515Set Universe Polymorphism.
16+ Set Printing Universes .
17+
18+ Lemma app_ass_trans@{X} : forall {T : Type@{X} } (a b c : list T), (a ++ b) ++ c = a ++ b ++ c.
19+ Proof .
20+ induction a; simpl.
21+ reflexivity.
22+ intros. destruct (IHa b c). reflexivity.
23+ Defined .
24+
25+ Lemma app_nil_r_trans : forall {T : Type} (a : list T), a ++ nil = a.
26+ Proof .
27+ induction a; simpl.
28+ reflexivity.
29+ refine match IHa in _ = X return _ = _ :: X with
30+ | eq_refl => eq_refl
31+ end.
32+ Defined .
1633
1734(** Core Type and Functions * *)
1835Section hlist.
19- Context {iT : Type}.
20- Variable F : iT -> Type.
36+ Polymorphic Universe Ui Uv.
37+
38+ Context {iT : Type@{Ui}}.
39+ Variable F : iT -> Type@{Uv}.
2140
2241 Inductive hlist : list iT -> Type :=
2342 | Hnil : hlist nil
2443 | Hcons : forall l ls, F l -> hlist ls -> hlist (l :: ls).
2544
2645 Definition hlist_hd {a b} (hl : hlist (a :: b)) : F a :=
2746 match hl in hlist x return match x with
28- | nil => unit
29- | l :: _ => F l
47+ | nil => unit
48+ | l :: _ => F l
3049 end with
31- | Hnil => tt
32- | Hcons _ _ x _ => x
50+ | Hnil => tt
51+ | Hcons _ _ x _ => x
3352 end .
3453
3554 Definition hlist_tl {a b} (hl : hlist (a :: b)) : hlist b :=
@@ -56,20 +75,6 @@ Section hlist.
5675 | Hcons _ _ hd tl => fun r => Hcons hd (hlist_app tl r)
5776 end .
5877
59- Lemma app_ass_trans : forall {T} (a b c : list T), (a ++ b) ++ c = a ++ b ++ c.
60- Proof .
61- induction a; simpl.
62- reflexivity.
63- intros. f_equal. apply IHa.
64- Defined .
65-
66- Lemma app_nil_r_trans : forall {T} (a : list T), a ++ nil = a.
67- Proof .
68- induction a; simpl.
69- reflexivity.
70- f_equal. apply IHa.
71- Defined .
72-
7378 Lemma hlist_app_nil_r
7479 : forall ls (h : hlist ls),
7580 hlist_app h Hnil = match eq_sym (app_nil_r_trans ls) in _ = t return hlist t with
0 commit comments