(*==========================================================  TOPOLOGICAL FMAPS, HMAPS - WITH TAGS AND EMBEDDINGS  PART 6:.  PROPERTIES OF MERGING AND SPLITTING FACES expf / L1  COMPLETE: OK! ============================================================*)
(* Load Jordan1. Load Jordan2. Load Jordan3. Load Jordan4. Load Jordan5. *)
Require Export Jordan5.
(*========================================================== 1. MERGING FACES BY L1 (CASE ~expf m x y0) ===========================================================*)
(* CASE k = one IN cF_L (from Jordan5) : OK *)
(* 1. CASE ~expf m x y0: FACE MERGING *)
(* FIRST, SOME LEMMAS: *)
(* OK: *)
Open Scope nat_scope.
(* i-SUCCS OF x BY cF_L1, FOR i < DEG OF x, ARE INVARIANT: *)
(* OK: *)
(* i-SUCCS OF x BY cF_L1, FOR i < DEG x, DIFFER FROM x *)
(* OK: *)
(* THE dx_SUCC OF x BY cF_L1 IS y_1: *)
(* IT IS DIFFRENT FROM x: *)
(* j-SUCCS OF y BY cF_L1, FOR j < DEGREE OF y, ARE INVARIANT: *)
(* j-SUCCS OF y_1 BY cF_L1, FOR j < DEG OF y0 (OR y_1), ARE INVARIANT:*)
(* THE ARE DIFFERENT FROM x: *)
(* THE ARE DIFFERENT FROM x - OTHER FORM: *)
(* OK: *)
(* THEN, ABOUT THE DEGREES, OK: *)
(* TECHNICAL LEMMA: *)
(* AND (MORE TECHNICAL), OK!!: *)
(* FROM WHERE "THE" GREAT RESULT ABOUT THE DEGREES: *)
(* CHANGER LES NOMS... *)
(* THEN, OK: *)
(* OTHER FORM, w.r.t. y_1: *)
(* THEN, WE HAVE: *)
(* OTHER FORM FOR y0: *)
(* FINALLY, THE OTHER ORBITS ARE INCHANGED: *)
(* OK, BY INDUCTION ON i: *)
(* THEN, THE RESULT: *)
(* COROLLARY: *)
(* VERSION orb, OK: *)
(* TECHNICAL LEMMA: THE OTHER DEGREES ARE INCHANGED: *)
(* AND (VERY USEFUL): *)
(* PRESERVATION OF THE PARTITION, EXCEPT 2 MERGED FACES *)
(* OK: *)
(* FINALLY, THE RESULT ABOUT THE DEGREES: *)

Theorem degree_L1_merge_summary: forall (m:fmap)(x y z:dart),
let y0 := cA m zero y in
let m1 := L m one x y in
inv_hmap m1 -> exd m z ->
~expf m x y0 ->
let dx:= MF.degree m x in
let dy0:= MF.degree m y0 in
MF.degree m1 z =
if expf_dec m x z then dx + dy0
else if expf_dec m y0 z then dx + dy0
else MF.degree m z.