(* Use of this source code is governed by the license described	* * in the LICENSE file at the root of the source tree.		*)
(* Some initial work on sigma protocols.  The goal is to prove that any sigma protocol is a proof of knowledge.  There is some interesting theory in here (e.g. the "emergency break" theorem), but it is far form complete.   *)
Set Implicit Arguments.
intuition.
destruct ls.
unfold sumList.
simpl.
rewrite ratAdd_0_r.
eapply ratAdd_eqRat_compat.
specialize (H0 false).
simpl in H0.
intuition.
specialize (H0 true).
simpl in H0.
intuition.
inversion H; clear H; subst.
destruct b;
rewrite sumList_cons.
rewrite ratAdd_comm.
eapply ratAdd_eqRat_compat; intuition.
destruct ls.
unfold sumList. simpl.
specialize (H0 false); intuition.
simpl in H3, H; intuition.
discriminate.
inversion H4; clear H4; subst.
destruct b.
simpl in H3.
intuition.
rewrite sumList_cons.
destruct ls.
unfold sumList; simpl.
rewrite <- ratAdd_0_r.
intuition.
destruct b; simpl in *; intuition.
eapply ratAdd_eqRat_compat.
intuition.
destruct ls.
unfold sumList.
simpl.
specialize (H0 true).
simpl in *.
intuition.
discriminate.
inversion H4; clear H4; subst.
destruct b.
rewrite sumList_cons.
destruct ls.
unfold sumList. simpl.
rewrite <- ratAdd_0_r.
intuition.
destruct b; simpl in *; intuition.
simpl in *; intuition.
Qed.

Lemma in_getSupport_or_evalDist_0 : forall (A : Set)(c : Comp A) a,
In a (getSupport c) \/ evalDist c a == 0.