Section PedersenBinding.
Variable A :  GroupElement -> Comp (GroupElement * (nat * nat) * (nat * nat)).
Definition B (x : GroupElement) :=
[c, p1, p2] <-$3 A x;
[v1, r1] <-2 p1;
[v2, r2] <-2 p2;
ret (modNat ((v1 + (modNatAddInverse v2 order)) * (multInverseModOrder (r2 + (modNatAddInverse r1 order)))) order)%nat.
Local Open Scope nat_scope.
intuition; omega.
Qed.
intuition.
subst.
intuition.
Qed.
induction c; intuition; simpl in *.
Qed.
intuition.
unfold modNatAddInverse.
rewrite mult_minus_distr_l.
rewrite modNat_mult_eq.
remember (modNat b c) as z.
eapply (modNat_add_same_r (modNat (a * z) c)).
rewrite Nat.sub_add.
rewrite modNat_arg_eq.
rewrite plus_comm.
rewrite <- modNat_plus.
rewrite plus_comm.
rewrite Nat.sub_add.
symmetry.
apply modNat_mult.
eapply mult_le_compat; intuition.
subst.
eapply lt_le_weak.
apply modNat_lt.
eapply lt_le_weak.
apply modNat_lt.
Qed.
intuition.
rewrite mult_comm.
rewrite modNat_mult_eq.
rewrite H0.
rewrite <- modNat_mult_eq.
rewrite mult_comm.
intuition.
Qed.
Local Close Scope nat_scope.

Theorem PedersenComputionallyBinding :
Pr[BindingCommit_G PedersenSetup _ PedersenReveal A] <=
Pr[(@DLP_G _ groupOp _ _ _ g order B)].