proposition: Lemma r_uniform_prod : ∀ {A : ord_choiceType} i j `{Positive i} `{Positive j} (r : fin_family (mkpos i) → fin_family (mkpos j) → raw_code A), (∀ x y, ⊢ ⦃ λ '(s₀, s₁), s₀ = s₁ ⦄ r x y ≈ r x y ⦃ eq ⦄) → ⊢ ⦃ λ '(s₀, s₁), s₀ = s₁ ⦄ xy ← sample uniform (i * j) ;; let '(x,y) := ch2prod xy in r x y ≈ x ← sample uniform i ;; y ← sample uniform j ;; r x y ⦃ eq ⦄.
proof: Proof. intros A i j pi pj r h. change ( ⊢ ⦃ λ '(s₀, s₁), s₀ = s₁ ⦄ '(x,y) ← (z ← sample (uniform (i * j)) ;; ret (ch2prod z)) ;; r x y ≈ '(x,y) ← (x ← sample uniform i ;; y ← sample uniform j ;; ret (x, y)) ;; r x y ⦃ eq ⦄ ). eapply r_bind. - eapply UniformIprod_UniformUniform. - intros [? ?] [? ?]. eapply rpre_hypothesis_rule. intros ? ? e. noconf e. eapply rpre_weaken_rule. 1: eapply h. simpl. intros ? ? [? ?]. subst. reflexivity. 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)