Skip to content

Commit 49778e3

Browse files
author
Gregory Malecha
committed
A few more proofs.
1 parent ac569fb commit 49778e3

File tree

3 files changed

+70
-17
lines changed

3 files changed

+70
-17
lines changed

theories/Data/HList.v

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
565602
End hlist.
566603

567604
Arguments Hnil {_ _}.

theories/Data/Prop.v

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,6 @@ Proof.
101101
clear. intuition.
102102
destruct H0; eauto.
103103
Qed.
104+
105+
Lemma iff_eq : forall (P Q : Prop), P = Q -> (P <-> Q).
106+
Proof. clear. intros; subst; reflexivity. Qed.

theories/Data/SigT.v

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,16 @@ Section injective.
8282
abstract (inversion 1; subst; exists eq_refl; auto).
8383
Defined.
8484
End injective.
85+
86+
Lemma eq_sigT_rw
87+
: forall T U F (a b : T) (pf : a = b) s,
88+
match pf in _ = x return @sigT U (F x) with
89+
| eq_refl => s
90+
end =
91+
@existT U (F b) (projT1 s)
92+
match pf in _ = x return F x (projT1 s) with
93+
| eq_refl => (projT2 s)
94+
end.
95+
Proof. destruct pf. destruct s; reflexivity. Qed.
96+
97+
Hint Rewrite eq_sigT_rw : eq_rw.

0 commit comments

Comments
 (0)