proposition: Lemma r_swap_scheme_cmd : ∀ {A B : choiceType} (s : raw_code A) (c : command B), ValidCode fset0 [interface] s → ⊢ ⦃ λ '(s₀, s₁), s₀ = s₁ ⦄ x ← s ;; y ← cmd c ;; ret (x,y) ≈ y ← cmd c ;; x ← s ;; ret (x,y) ⦃ eq ⦄.
proof: Proof. intros A B s c h. induction h. all: try discriminate. 2:{ eapply fromEmpty. rewrite fset0E. eauto. } - simpl. apply rreflexivity_rule. - simpl. eapply r_transR. + eapply (rswap_cmd_eq _ _ _ (cmd_sample _) _). simpl. eapply rsamplerC'_cmd. + simpl. eapply (rsame_head_cmd (cmd_sample _)). intro a. eauto. 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)