proposition: Lemma get_case : ∀ LA (I : heap_choiceType * heap_choiceType → Prop) ℓ, INV LA I → ℓ \in LA → r⊨ ⦃ λ '(s₀, s₃), I (s₀, s₃) ⦄ x ← get ℓ ;; ret x ≈ x ← get ℓ ;; ret x ⦃ λ '(b₁, s₁) '(b₂, s₂), b₁ = b₂ ∧ I (s₁, s₂) ⦄.
proof: Proof. intros LA I ℓ hinv hin. intros [s₁ s₂]. simpl. rewrite /SpecificationMonads.MonoCont_bind /=. rewrite /SpecificationMonads.MonoCont_order /SPropMonadicStructures.SProp_op_order /Morphisms.pointwise_relation /Basics.flip /SPropMonadicStructures.SProp_order /=. intuition auto. assert (get_heap s₁ ℓ = get_heap s₂ ℓ) as Hv. { unfold INV in hinv. specialize (hinv s₁ s₂). destruct hinv as [hinv _]. eapply hinv. all: auto. } pose v := (SDistr_unit _ (((get_heap s₁ ℓ), s₁), ((get_heap s₂ ℓ), s₂))). exists v. split. - apply SDistr_unit_F_choice_prod_coupling. reflexivity. - intros [b₁ s₃] [b₂ s₄]. intro hd. apply H1. rewrite dunit1E in hd. assert ( (get_heap s₁ ℓ, s₁, (get_heap s₂ ℓ, s₂)) = (b₁, s₃, (b₂, s₄)) ) as e. { destruct ((get_heap s₁ ℓ, s₁, (get_heap s₂ ℓ, s₂)) == (b₁, s₃, (b₂, s₄))) eqn:e. - move: e => /eqP e. assumption. - rewrite e in hd. cbn in hd. rewrite order.Order.POrderTheory.ltxx in hd. discriminate. } inversion e. subst. intuition auto. Qed.
imports: Coq(Utf8) Relational(OrderEnrichedCategory OrderEnrichedRelativeMonadExamples) mathcomp(ssrnat ssreflect ssrfun ssrbool ssrnum eqtype choice reals distr seq all_algebra fintype realsum) extructures(ord fset fmap) Mon(SPropBase) Crypt(Prelude Axioms ChoiceAsOrd SubDistr Couplings RulesStateProb UniformStateProb UniformDistrLemmas StateTransfThetaDens StateTransformingLaxMorph choice_type pkg_core_definition pkg_notation pkg_tactics pkg_composition pkg_heap pkg_semantics pkg_lookup pkg_advantage pkg_invariants pkg_distr) Equations.Prop.DepElim Equations(Equations) Crypt(FreeProbProg)