split; intros; subst.
apply littleendian_inv.
apply inv_littleendian.
Qed.
Module Type GeneralizedCascade.
Parameter K1 : Type. (*finite*)
Parameter I1 : Type.
Parameter K2 : Type. (*finite*)
Parameter H: K1 -> I1 -> K2.
Parameter I2 : Type.
Parameter L : Type.
Parameter S : K2 -> I2 -> L.
Parameter X : K1 -> I1 -> I2 -> L.
Parameter X_char : forall k1 i1 i2, X k1 i1 i2 = S (H k1 i1) i2.
End GeneralizedCascade.
Module SalsaGeneralizedCascade <: GeneralizedCascade.
Definition K1:Type := ThirtyTwoByte.
Definition I1:Type := SixteenByte.
Definition K2:Type := ThirtyTwoByte.
Definition H: K1 -> I1 -> K2 := HSalsa20 10.
Definition I2:Type := SixteenByte.
Definition L:Type := SixtyFourByte.
Definition X (k1:K1) (i1: I1) (i2: I2): L :=
match i1 with (((x, y), z), u) =>
match i2 with (((a, b), c), d) =>
XSalsa20 10 k1 (x, y, z, u, a, b) (c, d)
end end.
Definition S (k: K2) (i: I2) : L :=
match k with (((((((k0, k1), k2), k3), k4), k5), k6), k7) =>
Salsa20K0K1 (((k0, k1), k2), k3) (((k4, k5), k6), k7) i
end.

(* Specifications: *)
Lemma X_char k1 i1 i2: X k1 i1 i2 = S (H k1 i1) i2.
unfold X, S, H.