Definition optSwap (A : Set)(opt : option (A * A)) :=
  match opt with
    | None => None
    | Some (a1, a2) =>
      Some (a2, a1)
  end.

Theorem compFold_support_h : forall (A B : Set)(eqda : EqDec A)(P : A -> list B -> list B -> Prop)(c : A -> B -> Comp A) (ls1 ls2 ls3 : list B)(a z : A), In z (getSupport (compFold _ c a ls1)) -> P a ls2 (ls1 ++ ls3) -> (forall a1 a2 b ls1 ls2, In a2 (getSupport (c a1 b)) -> P a1 ls1 (b :: ls2) -> P a2 (ls1 ++ (b :: nil)) ls2 ) -> P z (ls2 ++ ls1) ls3.