@@ -555,13 +555,17 @@ Ltac monadInv H :=
555
555
(** ** Freshness and separation properties. *)
556
556
557
557
Definition within (id: ident) (g1 g2: generator) : Prop :=
558
- Ple (gen_next g1) id /\ Plt id (gen_next g2).
558
+ exists p,
559
+ id = #(string_of_resid p) /\
560
+ Ple (gen_next g1) p /\ Plt p (gen_next g2).
559
561
560
562
Lemma gensym_within:
561
563
forall ty g1 id g2 I,
562
564
gensym ty g1 = Res id g2 I -> within id g1 g2.
563
565
Proof .
564
- intros. monadInv H. split. apply Ple_refl. apply Plt_succ.
566
+ intros. monadInv H.
567
+ exists (gen_next g1); intuition idtac.
568
+ apply Ple_refl. apply Plt_succ.
565
569
Qed .
566
570
567
571
Lemma within_widen:
@@ -571,7 +575,8 @@ Lemma within_widen:
571
575
Ple (gen_next g2) (gen_next g2') ->
572
576
within id g1' g2'.
573
577
Proof .
574
- intros. destruct H. split.
578
+ intros. destruct H as (? & ? & ?).
579
+ exists x; intuition idtac.
575
580
eapply Ple_trans; eauto.
576
581
eapply Plt_Ple_trans; eauto.
577
582
Qed .
@@ -609,26 +614,40 @@ Proof.
609
614
intros; red; intros. destruct (in_app_or _ _ _ H1); auto.
610
615
Qed .
611
616
617
+ Lemma ident_of_string_inj s t:
618
+ ident_of_string s = ident_of_string t -> s = t.
619
+ Proof .
620
+ intros Hst.
621
+ rewrite <- (string_of_ident_of_string s).
622
+ rewrite <- (string_of_ident_of_string t).
623
+ congruence.
624
+ Qed .
625
+
612
626
Lemma contained_disjoint:
613
627
forall g1 l1 g2 l2 g3,
614
628
contained l1 g1 g2 -> contained l2 g2 g3 -> list_disjoint l1 l2.
615
629
Proof .
616
630
intros; red; intros. red; intro; subst y.
617
- exploit H; eauto. intros [A B]. exploit H0; eauto. intros [Csyntax D].
618
- elim (Plt_strict x). apply Plt_Ple_trans with (gen_next g2); auto.
631
+ exploit H; eauto. intros (p & Hp & A & B).
632
+ exploit H0; eauto. intros (q & Hq & Csyntax & D).
633
+ assert (p = q) by (apply string_of_resid_inj, ident_of_string_inj; congruence).
634
+ subst q. elim (Plt_strict p). apply Plt_Ple_trans with (gen_next g2); auto.
619
635
Qed .
620
636
621
637
Lemma contained_notin:
622
638
forall g1 l g2 id g3,
623
639
contained l g1 g2 -> within id g2 g3 -> ~In id l.
624
640
Proof .
625
- intros; red; intros. exploit H; eauto. intros [Csyntax D]. destruct H0 as [A B].
626
- elim (Plt_strict id). apply Plt_Ple_trans with (gen_next g2); auto.
641
+ intros; red; intros.
642
+ exploit H; eauto. intros (p & Hp & Csyntax & D).
643
+ destruct H0 as (q & Hq & A & B).
644
+ assert (p = q) by (apply string_of_resid_inj, ident_of_string_inj; congruence).
645
+ subst q. elim (Plt_strict p). apply Plt_Ple_trans with (gen_next g2); auto.
627
646
Qed .
628
647
629
648
Definition dest_below (dst: destination) (g: generator) : Prop :=
630
649
match dst with
631
- | For_set sd => Plt ( sd_temp sd) g.(gen_next)
650
+ | For_set sd => exists p, sd_temp sd = #(string_of_resid p) /\ Plt p g.(gen_next)
632
651
| _ => True
633
652
end .
634
653
@@ -642,7 +661,7 @@ Lemma dest_for_set_seqbool_val:
642
661
forall tmp ty g1 g2,
643
662
within tmp g1 g2 -> dest_below (For_set (sd_seqbool_val tmp ty)) g2.
644
663
Proof .
645
- intros. destruct H. simpl. auto .
664
+ intros. destruct H as (p & Hp & A & B) . simpl. eauto .
646
665
Qed .
647
666
648
667
Lemma dest_for_set_seqbool_set:
@@ -654,27 +673,30 @@ Qed.
654
673
Lemma dest_for_set_condition_val:
655
674
forall tmp tycast ty g1 g2, within tmp g1 g2 -> dest_below (For_set (SDbase tycast ty tmp)) g2.
656
675
Proof .
657
- intros. destruct H. simpl. auto .
676
+ intros. destruct H as (p & Hp & A & B) . simpl. eauto .
658
677
Qed .
659
678
660
679
Lemma dest_for_set_condition_set:
661
680
forall sd tmp tycast ty g1 g2, dest_below (For_set sd) g2 -> within tmp g1 g2 -> dest_below (For_set (SDcons tycast ty tmp sd)) g2.
662
681
Proof .
663
- intros. destruct H0. simpl. auto .
682
+ intros. destruct H0 as (p & Hp & A & B) . simpl. eauto .
664
683
Qed .
665
684
666
685
Lemma sd_temp_notin:
667
686
forall sd g1 g2 l, dest_below (For_set sd) g1 -> contained l g1 g2 -> ~In (sd_temp sd) l.
668
687
Proof .
669
- intros. simpl in H. red; intros. exploit H0; eauto. intros [A B].
670
- elim (Plt_strict (sd_temp sd)). apply Plt_Ple_trans with (gen_next g1); auto.
688
+ intros. destruct H as (p & Hp & H). red; intros.
689
+ exploit H0; eauto. intros (q & Hq & A & B).
690
+ assert (p = q) by (apply string_of_resid_inj, ident_of_string_inj; congruence).
691
+ subst q. elim (Plt_strict p). apply Plt_Ple_trans with (gen_next g1); auto.
671
692
Qed .
672
693
673
694
Lemma dest_below_le:
674
695
forall dst g1 g2,
675
696
dest_below dst g1 -> Ple g1.(gen_next) g2.(gen_next) -> dest_below dst g2.
676
697
Proof .
677
- intros. destruct dst; simpl in *; auto. eapply Plt_Ple_trans; eauto.
698
+ intros. destruct dst; simpl in *; auto.
699
+ destruct H as (p & Hp & H). eauto using Plt_Ple_trans.
678
700
Qed .
679
701
680
702
Hint Resolve gensym_within within_widen contained_widen
0 commit comments