proposition: Theorem ElGamal_OT : ∀ LA A, ValidPackage LA [interface #val #[getpk_id] : 'unit → 'pubkey ; #val #[challenge_id'] : 'plain → 'cipher ] A_export A → fdisjoint LA (ots_real_vs_rnd true).(locs) → fdisjoint LA (ots_real_vs_rnd false).(locs) → Advantage ots_real_vs_rnd A <= AdvantageE DH_rnd DH_real (A ∘ Aux).
proof: Proof. intros LA A vA hd₀ hd₁. simpl in hd₀, hd₁. clear hd₁. rename hd₀ into hd. rewrite Advantage_E. ssprove triangle (ots_real_vs_rnd false) [:: Aux ∘ DH_rnd ; Aux ∘ DH_real ] (ots_real_vs_rnd true) A as ineq. eapply le_trans. 1: exact ineq. clear ineq. rewrite ots_real_vs_rnd_equiv_true. 3: auto. 2:{ rewrite fdisjointUr. apply/andP. split. - unfold L_locs_counter in hd. rewrite fdisjointC. eapply fdisjoint_trans. 2:{ rewrite fdisjointC. exact hd. } rewrite [X in fsubset _ X]fset_cons. rewrite fset_cons. apply fsetUS. rewrite !fset_cons -fset0E. apply fsetUS. apply fsub0set. - unfold DH_loc. unfold L_locs_counter in hd. rewrite fdisjointC. eapply fdisjoint_trans. 2:{ rewrite fdisjointC. exact hd. } rewrite [X in fsubset _ X]fset_cons. apply fsubsetUr. } rewrite ots_real_vs_rnd_equiv_false. 2: auto. 2:{ rewrite fdisjointUr. apply/andP. split. - unfold L_locs_counter in hd. rewrite fdisjointC. eapply fdisjoint_trans. 2:{ rewrite fdisjointC. exact hd. } rewrite [X in fsubset _ X]fset_cons. rewrite fset_cons. apply fsetUS. rewrite !fset_cons -fset0E. apply fsetUS. apply fsub0set. - unfold DH_loc. unfold L_locs_counter in hd. rewrite fdisjointC. eapply fdisjoint_trans. 2:{ rewrite fdisjointC. exact hd. } rewrite [X in fsubset _ X]fset_cons. apply fsubsetUr. } rewrite GRing.addr0. rewrite GRing.add0r. rewrite -Advantage_link. auto. Qed.
imports: Relational(OrderEnrichedCategory GenericRulesSimple) mathcomp(all_ssreflect all_algebra reals distr realsum fingroup.fingroup solvable.cyclic prime ssrnat ssreflect ssrfun ssrbool ssrnum eqtype choice seq) Mon(SPropBase) Crypt(Axioms ChoiceAsOrd SubDistr Couplings UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb UniformStateProb pkg_core_definition choice_type pkg_composition pkg_rhl Package Prelude AsymScheme) Coq(Utf8) extructures(ord fset fmap) Equations(Equations)