Commit e1df5b4b authored by Dan Frumin's avatar Dan Frumin

Show that early/late refinement (refinement in the other direction).

parent 69f331e5
......@@ -127,21 +127,27 @@ Section Refinement.
rel_vals; eauto.
Qed.
Lemma refinement Γ ρ :
(spec_ctx ρ -
Γ lateChoice log earlyChoice : TArrow (Tref TNat) TBool)%I.
Lemma prerefinement2 Γ x x' n ρ :
(spec_ctx ρ - x ↦ᵢ (#nv n) - x' ↦ₛ (#nv n) -
Γ earlyChoice #x log lateChoice #x' : TBool)%I.
Proof.
iIntros "#Hspec".
unfold lateChoice in *. unfold earlyChoice in *. unlock.
iApply bin_log_related_arrow; eauto.
iAlways. iIntros (Δ (l,l')) "Hxx'". simpl.
iDestruct "Hxx'" as ([x x']) "[% #Hxx']". inversion H1; subst. simpl.
replace (λ: "x", "x" <- Nat 0 ;; rand #())%E
with (of_val lateChoice); last first.
{ unfold lateChoice. unlock. reflexivity. }
replace (λ: "x", (λ: "r", "x" <- Nat 0 ;; "r") (rand #()))%E
with (of_val earlyChoice); last first.
{ unfold earlyChoice. unlock. reflexivity. }
Abort.
iIntros "#Hspec Hx Hx'".
unfold earlyChoice. unlock.
rel_rec_l.
rel_bind_l (rand #())%E.
iApply (rand_l with "Hspec"); eauto. simpl. iIntros (b).
rel_rec_l.
unfold lateChoice. unlock.
rel_rec_r.
rel_store_r. simpl.
rel_rec_r.
rel_bind_r (rand #())%E.
iApply (rand_r b with "Hspec"); eauto. simpl.
rel_store_l. simpl.
rel_rec_l.
rel_vals; eauto.
Qed.
End Refinement.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment