Section ListHybrid.
Variable A B C S_A : Set.
Hypothesis eqdb : EqDec B.
Variable defA : A.
Variable A1 : Comp (list A * S_A).
Variable A2 : S_A -> A -> Comp B.
Variable A2' :  S_A -> A -> Comp B.
Variable A3 : S_A -> list B -> Comp C.
Hypothesis A1_wf : well_formed_comp A1.
Hypothesis A2_wf :  forall x y, well_formed_comp (A2 x y).
Hypothesis A2'_wf : forall x y, well_formed_comp (A2' x y).
Variable numA : nat.
Hypothesis numA_correct :
forall lsa s,
In (lsa, s) (getSupport A1) ->
length lsa = numA.
Definition LH_G0  :=
[lsa, s_A] <-$2 A1;
lsb <-$ compMap _ (A2 s_A) lsa;
A3 s_A lsb.
Definition LH_G1 :=
[lsa, s_A] <-$2 A1;
lsb <-$ compMap _ (A2' s_A) lsa;
A3 s_A lsb.
Definition LH_Gn n :=
[lsa, s_A] <-$2 A1;
lsa1 <- firstn n lsa;
lsa2 <- skipn n lsa;
lsb1 <-$ compMap _ (A2' s_A) lsa1;
lsb2 <-$ compMap _ (A2 s_A) lsa2;
A3 s_A (lsb1 ++ lsb2).
Definition LH_G_0  n :=
[lsa, s_A] <-$2 A1;
lsa1 <- firstn n lsa;
a <- nth n lsa defA;
lsa2 <- skipn (S n) lsa;
lsb1 <-$ compMap _ (A2' s_A) lsa1;
b <-$ A2 s_A a;
lsb2 <-$ compMap _ (A2 s_A) lsa2;
A3 s_A (lsb1 ++ (b :: lsb2)).
Definition LH_G_1  n :=
[lsa, s_A] <-$2 A1;
lsa1 <- firstn n lsa;
a <- nth n lsa defA;
lsa2 <- skipn (S n) lsa;
lsb1 <-$ compMap _ (A2' s_A) lsa1;
b <-$ A2' s_A a;
lsb2 <-$ compMap _ (A2 s_A) lsa2;
A3 s_A (lsb1 ++ (b :: lsb2)).
Variable F : nat -> Rat.

Theorem list_hybrid_close_h :
(forall n c, | (evalDist (LH_Gn n) c) - (evalDist (LH_Gn (S n)) c) | <= F n) ->
forall x n c,
| (evalDist (LH_Gn n) c) - (evalDist (LH_Gn (n + x)) c) | <= sumList (map (plus n) (allNatsLt x)) F.