Section Sec.
Variable eta : nat.
intuition.
eapply comp_spec_consequence.
eapply (comp_spec_iso
(fun x => if (eqb a x) then b else if (eqb b x) then a else x)
(fun x => if (eqb a x) then b else if (eqb b x) then a else x)
); intuition.
(* forward direction *)
-
case_eq (eqb a x); intuition.
rewrite eqb_leibniz in H0; subst.
case_eq (eqb x b); intuition.
rewrite eqb_leibniz in H0; intuition.
rewrite eqb_refl.
trivial.
case_eq (b ?= x); intuition.
rewrite eqb_leibniz in H1.
subst.
rewrite eqb_refl.
trivial.
rewrite H1.
rewrite H0.
trivial.
(* backward direction *)
-
case_eq (eqb a x); intuition.
rewrite eqb_leibniz in H0. subst.
case_eq (eqb x b); intuition.
rewrite eqb_leibniz in H0.
intuition.
rewrite eqb_refl.
intuition.
case_eq (eqb b x); intuition.
rewrite eqb_leibniz in H1.
subst.
rewrite eqb_refl.
trivial.
rewrite H1.
rewrite H0.
trivial.
(* range of function is correct *)
-
simpl.
apply in_getAllBvectors.
(* probability is unchanged---follows form uniformity *)
-
eapply comp_spec_rnd.
- (*result is correct after isomorphism *)
intuition.
case_eq (a ?= a0); intuition;
rewrite H0 in H.
rewrite eqb_leibniz in H0.
intuition.
case_eq (b ?= a0); intuition;
rewrite H1 in H.
rewrite eqb_leibniz in H1.
intuition.
left.
intuition; subst.
subst.
rewrite eqb_refl in H0.
discriminate.
subst.
rewrite eqb_refl in H1.
discriminate.
Qed.
Definition to_list (A : Type) (n : nat) (v : Vector.t A n) := Vector.to_list v.
induction 1; intuition; simpl in *; subst; intuition.
Qed.

Theorem list_pred_swap_In_eq :
forall (A : Set)(a b : A) ls1 ls2,
list_pred
(fun x y  =>
(x = y /\ x <> a /\ x <> b) \/ a = x /\ b = y \/ b = x /\ a = y) ls1 ls2 ->
forall z,
z <> a -> z <> b -> (In z ls1 <-> In z ls2).