Speed up the compilation of properties.v a little bit

This commit is contained in:
Dan Frumin 2017-05-25 15:11:41 +02:00
parent 140b02e9f4
commit 9202c6489d
1 changed files with 53 additions and 59 deletions

View File

@ -20,8 +20,7 @@ try (intros ; apply set_path2) ; cbn.
rewrite P. rewrite P.
rewrite (comm y x). rewrite (comm y x).
rewrite <- (assoc x y y). rewrite <- (assoc x y y).
rewrite Q. f_ap.
reflexivity.
Defined. Defined.
@ -177,22 +176,24 @@ Defined.
Theorem intersection_idem : forall (X : FSet A), intersection X X = X. Theorem intersection_idem : forall (X : FSet A), intersection X X = X.
Proof. Proof.
hinduction; try (intros; apply set_path2). hinduction; try (intros ; apply set_path2).
- reflexivity. - reflexivity.
- intro a. - intro a.
destruct (dec (a = a)). destruct (dec (a = a)).
* reflexivity. * reflexivity.
* contradiction (n idpath). * contradiction (n idpath).
- intros X Y IHX IHY. - intros X Y IHX IHY.
f_ap;
unfold intersection in *. unfold intersection in *.
rewrite comprehension_or. + transitivity (U (comprehension (fun a => isIn a X) X) (comprehension (fun a => isIn a Y) X)).
rewrite comprehension_or. apply comprehension_or.
rewrite IHX. rewrite IHX.
rewrite IHY. rewrite (comm X).
rewrite comprehension_subset. apply comprehension_subset.
rewrite (comm X). + transitivity (U (comprehension (fun a => isIn a X) Y) (comprehension (fun a => isIn a Y) Y)).
rewrite comprehension_subset. apply comprehension_or.
reflexivity. rewrite IHY.
apply comprehension_subset.
Defined. Defined.
(** assorted lattice laws *) (** assorted lattice laws *)
@ -270,8 +271,6 @@ hinduction x; try (intros ; apply set_path2) ; cbn.
reflexivity. reflexivity.
Defined. Defined.
Theorem intersection_assoc (X Y Z: FSet A) : Theorem intersection_assoc (X Y Z: FSet A) :
intersection X (intersection Y Z) = intersection (intersection X Y) Z. intersection X (intersection Y Z) = intersection (intersection X Y) Z.
Proof. Proof.
@ -314,14 +313,12 @@ hinduction; try (intros ; apply set_path2).
* reflexivity. * reflexivity.
* contradiction (n idpath). * contradiction (n idpath).
- intros X1 X2 P Q. - intros X1 X2 P Q.
rewrite comprehension_or. f_ap; (etransitivity; [ apply comprehension_or |]).
rewrite comprehension_or. rewrite P. rewrite (comm X1).
rewrite P. apply comprehension_subset.
rewrite Q. rewrite Q.
rewrite comprehension_subset. apply comprehension_subset.
rewrite (comm X1).
rewrite comprehension_subset.
reflexivity.
Defined. Defined.
@ -338,13 +335,16 @@ hinduction X1; try (intros ; apply set_path2) ; cbn.
rewrite p. rewrite p.
rewrite comprehension_subset. rewrite comprehension_subset.
reflexivity. reflexivity.
- intros. unfold intersection. (* TODO isIn is simplified too much *) - intros.
rewrite comprehension_or. assert (Y = intersection (U (L a) Y) Y) as HY.
rewrite comprehension_or. { unfold intersection. symmetry.
(* rewrite intersection_La. *) transitivity (U (comprehension (fun x => isIn x (L a)) Y) (comprehension (fun x => isIn x Y) Y)).
apply comprehension_or.
rewrite comprehension_all.
apply comprehension_subset. }
rewrite <- HY.
admit. admit.
- unfold intersection. - unfold intersection.
cbn.
intros Z1 Z2 P Q. intros Z1 Z2 P Q.
rewrite comprehension_or. rewrite comprehension_or.
assert (U (U (comprehension (fun a : A => isIn a Z1) X2) assert (U (U (comprehension (fun a : A => isIn a Z1) X2)
@ -358,12 +358,13 @@ hinduction X1; try (intros ; apply set_path2) ; cbn.
rewrite <- assoc. rewrite <- assoc.
rewrite (assoc (comprehension (fun a : A => isIn a Z2) X2)). rewrite (assoc (comprehension (fun a : A => isIn a Z2) X2)).
rewrite Q. rewrite Q.
cbn.
rewrite rewrite
(comm (U (comprehension (fun a : A => (isIn a Z2 || isIn a Y)%Bool) X2) (comm (U (comprehension (fun a : A => (isIn a Z2 || isIn a Y)%Bool) X2)
(comprehension (fun a : A => (isIn a Z2 || isIn a Y)%Bool) Y)) Y). (comprehension (fun a : A => (isIn a Z2 || isIn a Y)%Bool) Y)) Y).
rewrite assoc. rewrite assoc.
rewrite P. rewrite P.
rewrite <- assoc. rewrite <- assoc. cbn.
rewrite (assoc (comprehension (fun a : A => (isIn a Z1 || isIn a Y)%Bool) Y)). rewrite (assoc (comprehension (fun a : A => (isIn a Z1 || isIn a Y)%Bool) Y)).
rewrite (comm (comprehension (fun a : A => (isIn a Z1 || isIn a Y)%Bool) Y)). rewrite (comm (comprehension (fun a : A => (isIn a Z1 || isIn a Y)%Bool) Y)).
rewrite <- assoc. rewrite <- assoc.
@ -443,40 +444,33 @@ Lemma subsect_intersection `{Funext} (X Y : FSet A) :
Proof. Proof.
hinduction X; try (intros; apply path_forall; intro; apply set_path2). hinduction X; try (intros; apply path_forall; intro; apply set_path2).
- intros. apply nl. - intros. apply nl.
- intros a. hinduction Y; - intros a. hinduction Y;
try (intros; apply path_forall; intro; apply set_path2). try (intros; apply path_forall; intro; apply set_path2).
(*intros. apply equiv_hprop_allpath.*) + intro. contradiction (false_ne_true).
+ intro. cbn. contradiction (false_ne_true). + intros. destruct (dec (a = a0)).
+ intros. destruct (dec (a = a0)). rewrite p; apply idem.
rewrite p; apply idem. contradiction (false_ne_true).
contradiction (false_ne_true). + intros X1 X2 IH1 IH2.
+ intros X1 X2 IH1 IH2. intro Ho.
intro Ho. destruct (isIn a X1);
destruct (isIn a X1); destruct (isIn a X2).
destruct (isIn a X2). * specialize (IH1 idpath).
specialize (IH1 idpath). rewrite assoc. f_ap.
specialize (IH2 idpath). * specialize (IH1 idpath).
rewrite assoc. rewrite IH1. reflexivity. rewrite assoc. f_ap.
specialize (IH1 idpath). * specialize (IH2 idpath).
rewrite assoc. rewrite IH1. reflexivity. rewrite (comm X1 X2).
specialize (IH2 idpath). rewrite assoc. f_ap.
rewrite assoc. rewrite (comm (L a)). rewrite <- assoc. rewrite IH2. * contradiction (false_ne_true).
reflexivity.
cbn in Ho. contradiction (false_ne_true).
- intros X1 X2 IH1 IH2 G. - intros X1 X2 IH1 IH2 G.
destruct (subset X1 Y); destruct (subset X1 Y);
destruct (subset X2 Y). destruct (subset X2 Y).
specialize (IH1 idpath). * specialize (IH1 idpath).
specialize (IH2 idpath). specialize (IH2 idpath).
rewrite <- assoc. rewrite IH2. rewrite IH1. reflexivity. rewrite <- assoc. rewrite IH2. apply IH1.
specialize (IH1 idpath). * contradiction (false_ne_true).
apply IH2 in G. * contradiction (false_ne_true).
rewrite <- assoc. rewrite G. rewrite IH1. reflexivity. * contradiction (false_ne_true).
specialize (IH2 idpath).
apply IH1 in G.
rewrite <- assoc. rewrite IH2. rewrite G. reflexivity.
specialize (IH1 G). specialize (IH2 G).
rewrite <- assoc. rewrite IH2. rewrite IH1. reflexivity.
Defined. Defined.
End properties. End properties.