@@ -512,25 +512,22 @@ Section hlist.
512512 destruct e. reflexivity. }
513513 Qed .
514514
515- Lemma hlist_app_assoc' : forall ls ls' ls''
516- (a : hlist ls) (b : hlist ls') (c : hlist ls''),
517- hlist_app a (hlist_app b c) =
518- match app_ass_trans ls ls' ls'' in _ = t return hlist t with
515+ Lemma hlist_app_assoc'
516+ : forall (ls ls' ls'' : list iT)
517+ (a : hlist ls) (b : hlist ls') (c : hlist ls''),
518+ hlist_app a (hlist_app b c) =
519+ match
520+ app_ass_trans ls ls' ls'' in (_ = t) return (hlist t)
521+ with
519522 | eq_refl => hlist_app (hlist_app a b) c
520- end .
523+ end .
521524 Proof .
522- intros ls ls' ls''.
523- generalize (app_assoc_reverse ls ls' ls'').
524- induction ls; simpl; intros.
525- { rewrite (hlist_eta a); simpl. reflexivity. }
526- { rewrite (hlist_eta a0). simpl.
527- inversion H.
528- erewrite (IHls H1).
529- unfold eq_trans, f_equal.
530- generalize (app_ass_trans ls ls' ls'').
531- rewrite <- H1. clear; intro.
532- generalize dependent (hlist_app (hlist_app (hlist_tl a0) b) c).
533- destruct e. reflexivity. }
525+ clear. intros.
526+ generalize (hlist_app_assoc a b c).
527+ generalize (hlist_app (hlist_app a b) c).
528+ generalize (hlist_app a (hlist_app b c)).
529+ destruct (app_ass_trans ls ls' ls'').
530+ simpl. auto.
534531 Qed .
535532
536533 Fixpoint hlist_split ls ls' : hlist (ls ++ ls') -> hlist ls * hlist ls' :=
@@ -562,6 +559,46 @@ Section hlist.
562559
563560 End type.
564561
562+ Lemma hlist_hd_fst_hlist_split
563+ : forall t (xs ys : list _) (h : hlist (t :: xs ++ ys)),
564+ hlist_hd (fst (hlist_split (t :: xs) ys h)) = hlist_hd h.
565+ Proof .
566+ simpl. intros.
567+ match goal with
568+ | |- context [ match ?X with _ => _ end ] =>
569+ destruct X
570+ end. reflexivity.
571+ Qed .
572+
573+ Lemma hlist_tl_fst_hlist_split
574+ : forall t (xs ys : list _) (h : hlist (t :: xs ++ ys)),
575+ hlist_tl (fst (hlist_split (t :: xs) ys h)) =
576+ fst (hlist_split xs ys (hlist_tl h)).
577+ Proof .
578+ simpl. intros.
579+ match goal with
580+ | |- context [ match ?X with _ => _ end ] =>
581+ remember X
582+ end. destruct p. simpl.
583+ change h0 with (fst (h0, h1)).
584+ f_equal. assumption.
585+ Qed .
586+
587+ Lemma hlist_tl_snd_hlist_split
588+ : forall t (xs ys : list _) (h : hlist (t :: xs ++ ys)),
589+ snd (hlist_split xs ys (hlist_tl h)) =
590+ snd (hlist_split (t :: xs) ys h).
591+ Proof .
592+ simpl. intros.
593+ match goal with
594+ | |- context [ match ?X with _ => _ end ] =>
595+ remember X
596+ end. destruct p.
597+ simpl.
598+ change h1 with (snd (h0, h1)).
599+ rewrite Heqp. reflexivity.
600+ Qed .
601+
565602End hlist.
566603
567604Arguments Hnil {_ _}.
0 commit comments