Definition f_F' : TF.F K1.predicate -> TF.F K2.predicate :=
fmap F f_pred'.
Definition g_F' : TF.F K2.predicate -> TF.F K1.predicate :=
fmap F g_pred'.
End Common.
Section Z.
(* The base case.  To keep things simple, we will put definitions first. *)
Definition fZ_pred (p2 : K2.predicate) : K1.predicate :=
fun k1 => T_bot.
Definition gZ_pred (p1 : K1.predicate) : K2.predicate :=
fun k2 => T_bot.
Definition fF_Z : TF.F K1.predicate -> TF.F K2.predicate :=
fmap F gZ_pred.
Definition gF_Z : TF.F K2.predicate -> TF.F K1.predicate :=
fmap F fZ_pred.
Definition f_Z (k1 : K1.knot) : K2.knot :=
match K1.unsquash k1 with
(n, F_p1) => K2.squash (n, fF_Z F_p1)
end.
Definition g_Z (k2 : K2.knot) : K1.knot :=
match K2.unsquash k2 with
(n, F_p2) => K1.squash (n, gF_Z F_p2)
end.

(* Specifications: *)
(* Now the lemmas *)
Lemma predZ_iso1: fZ_pred oo K2.approx 0 oo gZ_pred = K1.approx 0.
Lemma predZ_iso2: gZ_pred oo K1.approx 0 oo fZ_pred = K2.approx 0.
Lemma iso1_Z : forall k, level k <= 0 -> (g_Z oo f_Z) k = k.
Lemma iso2_Z : forall k, level k <= 0 -> (f_Z oo g_Z) k = k.
(* We must also prove that f_Sn and g_Sn preserve the level property. *)
Lemma f_level_Z: forall k, level k = level (f_Z k).
Lemma g_level_Z: forall k, level k = level (g_Z k).
(* Finally, we must show that fZ preserves unsquashing. *)
Lemma fZ_unsquash : forall k1,
level k1 <= 0 ->
forall U1,
U1 = K1.unsquash k1 ->
K2.unsquash (f_Z k1) = (fst U1, fF_Z (snd U1)).