(* We tie it together *)

Fixpoint fg (n : nat) {struct n} : ((K1.knot -> K2.knot) * (K2.knot -> K1.knot)) :=
  match n with
   | 0 => (f_Z, g_Z)
   | S n => match fg n with (fn, gn) => (f_Sn gn, g_Sn fn) end
  end.

(* Specifications: *)
Lemma fg_level_fst : forall n k, level k = level (fst (fg n) k).
Lemma fg_level_snd : forall n k, level k = level (snd (fg n) k).
Lemma fg_id : forall n k, level k <= n -> (fst (fg n) oo snd (fg n)) k = k.
Lemma gf_id : forall n k, level k <= n -> (snd (fg n) oo fst (fg n)) k = k.
Lemma fg_fst_unsquash: forall n k, level k <= n -> forall U1, U1 = K1.unsquash k -> K2.unsquash (fst (fg n) k) = (fst U1, f_F' (snd (fg n)) (snd U1)).
Lemma fg_fg_eq: forall n k2, level k2 < n -> snd (fg (level k2)) k2 = snd (fg n) k2.