(* Definition of "Planarly formed" hypermap: *)

Fixpoint plf(m:fmap):Prop:=
  match m with 
     V => True
   | I m0 x _ _ => plf m0
   | L m0 zero x y => plf m0 /\ 
        (~eqc m0 x y \/ expf m0 (cA_1 m0 one x) y)
   | L m0 one x y => plf m0 /\ 
        (~eqc m0 x y \/ expf m0 x (cA m0 zero y))
  end.

(* Specifications: *)
Theorem plf_planar:forall (m:fmap), inv_hmap m -> plf m -> planar m.
Theorem plf_Euler_Poincare: forall m:fmap, inv_hmap m -> plf m -> ec m / 2 = nc m.
Lemma expf_planar_rcp_0: forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m zero x y -> planar (L m zero x y) -> expf m (cA_1 m one x) y -> planar m.
Lemma expf_planar_rcp_1: forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m one x y -> planar (L m one x y) -> expf m x (cA m zero y) -> planar m.
Theorem weak_planarity_criterion_0: forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m zero x y -> expf m (cA_1 m one x) y -> (planar m <-> planar (L m zero x y)).
Theorem weak_planarity_criterion_1: forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m one x y -> expf m x (cA m zero y) -> (planar m <-> planar (L m one x y)).
Lemma planarity_criterion_RCP_0: forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m zero x y -> planar m -> planar (L m zero x y) -> (~ eqc m x y \/ expf m (cA_1 m one x) y).
Lemma planarity_criterion_RCP_1: forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m one x y -> planar m -> planar (L m one x y) -> (~ eqc m x y \/ expf m x (cA m zero y)).
Lemma not_eqc_planar_0:forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m zero x y -> planar m -> ~eqc m x y -> planar (L m zero x y).
Lemma not_eqc_planar_1:forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m one x y -> planar m -> ~eqc m x y -> planar (L m one x y).
Theorem planarity_criterion_0: forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m zero x y -> planar m -> (planar (L m zero x y) <-> (~ eqc m x y \/ expf m (cA_1 m one x) y)).
Theorem planarity_criterion_1: forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m one x y -> planar m -> (planar (L m one x y) <-> (~ eqc m x y \/ expf m x (cA m zero y))).
Lemma incr_genus_0:forall(m:fmap)(x y:dart), inv_hmap m -> prec_L m zero x y -> genus m <= genus (L m zero x y).
Lemma incr_genus_1:forall(m:fmap)(x y:dart), inv_hmap m -> prec_L m one x y -> genus m <= genus (L m one x y).
Theorem incr_genus:forall(m:fmap)(k:dim)(x y:dart), inv_hmap m -> prec_L m k x y -> genus m <= genus (L m k x y).
Theorem inversion_planarity:forall(m:fmap)(k:dim)(x y:dart), inv_hmap m -> prec_L m k x y -> planar (L m k x y) -> planar m.
Theorem planarity_crit_0: forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m zero x y -> (planar (L m zero x y) <-> (planar m /\ (~ eqc m x y \/ expf m (cA_1 m one x) y))).
Theorem planarity_crit_1: forall (m:fmap)(x y:dart), inv_hmap m -> prec_L m one x y -> (planar (L m one x y) <-> (planar m /\ (~ eqc m x y \/ expf m x (cA m zero y)))).
Lemma eq_genus_I : forall(m:fmap)(x:dart)(t:tag)(p:point), inv_hmap (I m x t p) -> genus (I m x t p) = genus m.
Theorem planar_plf: forall m:fmap, inv_hmap m -> genus m = 0 -> plf m.
Theorem Euler_Poincare_plf: forall m:fmap, inv_hmap m -> ec m / 2 = nc m -> plf m.
Theorem Euler_Poincare_criterion: forall m:fmap, inv_hmap m -> (plf m <-> ec m / 2 = nc m).