(*==========================================================
============================================================

	    TOPOLOGICAL FMAPS, QHMAPS, HMAPS -

      PROOFS OF THE GENUS THEOREM AND THE EULER RELATION 

   PART 1: BASES, FMAPS, QHMAPS, HMAPS, CLOSURES OF A, A_1

	(J.-F. Dufourd, June 2006 - FOR PUBLICATION
              completed in October 2007)

============================================================
==========================================================*)

(* coqtop -opt *)

Global Set Asymmetric Patterns.

Require Import Arith.
Require Import EqNat.

(*========================================================
                      DIMENSIONS
 ========================================================*)

(* Dimensions: *)
Inductive dim:Set := di0 : dim | di1 : dim.

(* Decidability of dim equality: *)
Lemma eq_dim_dec :
 forall i k : dim, {i=k}+{~i=k}.
Proof.
(* Goal: forall i k : dim, sumbool (@eq dim i k) (not (@eq dim i k)) *)
double induction i k.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
 right. discriminate.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
 right. discriminate.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
Defined.

(*========================================================
            DARTS AS NATURALS
========================================================*)

(* For simplicity, dart is nat, 
but it could be a deferred type: *)

Definition dart := nat.

(* Decidability of dart equality: *)

Definition eq_dart_dec := eq_nat_dec.

(* Nil dart: *)

Definition nil := 0%nat.

(*========================================================
     FREE MAPS, CONSTRUCTORS, OBSERVERS AND DESTRUCTORS
 ========================================================*)

(* Free maps: *)

Inductive fmap:Set :=
      V : fmap
    | I : fmap->dart->fmap
    | L : fmap->dim->dart->dart->fmap.

(* Map vacuity: *)

Definition empty(m:fmap): Prop:=
 match m with
       V => True
    |  _ => False
 end.

(* Map vacuity is decidable: *)

Lemma empty_dec: forall (m:fmap),
  {empty m}+{~empty m}.
Proof.
(* Goal: forall m : fmap, sumbool (empty m) (not (empty m)) *)
intro m.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
 right.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: False *)
(* Goal: forall x : dart, sumbool (exd (I m d) x) (not (exd (I m d) x)) *)
(* Goal: forall x : dart, sumbool (exd (L m d d0 d1) x) (not (exd (L m d d0 d1) x)) *)
   inversion H.
Defined.

(* A dart exists in a fmap:
CAUTION: (exd m nil) is possible for m <> V *)

Fixpoint exd (m:fmap)(x:dart){struct m} : Prop:=
 match m with
       V => False
    |  I m0 x0 => x=x0 \/ exd m0 x
    |  L m0 _ _ _  => exd m0 x
 end.

(* exd is decidable: *)

Lemma exd_dec: forall (m:fmap)(x:dart),
  {exd m x}+{~exd m x}.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
 right.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: False *)
(* Goal: forall x : dart, sumbool (exd (I m d) x) (not (exd (I m d) x)) *)
(* Goal: forall x : dart, sumbool (exd (L m d d0 d1) x) (not (exd (L m d d0 d1) x)) *)
   inversion H.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl.
(* Goal: sumbool (exd (L m d d0 d1) x) (not (exd (L m d d0 d1) x)) *)
 elim (IHm x).
(* Goal: forall _ : exd m x, sumbool (exd (L m d d0 d1) x) (not (exd (L m d d0 d1) x)) *)
(* Goal: forall _ : not (exd m x), sumbool (exd (L m d d0 d1) x) (not (exd (L m d d0 d1) x)) *)
  left.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
    simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: forall (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (if eq_dart_dec x d then x else cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
    elim (eq_dart_dec x d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: sumbool (exd (L m d d0 d1) x) (not (exd (L m d d0 d1) x)) *)
 elim (IHm x).
(* Goal: forall _ : exd m x, sumbool (exd (L m d d0 d1) x) (not (exd (L m d d0 d1) x)) *)
(* Goal: forall _ : not (exd m x), sumbool (exd (L m d d0 d1) x) (not (exd (L m d d0 d1) x)) *)
  left.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
    simpl in |- *.
(* Goal: not (@eq dart (A_1 m k x) nil) *)
    assumption.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Defined.

(* A, for alpha, completed by nil when necessary:
designed for qhmaps: *)

Fixpoint A (m:fmap)(k:dim)(x:dart)
               {struct m}:dart:=
 match m with
      V => nil
    | I m0 x0 => A m0 k x
    | L m0 k0 x0 y0 =>
          if (eq_dim_dec k k0)
          then if (eq_dart_dec x x0) then y0
               else A m0 k x
          else A m0 k x
 end.

(* Auxiliary notion: a dart has a k-successor *)

Definition succ(m:fmap)(k:dim)(x:dart):=
  A m k x <> nil.

(* A nil successor is not considered as a real successor! *)

(* Decidability of succ: *)

Lemma succ_dec: forall (m:fmap)(k:dim)(x:dart),
  {succ m k x} + {~succ m k x}.
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
unfold succ in |- *.
(* Goal: @eq dart (A m k x) nil *)
elim (eq_dart_dec (A m k x) nil).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
Defined.

(* Inverse of A. CAUTION: it is not the true inverse
 in an fmap, but it is in a true hmap (or qhmap...)! *)

Fixpoint A_1 (m:fmap)(k:dim)(y:dart)
  {struct m}:dart:=
  match m with
      V => nil
    | I m0 x0 => A_1 m0 k y
    | L m0 k0 x0 y0 =>
          if (eq_dim_dec k k0)
          then if (eq_dart_dec y y0) then x0
              else A_1 m0 k y
          else A_1 m0 k y
  end.

(* Idem: *)

Definition pred(m:fmap)(k:dim)(x:dart):=
  A_1 m k x <> nil.

(* Decidability of pred: *)

Lemma pred_dec: forall (m:fmap)(k:dim)(x:dart),
  {pred m k x} + {~pred m k x}.
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
unfold pred in |- *.
(* Goal: @eq dart (A_1 m k x) nil *)
elim (eq_dart_dec (A_1 m k x) nil).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
Defined.

(* Deleting the last occurrence of a dart: *)

Fixpoint D (m:fmap)(x:dart){struct m}:fmap:=
  match m with
      V => V
    | I m0 x0 =>
         if (eq_dart_dec x x0) then m0
         else (I (D m0 x) x0)
    | L m0 k0 x0 y0 => (L (D m0 x) k0 x0 y0)
 end.

(* Breaking the last k-link starting from a dart: *)

Fixpoint B (m:fmap)(k:dim)(x:dart){struct m}:fmap:=
  match m with
      V => V
    | I m0 x0 => (I (B m0 k x) x0)
    | L m0 k0 x0 y0 =>
         if (eq_dim_dec k k0)
         then if (eq_dart_dec x x0) then m0
              else (L (B m0 k x) k0 x0 y0)
         else (L (B m0 k x) k0 x0 y0)
  end.

(* Breaking the last k-link arriving on a dart: *)

Fixpoint B_1 (m:fmap)(k:dim)(y:dart){struct m}:fmap:=
  match m with
      V => V
    | I m0 x0 =>(I (B_1 m0 k y) x0)
    | L m0 k0 x0 y0 =>
         if (eq_dim_dec k k0)
         then if (eq_dart_dec y y0) then m0
              else (L (B_1 m0 k y) k0 x0 y0)
         else (L (B_1 m0 k y) k0 x0 y0)
  end.

(* Here, the correctness of D, B and B_1 could be proved:
what they do is what they have to do. 
Not used in the following *)

(*=========================================================
     PROPERTIES OF DESTRUCTORS B, B_1 on exd
 ========================================================*)

(* Action of B on exd: *)

Lemma exd_B : forall (m:fmap)(k:dim)(x y:dart),
   exd m y <-> exd (B m k x) y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), iff (exd m y) (exd (B_1 m k x) y) *)
(* Goal: forall _ : not (@eq dim k d), iff (exd m y) (exd (L (B_1 m k x) d d0 d1) y) *)
   generalize (IHm k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
   intros k x y.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), iff (exd m y) (exd (B_1 m k x) y) *)
(* Goal: forall _ : not (@eq dim k d), iff (exd m y) (exd (L (B_1 m k x) d d0 d1) y) *)
   generalize (IHm k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), iff (exd m y) (exd (B_1 m k x) y) *)
(* Goal: forall _ : not (@eq dim k d), iff (exd m y) (exd (L (B_1 m k x) d d0 d1) y) *)
     generalize (IHm k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
Qed.

Lemma exd_B_r : forall (m:fmap)(k:dim)(x y:dart),
   exd m y -> exd (B m k x) y.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : exd (B_1 m k x) y), exd m y *)
intros m k x y.
(* Goal: forall _ : iff (exd (B m k x) y) (exd (B_1 (B m k x) k y) y), exd (B_1 (B m k x) k y) y *)
(* Goal: and (not (succ (B_1 (B m k x) k y) k x)) (not (pred (B_1 (B m k x) k y) k y)) *)
generalize (exd_B m k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
tauto.
Qed.

Lemma exd_B_l : forall (m:fmap)(k:dim)(x y:dart),
   exd (B m k x) y ->  exd m y.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : exd (B_1 m k x) y), exd m y *)
intros m k x y.
(* Goal: forall _ : iff (exd (B m k x) y) (exd (B_1 (B m k x) k y) y), exd (B_1 (B m k x) k y) y *)
(* Goal: and (not (succ (B_1 (B m k x) k y) k x)) (not (pred (B_1 (B m k x) k y) k y)) *)
generalize (exd_B m k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
tauto.
Qed.

(* Action of B_1 on exd: *)

Lemma exd_B_1 : forall (m:fmap)(k:dim)(x y:dart),
   exd m y <-> exd (B_1 m k x) y.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), iff (exd m y) (exd (B_1 m k x) y) *)
(* Goal: forall _ : not (@eq dim k d), iff (exd m y) (exd (L (B_1 m k x) d d0 d1) y) *)
   generalize (IHm k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
   intros k x y.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  elim (eq_dart_dec x d1).
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), iff (exd m y) (exd (B_1 m k x) y) *)
(* Goal: forall _ : not (@eq dim k d), iff (exd m y) (exd (L (B_1 m k x) d d0 d1) y) *)
   generalize (IHm k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), iff (exd m y) (exd (B_1 m k x) y) *)
(* Goal: forall _ : not (@eq dim k d), iff (exd m y) (exd (L (B_1 m k x) d d0 d1) y) *)
     generalize (IHm k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
Qed.

Lemma exd_B_1_r : forall (m:fmap)(k:dim)(x y:dart),
   exd m y -> exd (B_1 m k x) y.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : exd (B_1 m k x) y), exd m y *)
intros m k x y.
(* Goal: forall _ : exd (B_1 m k x) y, exd m y *)
generalize (exd_B_1 m k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
tauto.
Qed.

Lemma exd_B_1_l : forall (m:fmap)(k:dim)(x y:dart),
   exd (B_1 m k x) y ->  exd m y.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : exd (B_1 m k x) y), exd m y *)
intros m k x y.
(* Goal: forall _ : exd (B_1 m k x) y, exd m y *)
generalize (exd_B_1 m k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
tauto.
Qed.

(*==========================================================
       I- AND L-PRECONDITIONS, QUASI-HMAPS
==========================================================*)

(* For a unique insertion of a non nil dart
in a (future) qhmap: *)

Definition prec_I (m:fmap)(x:dart):=
  x <> nil /\ ~ exd m x .

(* For correctness of functional link insertion, maybe incomplete, in a (future) qhmap: *)

Definition prec_Lq (m:fmap)(k:dim)(x y:dart) :=
  exd m x /\ exd m y /\ ~ succ m k x /\ ~ pred m k y.

(* Quasi-map's topological invariant: in 2 parts *)

Fixpoint inv_qhmap(m:fmap){struct m}:Prop:=
  match m with
      V => True
    | I m0 x0 => inv_qhmap m0
         /\ prec_I m0 x0
    | L m0 k0 x0 y0 => inv_qhmap m0
         /\ prec_Lq m0 k0 x0 y0
  end.

(* Definition of the qhmap type: (not used) *)

Definition qhmap:Set := {m:fmap | inv_qhmap m}.

(* Projection of a qhmap to its fmap support: *)

Definition qhmap_to_fmap(q:qhmap):fmap:=
  match q with exist m _=> m end.

(* The projection is declared as a coercion: *)

Coercion qhmap_to_fmap: qhmap >-> fmap.

(*=========================================================
     A LOT OF PROPERTIES NEEDING inv_qhmap ONLY
==========================================================*)

(* nil isn't in a qhmap: *)

Lemma not_exd_nil :
  forall m:fmap, inv_qhmap m -> ~ exd m nil.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   elim H0.
(* Goal: not (@eq dim k j) *)
  intro.
    symmetry  in H1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* and the inverse: *)

Lemma exd_not_nil :
  forall (m:fmap)(x:dart),
   inv_qhmap m -> exd m x -> x <> nil.
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: forall _ : inv_qhmap m, @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
elim (eq_dart_dec x nil).
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: forall _ : @eq dim k k, not (not (@eq dart x nil)) *)
(* Goal: forall (_ : not (@eq nat (A m k x) y)) (_ : @eq dim k k), not (not (@eq dart (A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
   rewrite a in H0.
(* Goal: not (@eq dart x nil) *)
(* Goal: forall _ : not (@eq nat x nil), not (@eq dart x nil) *)
   assert (~ exd m nil).
(* Goal: not (exd m nil) *)
  apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
Qed.

(* Relationship between succ and exd: *)

Lemma succ_exd :
  forall (m:fmap)(k:dim)(x:dart),
   inv_qhmap m -> succ m k x -> exd m x.
Proof.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
unfold succ in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
   intros k x Hinv.
(* Goal: forall (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (if eq_dart_dec x d then x else cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   elim (eq_dart_dec x d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
    right.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H.
(* Goal: forall (k : dim) (x : dart) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
 intros k x.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
    apply H0.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H0.
Qed.

(* Idem with pred and exd: *)

Lemma pred_exd :
  forall (m:fmap)(k:dim)(x:dart),
   inv_qhmap m -> pred m k x -> exd m x.
Proof.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
unfold pred in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
   intros k x Hinv.
(* Goal: forall (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (if eq_dart_dec x d then x else cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   elim (eq_dart_dec x d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
    right.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H.
(* Goal: forall (k : dim) (x : dart) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
 intros k x.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  elim (eq_dart_dec x d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
    apply H0.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H0.
Qed.

(* A non existing dart has no successor: *)

Lemma not_exd_A_nil:
  forall (m:fmap)(k:dim)(x:dart),
   inv_qhmap m -> ~ exd m x -> A m k x = nil.
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: @eq dart (A m k x) nil *)
elim (eq_dart_dec (A m k x) nil).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
 intros.
(* Goal: @eq dart (A m k x) nil *)
   generalize (succ_exd m k x).
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (A m k x) nil *)
   unfold succ in H1.
(* Goal: @eq dart (A_1 m k x) nil *)
   absurd (exd m x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: exd m x *)
  eapply H1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (@eq dart (A_1 m k x) nil) *)
   assumption.
Qed.

(* Idem: *)

Lemma not_exd_A_1_nil:
  forall (m:fmap)(k:dim)(x:dart),
   inv_qhmap m -> ~ exd m x -> A_1 m k x = nil.
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: @eq dart (A_1 m k x) nil *)
elim (eq_dart_dec (A_1 m k x) nil).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
 intros.
(* Goal: @eq dart (A_1 m k x) nil *)
   generalize (pred_exd m k x).
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (A_1 m k x) nil *)
   unfold pred in H1.
(* Goal: @eq dart (A_1 m k x) nil *)
   absurd (exd m x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: exd m x *)
  eapply H1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (@eq dart (A_1 m k x) nil) *)
   assumption.
Qed.

(* Note that, in a qmap m, it is not True that:
exd m x -> A m k x <> nil,
exd m x -> A_1 m k x <> nil *)

(* Note also: *)

Lemma A_nil: forall (m:fmap)(k:dim),
   inv_qhmap m -> A m k nil = nil.
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: @eq dart (A m di1 x) nil *)
(* Goal: not (not (@eq dart (A m di1 x) nil)) *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
apply not_exd_A_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: not (exd m nil) *)
 apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

Lemma A_1_nil: forall (m:fmap)(k:dim),
   inv_qhmap m -> A_1 m k nil = nil.
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: @eq dart (A_1 m di1 x) nil *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
apply not_exd_A_1_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: not (exd m nil) *)
 apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* A true successor always exists: *)

Lemma succ_exd_A :
  forall (m:fmap)(k:dim)(x:dart),
   inv_qhmap m -> succ m k x -> exd m (A m k x).
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold succ in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold succ in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : not (@eq dart (A_1 (I m d) k x) nil)), or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
   intros k x Hinv Hx.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
   simpl in Hx.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
   generalize Hx.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
   clear Hx.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
   right.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
  unfold succ in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
 unfold succ in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   intros k x.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
    unfold succ in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold succ in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
Qed.

(* Idem with: *)

Lemma pred_exd_A_1 :
  forall (m:fmap)(k:dim)(x:dart),
   inv_qhmap m -> pred m k x -> exd m (A_1 m k x).
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold pred in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold pred in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : not (@eq dart (A_1 (I m d) k x) nil)), or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
   intros k x Hinv Hx.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
   simpl in Hx.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
   generalize Hx.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
   clear Hx.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
   right.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
  unfold pred in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
 unfold pred in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   intros k x.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  elim (eq_dart_dec x d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
    unfold pred in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold pred in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
Qed.

(* Inverses: *)

Lemma exd_A_exd :
  forall (m : fmap) (k : dim) (x : dart),
   inv_qhmap m -> exd m (A m k x) -> exd m x.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
   unfold exd in |- *.
   fold exd in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   elim H0.
  clear H0.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
    rewrite <- H0 in H.
(* Goal: succ m k x *)
(* Goal: forall (_ : iff (exd m (A m k x)) (exd (B m k x) (A m k x))) (_ : iff (exd (B m k x) (A m k x)) (exd (B_1 (B m k x) k y) (A m k x))), exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
    decompose [and] H.
    elim H4.
(* Goal: exd m (A m j x) *)
(* Goal: @eq dart (A m j x) (A m j x) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    apply succ_exd_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold succ in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
    right.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H1.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold succ in |- *; unfold pred in |- *.
   intros k x Invm.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
    apply H.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H.
Qed.

(* Idem: *)

Lemma exd_A_1_exd :
  forall (m : fmap) (k : dim) (x : dart),
   inv_qhmap m -> exd m (A_1 m k x) -> exd m x.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
   unfold exd in |- *.
   fold exd in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   elim H0.
  clear H0.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
    rewrite <- H0 in H.
(* Goal: succ m k x *)
(* Goal: forall (_ : iff (exd m (A m k x)) (exd (B m k x) (A m k x))) (_ : iff (exd (B m k x) (A m k x)) (exd (B_1 (B m k x) k y) (A m k x))), exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
    decompose [and] H.
    elim H4.
(* Goal: exd m (A_1 m k y) *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    apply pred_exd_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold pred in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
    right.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H1.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold succ in |- *; unfold pred in |- *.
   intros k x Invm.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  elim (eq_dart_dec x d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
    apply H.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H.
Qed.

(*=========================================================
       A AND A_1 ARE INVERSE INJECTIONS IN A qhmap:
==========================================================*)

(* In a qmap, A et A_1 are inverses of each other: *)

Lemma A_A_1 :
  forall (m:fmap)(k:dim)(x y:dart),
   inv_qhmap m -> exd m x -> exd m y
     -> y = A m k x -> x = A_1 m k y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold succ in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall (k : dim) (x y : dart) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
   intros k x y Hinv Hx Hy.
(* Goal: forall (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (if eq_dart_dec x d then x else cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   elim (eq_dart_dec x d).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
    clear Hx.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
    elim (eq_dart_dec y d).
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (A m k y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq nat x d0) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A m k y) (A m k y) *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (if eq_dart_dec y d0 then d1 else A m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (A m k y) *)
     rewrite a in H.
(* Goal: @eq dart (A m k y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq nat x d0) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A m k y) (A m k y) *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (if eq_dart_dec y d0 then d1 else A m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (A m k y) *)
     rewrite a0 in H.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A m k x) y), @eq dart (cA m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A (L m d d0 d1) k x) y), @eq dart (cA (L m d d0 d1) k x) y *)
     assert (A m k d = nil).
(* Goal: @eq dart (A m di1 x) nil *)
(* Goal: not (not (@eq dart (A m di1 x) nil)) *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
    apply not_exd_A_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall _ : exd m y, @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
    rewrite H0 in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (A m k y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq nat x d0) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A m k y) (A m k y) *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (if eq_dart_dec y d0 then d1 else A m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (A m k y) *)
     rewrite a in H.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall _ : exd m y, @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
     assert (exd m d).
(* Goal: exd m d *)
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
    apply (succ_exd m k d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
     unfold succ in |- *.
(* Goal: not (@eq dart (A m k x) nil) *)
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall _ : exd m y, @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
       rewrite <- H.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
       elim Hy.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : exd m y, not (@eq dart y nil) *)
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
      apply exd_not_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
    elim Hy.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall _ : exd m y, @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
     rewrite H0 in H.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall _ : exd m y, @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
     assert (exd m d).
(* Goal: @eq dart x x' *)
    rewrite H.
(* Goal: exd m (A m j x) *)
(* Goal: @eq dart (A m j x) (A m j x) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      apply succ_exd_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
     unfold succ in |- *.
(* Goal: not (@eq dart (A m k x) nil) *)
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall _ : exd m y, @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
       rewrite <- H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
     elim Hx.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
      apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
   intros k x y.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
   elim (eq_dart_dec y d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
   elim (eq_dart_dec y d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: False *)
      assert (x = A_1 m k y).
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: @eq dart x d0 *)
(* Goal: forall (_ : not (@eq nat y d1)) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
     rewrite a in H3.
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
       unfold pred in H.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
       intuition.
(* Goal: @eq dart x d0 *)
(* Goal: forall (_ : not (@eq nat y d1)) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
       rewrite a0 in H3.
(* Goal: @eq dart x d0 *)
(* Goal: forall (_ : not (@eq nat y d1)) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
       elim H8.
(* Goal: @eq dart (A m k y0) (A m k (A_1 m k y0)) *)
(* Goal: False *)
(* Goal: inv_qhmap m *)
(* Goal: not (@eq dart y0 (A m k x0)) *)
       rewrite <- H3.
(* Goal: not (@eq dart x nil) *)
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
       apply (exd_not_nil m x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
      apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* Idem with A_1: *)

Lemma A_1_A :
  forall (m:fmap)(k:dim)(x y:dart),
   inv_qhmap m -> exd m x -> exd m y
     -> x = A_1 m k y -> y = A m k x.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
  unfold pred in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
  unfold prec_I in |- *.
(* Goal: forall (k : dim) (x y : dart) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
  intros k x y Hinv Hx Hy.
(* Goal: forall (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (if eq_dart_dec x d then x else cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
  elim (eq_dart_dec x d).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
 intros.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
   clear Hx.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
   elim (eq_dart_dec y d).
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: @eq dart (A m k y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq nat x d0) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A m k y) (A m k y) *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (if eq_dart_dec y d0 then d1 else A m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (A m k y) *)
    rewrite a in H.
(* Goal: @eq dart (A m k y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq nat x d0) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A m k y) (A m k y) *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (if eq_dart_dec y d0 then d1 else A m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (A m k y) *)
    rewrite a0 in H.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
    assert (A_1 m k d = nil).
(* Goal: @eq dart (A_1 m di1 x) nil *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
   apply not_exd_A_1_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall _ : exd m y, @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
  rewrite H0 in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (@eq dim k j) *)
 intro.
   assert (exd m y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
 clear Hy.
   elim (pred_dec m k y).
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
  unfold pred in |- *.
(* Goal: not (@eq dim k j) *)
    intro.
    assert (exd m x).
(* Goal: @eq dart x x' *)
   rewrite H in |- *.
(* Goal: exd m (A_1 m k y) *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      eapply pred_exd_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold pred in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
 unfold pred in |- *.
(* Goal: not (@eq dart (A m k x) nil) *)
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall _ : exd m y, @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
   rewrite <- H in |- *.
(* Goal: not (@eq dim k j) *)
   intro.
    absurd (x <> nil).
(* Goal: not (@eq dart (A_1 m k x) nil) *)
  assumption.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 rewrite a in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
  assert (exd m x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
clear Hx.
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
  elim Hy.
(* Goal: not (@eq dim k j) *)
 intro.
   clear Hy.
(* Goal: False *)
(* Goal: forall _ : not (@eq nat z d1), not (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) nil) *)
(* Goal: forall _ : not (@eq dim k d), and (not (@eq dart (cA m k z) nil)) (not (@eq dart (cA_1 m k z) nil)) *)
   rewrite H1 in H.
   rewrite not_exd_A_1_nil in H.
  rewrite H in H0.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
     absurd (exd m nil).
(* Goal: not (exd m nil) *)
   apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (@eq dim k j) *)
intro.
  apply (IHm k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
  unfold prec_Lq in |- *.
(* Goal: forall (k : dim) (x y : dart) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
  intros k x y Hinv Hx Hy.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
  elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
 elim (eq_dart_dec y d1).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
 elim (eq_dart_dec x d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A m k x)), @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    assert (y = A m k x).
   apply (IHm k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : @eq dim k k, not (not (@eq dart x nil)) *)
(* Goal: forall (_ : not (@eq nat (A m k x) y)) (_ : @eq dim k k), not (not (@eq dart (A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
  rewrite a in H0.
    rewrite H0 in Hy.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
     intuition.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
    unfold succ in H4.
    rewrite <- a0 in H4.
    elim H4.
(* Goal: forall _ : exd m y, not (@eq dart y nil) *)
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
     eapply exd_not_nil.
     apply H1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   apply (IHm k x y);  tauto.
(* Goal: not (@eq dim k j) *)
  intro.
  apply (IHm k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
Qed.

(* Partial injection on dart, Df giving the domain of f: *)

Definition inj_dart(Df:dart->Prop)(f:dart->dart):Prop:=
    forall x x':dart,
     (Df x)->(Df x')->(f x)=(f x')->x=x'.

(* (A m k) is an injection on (succ m k): *)

Lemma inj_A_qhmap:
   forall (m:fmap)(k:dim), inv_qhmap m ->
      inj_dart (succ m k) (A m k).
Proof.
(* Goal: forall (m : fmap) (k : dim) (_ : inv_qhmap m), inj_dart (exd m) (cA_1 m k) *)
intros m k Hinv.
(* Goal: forall _ : forall _ : inv_qhmap m, inj_dart (pred m k) (A_1 m k), @eq dart x x' *)
unfold inj_dart in |- *.
(* Goal: forall (x x' : dart) (_ : exd m x) (_ : exd m x') (_ : @eq dart (cA_1 m k x) (cA_1 m k x')), @eq dart x x' *)
intros x x' Hx Hx' Heg.
assert (x = A_1 m k (A m k x)).
 apply (A_A_1 m k x (A m k x)).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
  eapply succ_exd.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply Hx.
(* Goal: exd m (A m j x) *)
(* Goal: @eq dart (A m j x) (A m j x) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  apply succ_exd_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
 assert (x' = A_1 m k (A m k x')).
  apply (A_A_1 m k x' (A m k x')).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   eapply succ_exd.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
    apply Hx'.
(* Goal: exd m (A m j x) *)
(* Goal: @eq dart (A m j x) (A m j x) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   apply succ_exd_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: @eq dart x x' *)
  rewrite Heg in H.
(* Goal: @eq dart x x' *)
    rewrite H.
    rewrite <- Heg.
    rewrite H0.
    rewrite Heg.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Qed.

(* Idem, for pred and A_1*)

(* Idem: (A_1 m k) is an injection on (pred m k): *)

Lemma inj_A_1_qhmap :
   forall (m:fmap)(k:dim), inv_qhmap m ->
      inj_dart (pred m k) (A_1 m k).
Proof.
(* Goal: forall (m : fmap) (k : dim) (_ : inv_qhmap m), inj_dart (exd m) (cA_1 m k) *)
intros m k Hinv.
(* Goal: forall _ : forall _ : inv_qhmap m, inj_dart (pred m k) (A_1 m k), @eq dart x x' *)
unfold inj_dart in |- *.
(* Goal: forall (x x' : dart) (_ : exd m x) (_ : exd m x') (_ : @eq dart (cA_1 m k x) (cA_1 m k x')), @eq dart x x' *)
intros x x' Hx Hx' Heg.
(* Goal: @eq dart x x' *)
assert (x = A m k (A_1 m k x)).
(* Goal: @eq dart x (A m k (A_1 m k x)) *)
(* Goal: @eq dart x x' *)
 apply (A_1_A m k (A_1 m k x) x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: exd m (A_1 m k y) *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 apply pred_exd_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: exd m x' *)
(* Goal: @eq dart (A_1 m k x') (A_1 m k x') *)
(* Goal: @eq dart x x' *)
 apply pred_exd with k.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: @eq dart x x' *)
rewrite Heg in H.
(* Goal: @eq dart x x' *)
 assert (x' = A m k (A_1 m k x')).
(* Goal: @eq dart x' (A m k (A_1 m k x')) *)
(* Goal: @eq dart x x' *)
 apply (A_1_A m k (A_1 m k x') x').
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: exd m (A_1 m k y) *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 apply pred_exd_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: exd m x' *)
(* Goal: @eq dart (A_1 m k x') (A_1 m k x') *)
(* Goal: @eq dart x x' *)
 apply pred_exd with k.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
rewrite <- H0 in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(*==========================================================
           CLOSURES of A AND A_1 IN qhmap
==========================================================*)

(* Closures of A and A_1, together designed for qhmaps,
mutually recursive: *)

Fixpoint cA
   (m:fmap)(k:dim)(x:dart){struct m}:dart:=
 match m with
     V => nil
  |  I m0 x0 =>
        if eq_dart_dec x x0 then x
	else cA m0 k x
  |  L m0 k0 x0 y0 =>
      if (eq_dim_dec k k0)
      then
         if (eq_dart_dec x x0) then y0
	 else
	   if (eq_dart_dec x (cA_1 m0 k y0))
	   then cA m0 k x0
	   else cA m0 k x
      else cA m0 k x
 end
with cA_1
   (m:fmap)(k:dim)(x:dart){struct m}:dart:=
 match m with
     V => nil
  |  I m0 x0 =>
        if eq_dart_dec x x0 then x
	else cA_1 m0 k x
  |  L m0 k0 x0 y0 =>
      if (eq_dim_dec k k0)
      then
         if (eq_dart_dec x y0) then x0
	 else
	   if (eq_dart_dec x (cA m0 k x0))
	   then cA_1 m0 k y0
	   else cA_1 m0 k x
      else cA_1 m0 k x
 end.

(* Notations ?
Notation "A~" := cA.

Notation "A_1~" := cA_1.

Notation "A~" := cA.

Notation "A_1~" := cA_1.
*)

(* In fact, a qhmap m equipped with (cA m di0) and
(cA m di1) is a hmap: cf. below. *)

(* Each dart of an fmap has a succ and a pred in the closure: *)

Lemma succ_pred_clos :
   forall (m:fmap)(k:dim)(z:dart),
     inv_qhmap m -> exd m z ->
       (cA m k z <> nil /\ cA_1 m k z <> nil).
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: and (not (@eq dart (if eq_dart_dec z d then z else cA m k z) nil)) (not (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) nil)) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z), and (not (@eq dart (cA (L m d d0 d1) k z) nil)) (not (@eq dart (cA_1 (L m d d0 d1) k z) nil)) *)
   elim (eq_dart_dec z).
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
  unfold prec_Lq in H.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: and (not (@eq dart z nil)) (not (@eq dart z nil)) *)
(* Goal: forall _ : not (@eq nat z d), and (not (@eq dart (cA m k z) nil)) (not (@eq dart (cA_1 m k z) nil)) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z), and (not (@eq dart (cA (L m d d0 d1) k z) nil)) (not (@eq dart (cA_1 (L m d d0 d1) k z) nil)) *)
    simpl in H.
(* Goal: not (exd (B_1 m k x) d) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)), inv_qhmap (B_1 (L m d d0 d1) k x) *)
    unfold prec_I in H.
(* Goal: @eq fmap m (L m d d0 d1) *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
    rewrite <- a in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: not (exd (B_1 m k x) d) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)), inv_qhmap (B_1 (L m d d0 d1) k x) *)
    unfold prec_I in H.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (if eq_dart_dec z d0 then d1 else A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d0 then d1 else if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
  elim (eq_dart_dec z d0).
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
   elim (eq_dart_dec z d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
      split.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: False *)
(* Goal: forall _ : not (@eq nat z d1), not (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) nil) *)
(* Goal: forall _ : not (@eq dim k d), and (not (@eq dart (cA m k z) nil)) (not (@eq dart (cA_1 m k z) nil)) *)
       rewrite H1 in H.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
       absurd (exd m nil).
(* Goal: not (exd m nil) *)
      apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: False *)
(* Goal: forall _ : not (@eq nat z d1), not (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) nil) *)
(* Goal: forall _ : not (@eq dim k d), and (not (@eq dart (cA m k z) nil)) (not (@eq dart (cA_1 m k z) nil)) *)
       rewrite H1 in H.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
       absurd (exd m nil).
(* Goal: not (exd m nil) *)
      apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
      split.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: False *)
(* Goal: forall _ : not (@eq nat z d1), not (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) nil) *)
(* Goal: forall _ : not (@eq dim k d), and (not (@eq dart (cA m k z) nil)) (not (@eq dart (cA_1 m k z) nil)) *)
       rewrite H1 in H.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
       absurd (exd m nil).
(* Goal: not (exd m nil) *)
      apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: not (@eq dart (if eq_dart_dec d0 (cA m k d0) then cA_1 m k d1 else cA_1 m k d0) nil) *)
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d), and (not (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) nil)) (not (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) nil)) *)
(* Goal: forall _ : not (@eq dim k d), and (not (@eq dart (cA m k z) nil)) (not (@eq dart (cA_1 m k z) nil)) *)
       elim (eq_dart_dec d0 (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
        generalize (IHm k d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: not (@eq dim k j) *)
      intro.
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall _ : not (@eq nat (cA m k z) (cA m k d0)), @eq dart (cA_1 m k (cA m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA_1 m k (cA m k z)) z *)
        generalize (IHm k d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
   elim (eq_dart_dec z (cA_1 m k d1)).
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
    split.
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall _ : not (@eq nat (cA m k z) (cA m k d0)), @eq dart (cA_1 m k (cA m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA_1 m k (cA m k z)) z *)
     generalize (IHm k d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
     elim (eq_dart_dec z d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: not (@eq dim k j) *)
        intro.
(* Goal: False *)
(* Goal: forall _ : not (@eq nat z d1), not (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) nil) *)
(* Goal: forall _ : not (@eq dim k d), and (not (@eq dart (cA m k z) nil)) (not (@eq dart (cA_1 m k z) nil)) *)
        rewrite H1 in H.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
        absurd (exd m nil).
(* Goal: not (exd m nil) *)
       apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
      elim (eq_dart_dec z (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       intros.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
         generalize (IHm k d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       intros.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
         generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
      split.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
     generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
     elim (eq_dart_dec z d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: not (@eq dim k j) *)
        intro.
(* Goal: False *)
(* Goal: forall _ : not (@eq nat z d1), not (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) nil) *)
(* Goal: forall _ : not (@eq dim k d), and (not (@eq dart (cA m k z) nil)) (not (@eq dart (cA_1 m k z) nil)) *)
        rewrite H1 in H.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
        absurd (exd m nil).
(* Goal: not (exd m nil) *)
       apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
      elim (eq_dart_dec z (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       intros.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
         generalize (IHm k d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       intros.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
         generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
    generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Qed.

(* Each dart of a qhmap has a succ and a pred 
for the closure: *)

Lemma exd_cA_cA_1 :
   forall (m:fmap)(k:dim)(z:dart),
     inv_qhmap m -> exd m z ->
       exd m (cA m k z) /\ exd m (cA_1 m k z).
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
   unfold prec_Lq in H.
(* Goal: not (exd (B_1 m k x) d) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)), inv_qhmap (B_1 (L m d d0 d1) k x) *)
   unfold prec_I in H.
(* Goal: forall (_ : and (inv_qhmap m) (prec_I m d)) (_ : or (@eq dart z d) (exd m z)) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d then z else cA m k z) z) (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) z) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   elim (eq_dart_dec z d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
  generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
 intros k z.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (if eq_dart_dec z d0 then d1 else A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d0 then d1 else if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
    elim (eq_dart_dec z d0).
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
     split.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
    elim (eq_dart_dec z d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
     elim (eq_dart_dec z (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
        generalize (IHm k d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
      generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
     elim (eq_dart_dec z (cA_1 m k d1)).
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
    split.
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall _ : not (@eq nat (cA m k z) (cA m k d0)), @eq dart (cA_1 m k (cA m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA_1 m k (cA m k z)) z *)
     generalize (IHm k d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
     elim (eq_dart_dec z d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
      elim (eq_dart_dec z (cA m k d0)).
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
       generalize (IHm k d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
       generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
    split.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     generalize (IHm k z); tauto.
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
     elim (eq_dart_dec z d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
      elim (eq_dart_dec z (cA m k d0)).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       generalize (IHm k d1); tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       generalize (IHm k z); tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  generalize (IHm k z); tauto.
Qed.

(* If the succ for cA is in the qhmap, the initial dart also: *)

Lemma cA_exd :
   forall (m:fmap)(k:dim)(z:dart),
     inv_qhmap m ->  cA m k z <> nil -> exd m z.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   intros k z.
(* Goal: forall (_ : and (inv_qhmap m) (prec_I m d)) (_ : or (@eq dart z d) (exd m z)) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d then z else cA m k z) z) (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) z) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   elim (eq_dart_dec z d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
    right.
    apply (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
 intros k z.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (if eq_dart_dec z d0 then d1 else A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d0 then d1 else if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
  elim (eq_dart_dec z d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
   elim (eq_dart_dec z (cA_1 m k d1)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite a.
      generalize (exd_cA_cA_1 m k d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
      eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
     apply H0.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H0.
Qed.

(* Idem for cA_1: *)

Lemma cA_1_exd :
   forall (m:fmap)(k:dim)(z:dart),
     inv_qhmap m ->  cA_1 m k z <> nil -> exd m z.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   intros k z.
(* Goal: forall (_ : and (inv_qhmap m) (prec_I m d)) (_ : or (@eq dart z d) (exd m z)) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d then z else cA m k z) z) (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) z) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   elim (eq_dart_dec z d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
    right.
    apply (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
 intros k z.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
  elim (eq_dart_dec z d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
   elim (eq_dart_dec z (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite a.
      generalize (exd_cA_cA_1 m k d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
      eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
     apply H0.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H0.
Qed.

(* Inverse for exd: *)

Lemma exd_cA_exd :
   forall (m:fmap)(k:dim)(z:dart),
     inv_qhmap m ->
       exd m (cA m k z) -> exd m z.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   intros k z.
(* Goal: forall (_ : and (inv_qhmap m) (prec_I m d)) (_ : or (@eq dart z d) (exd m z)) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d then z else cA m k z) z) (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) z) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   elim (eq_dart_dec z d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
    right.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
    elim H0.
   clear H0.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
     rewrite <- H0 in H.
     apply (cA_exd m k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
 intros k z.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (if eq_dart_dec z d0 then d1 else A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d0 then d1 else if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
  elim (eq_dart_dec z d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
   elim (eq_dart_dec z (cA_1 m k d1)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite a.
      generalize (exd_cA_cA_1 m k d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
      eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
     apply H0.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H0.
Qed.

(* Idem: *)

Lemma exd_cA_1_exd :
   forall (m:fmap)(k:dim)(z:dart),
     inv_qhmap m ->
       exd m (cA_1 m k z) -> exd m z.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   intros k z.
(* Goal: forall (_ : and (inv_qhmap m) (prec_I m d)) (_ : or (@eq dart z d) (exd m z)) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d then z else cA m k z) z) (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) z) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   elim (eq_dart_dec z d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: or (@eq dart (A_1 m k x) d) (exd m (A_1 m k x)) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : pred (L m d d0 d1) k x), exd (L m d d0 d1) (A_1 (L m d d0 d1) k x) *)
    right.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
    elim H0.
   clear H0.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
     rewrite <- H0 in H.
     apply (cA_1_exd m k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
 intros k z.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
  elim (eq_dart_dec z d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
   elim (eq_dart_dec z (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite a.
      generalize (exd_cA_cA_1 m k d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
      eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
     apply H0.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    eapply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply H0.
Qed.

(* cA and cA_1 are inverses of each other: *)

Lemma cA_1_cA :
   forall (m:fmap)(k:dim)(z:dart),
     inv_qhmap m -> exd m z ->
       cA_1 m k (cA m k z) = z.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   intros k z.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (prec_I m d)) (_ : or (@eq dart z d) (exd m z)) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d then z else cA m k z) z) (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) z) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   elim (eq_dart_dec z d).
(* Goal: forall (_ : and (inv_qhmap m) (prec_I m d)) (_ : or (@eq dart z d) (exd m z)) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d then z else cA m k z) z) (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) z) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
  elim (eq_dart_dec z d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : not (@eq nat z d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart z d) (exd m z)), @eq dart (if eq_dart_dec (cA m k z) d then cA m k z else cA_1 m k (cA m k z)) z *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z), @eq dart (cA_1 (L m d d0 d1) k (cA (L m d d0 d1) k z)) z *)
  elim (eq_dart_dec (cA m k z) d).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq fmap m (L m d d0 d1) *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
     rewrite <- a in H.
(* Goal: @eq dart (cA m k z) z *)
(* Goal: forall (_ : not (@eq nat (cA m k z) d)) (_ : not (@eq nat z d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart z d) (exd m z)), @eq dart (cA_1 m k (cA m k z)) z *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z), @eq dart (cA_1 (L m d d0 d1) k (cA (L m d d0 d1) k z)) z *)
     absurd (exd m (cA m k z)).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: exd m (cA_1 m k z) *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k z) d)) (_ : not (@eq nat z d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart z d) (exd m z)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z), @eq dart (cA (L m d d0 d1) k (cA_1 (L m d d0 d1) k z)) z *)
    generalize (exd_cA_cA_1 m k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
 intros k z.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (if eq_dart_dec z d0 then d1 else A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d0 then d1 else if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
    elim (eq_dart_dec z d0).
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a0.
(* Goal: @eq dart (if eq_dart_dec d1 d1 then d0 else if eq_dart_dec d1 (cA m k d0) then cA_1 m k d1 else cA_1 m k d1) d0 *)
(* Goal: forall _ : not (@eq nat z d0), @eq dart (if eq_dart_dec (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) d1 then d0 else if eq_dart_dec (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) (cA m k d0) then cA_1 m k d1 else cA_1 m k (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA_1 m k (cA m k z)) z *)
     elim (eq_dart_dec d1 d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
   elim (eq_dart_dec z (cA_1 m k d1)).
(* Goal: forall (_ : @eq nat z (cA_1 m k d1)) (_ : not (@eq nat z d0)), @eq dart (if eq_dart_dec (cA m k d0) d1 then d0 else if eq_dart_dec (cA m k d0) (cA m k d0) then cA_1 m k d1 else cA_1 m k (cA m k d0)) z *)
(* Goal: forall (_ : not (@eq nat z (cA_1 m k d1))) (_ : not (@eq nat z d0)), @eq dart (if eq_dart_dec (cA m k z) d1 then d0 else if eq_dart_dec (cA m k z) (cA m k d0) then cA_1 m k d1 else cA_1 m k (cA m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA_1 m k (cA m k z)) z *)
    elim (eq_dart_dec (cA m k d0) d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: @eq dart d1 z *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k d1) d0)) (_ : @eq nat z (cA m k d0)) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k d1) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k d1)) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k z) d0 then d1 else if eq_dart_dec (cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
       rewrite <- a0 in a1.
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall _ : not (@eq nat (cA m k z) (cA m k d0)), @eq dart (cA_1 m k (cA m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA_1 m k (cA m k z)) z *)
       generalize (IHm k d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       intros.
(* Goal: @eq dart d1 z *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k d1) d0)) (_ : @eq nat z (cA m k d0)) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k d1) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k d1)) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k z) d0 then d1 else if eq_dart_dec (cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
       rewrite <- a1 in H1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
     elim (eq_dart_dec (cA m k d0)
        (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        symmetry  in |- *; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : not (@eq nat z (cA_1 m k d1))) (_ : not (@eq nat z d0)), @eq dart (if eq_dart_dec (cA m k z) d1 then d0 else if eq_dart_dec (cA m k z) (cA m k d0) then cA_1 m k d1 else cA_1 m k (cA m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA_1 m k (cA m k z)) z *)
    elim (eq_dart_dec (cA m k z) d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: @eq dart d1 z *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k z) d0)) (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
       rewrite <- a0 in b.
(* Goal: @eq dart d1 z *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k z) d0)) (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
       elim b.
       symmetry  in |- *.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
       apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
       elim (eq_dart_dec (cA m k z)
         (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
        generalize (IHm k z).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
        intros.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
        rewrite a0 in H1.
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall _ : not (@eq nat (cA m k z) (cA m k d0)), @eq dart (cA_1 m k (cA m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA_1 m k (cA m k z)) z *)
        generalize (IHm k d0).
(* Goal: not (@eq dim k j) *)
        intro.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
        rewrite H2 in H1.
       symmetry  in H1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (@eq dim k j) *)
      intro.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
        apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* IDEM: the inverse: *)

Lemma cA_cA_1 :
   forall (m:fmap)(k:dim)(z:dart),
     inv_qhmap m -> exd m z ->
       cA m k (cA_1 m k z) = z.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   intros k z.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (prec_I m d)) (_ : or (@eq dart z d) (exd m z)) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d then z else cA m k z) z) (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) z) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   elim (eq_dart_dec z d).
(* Goal: forall (_ : and (inv_qhmap m) (prec_I m d)) (_ : or (@eq dart z d) (exd m z)) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d then z else cA m k z) z) (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) z) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
  elim (eq_dart_dec z d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : not (@eq nat z d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart z d) (exd m z)), @eq dart (if eq_dart_dec (cA_1 m k z) d then cA_1 m k z else cA m k (cA_1 m k z)) z *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z), @eq dart (cA (L m d d0 d1) k (cA_1 (L m d d0 d1) k z)) z *)
  elim (eq_dart_dec (cA_1 m k z) d).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq fmap m (L m d d0 d1) *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
     rewrite <- a in H.
(* Goal: @eq dart (cA_1 m k z) z *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k z) d)) (_ : not (@eq nat z d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart z d) (exd m z)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z), @eq dart (cA (L m d d0 d1) k (cA_1 (L m d d0 d1) k z)) z *)
     absurd (exd m (cA_1 m k z)).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: exd m (cA_1 m k z) *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k z) d)) (_ : not (@eq nat z d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart z d) (exd m z)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z), @eq dart (cA (L m d d0 d1) k (cA_1 (L m d d0 d1) k z)) z *)
    generalize (exd_cA_cA_1 m k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
 intros k z.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
    elim (eq_dart_dec z d1).
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a0.
(* Goal: @eq dart (if eq_dart_dec d0 d0 then d1 else if eq_dart_dec d0 (cA_1 m k d1) then cA m k d0 else cA m k d0) d1 *)
(* Goal: forall _ : not (@eq nat z d1), @eq dart (if eq_dart_dec (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) d0 then d1 else if eq_dart_dec (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
     elim (eq_dart_dec d0 d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
   elim (eq_dart_dec z (cA m k d0)).
(* Goal: forall (_ : @eq nat z (cA m k d0)) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k d1) d0 then d1 else if eq_dart_dec (cA_1 m k d1) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k d1)) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k z) d0 then d1 else if eq_dart_dec (cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
    elim (eq_dart_dec (cA_1 m k d1) d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: @eq dart d1 z *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k d1) d0)) (_ : @eq nat z (cA m k d0)) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k d1) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k d1)) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k z) d0 then d1 else if eq_dart_dec (cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
       rewrite <- a0 in a1.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
       generalize (IHm k d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       intros.
(* Goal: @eq dart d1 z *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k d1) d0)) (_ : @eq nat z (cA m k d0)) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k d1) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k d1)) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k z) d0 then d1 else if eq_dart_dec (cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
       rewrite <- a1 in H1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
     elim (eq_dart_dec (cA_1 m k d1)
        (cA_1 m k d1)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        symmetry  in |- *; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k z) d0 then d1 else if eq_dart_dec (cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
    elim (eq_dart_dec (cA_1 m k z) d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: @eq dart d1 z *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k z) d0)) (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
       rewrite <- a0 in b.
(* Goal: @eq dart d1 z *)
(* Goal: forall (_ : not (@eq nat (cA_1 m k z) d0)) (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z d1)), @eq dart (if eq_dart_dec (cA_1 m k z) (cA_1 m k d1) then cA m k d0 else cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
       elim b.
       symmetry  in |- *.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
       apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
       elim (eq_dart_dec (cA_1 m k z)
         (cA_1 m k d1)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
        generalize (IHm k z).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
        intros.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
        rewrite a0 in H1.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
        generalize (IHm k d1).
(* Goal: not (@eq dim k j) *)
        intro.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: forall _ : not (@eq nat (cA_1 m k z) (cA_1 m k d1)), @eq dart (cA m k (cA_1 m k z)) z *)
(* Goal: forall _ : not (@eq dim k d), @eq dart (cA m k (cA_1 m k z)) z *)
        rewrite H2 in H1.
       symmetry  in H1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (@eq dim k j) *)
      intro.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
        apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.


(* (cA m k) in an injection on (exd m): *)

Lemma inj_cA:
   forall (m:fmap)(k:dim), inv_qhmap m ->
      inj_dart (exd m) (cA m k).
Proof.
(* Goal: forall (m : fmap) (k : dim) (_ : inv_qhmap m), inj_dart (exd m) (cA_1 m k) *)
intros m k Hinv.
(* Goal: forall _ : forall _ : inv_qhmap m, inj_dart (pred m k) (A_1 m k), @eq dart x x' *)
unfold inj_dart in |- *.
(* Goal: forall (x x' : dart) (_ : exd m x) (_ : exd m x') (_ : @eq dart (cA_1 m k x) (cA_1 m k x')), @eq dart x x' *)
intros x x' Hx Hx' Heg.
(* Goal: @eq dart x x' *)
assert (x = cA_1 m k (cA m k x)).
 symmetry  in |- *.
(* Goal: @eq dart (cA_1 m k (cA m k x')) x' *)
   apply cA_1_cA.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: @eq dart x x' *)
 rewrite Heg in H.
(* Goal: @eq dart x x' *)
   rewrite H.
(* Goal: @eq dart (cA_1 m k (cA m k x')) x' *)
   apply cA_1_cA.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto; tauto.
Qed.

(* Idem: cA_1 is an injection on exd: *)

Lemma inj_cA_1:
   forall (m:fmap)(k:dim), inv_qhmap m ->
      inj_dart (exd m) (cA_1 m k).
Proof.
(* Goal: forall (m : fmap) (k : dim) (_ : inv_qhmap m), inj_dart (exd m) (cA_1 m k) *)
intros m k Hinv.
(* Goal: forall _ : forall _ : inv_qhmap m, inj_dart (pred m k) (A_1 m k), @eq dart x x' *)
unfold inj_dart in |- *.
(* Goal: forall (x x' : dart) (_ : exd m x) (_ : exd m x') (_ : @eq dart (cA_1 m k x) (cA_1 m k x')), @eq dart x x' *)
intros x x' Hx Hx' Heg.
(* Goal: @eq dart x x' *)
assert (x = cA m k (cA_1 m k x)).
 symmetry  in |- *.
(* Goal: @eq dart (cA m k (cA_1 m k x')) x' *)
   apply cA_cA_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: @eq dart x x' *)
 rewrite Heg in H.
(* Goal: @eq dart x x' *)
   rewrite H.
(* Goal: @eq dart (cA m k (cA_1 m k x')) x' *)
   apply cA_cA_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto; tauto.
Qed.

(* Isolated darts are fixpoints for the the closure:*)

Lemma fixpoint_cA_cA_1 :
   forall (m:fmap)(k:dim)(z:dart), inv_qhmap m ->
      exd m z -> ~succ m k z -> ~pred m k z ->
         cA m k z = z /\ cA_1 m k z = z.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
 unfold succ in |- *; unfold pred in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   intros k z.
(* Goal: forall (_ : and (inv_qhmap m) (prec_I m d)) (_ : or (@eq dart z d) (exd m z)) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d then z else cA m k z) z) (@eq dart (if eq_dart_dec z d then z else cA_1 m k z) z) *)
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
   elim (eq_dart_dec z d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   unfold succ in |- *; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   unfold pred in |- *; tauto.
(* Goal: forall (k : dim) (z : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) z) (_ : not (succ (L m d d0 d1) k z)) (_ : not (pred (L m d d0 d1) k z)), and (@eq dart (cA (L m d d0 d1) k z) z) (@eq dart (cA_1 (L m d d0 d1) k z) z) *)
 intros k z.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold succ in |- *; unfold pred in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (if eq_dart_dec z d0 then d1 else A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z d0 then d1 else if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
  elim (eq_dart_dec z d0).
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
   elim (eq_dart_dec z d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (@eq dart d1 z) (@eq dart d0 z) *)
(* Goal: forall (_ : not (@eq nat z d1)) (_ : @eq nat z d0) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart d1 nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart d1 z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
      rewrite <- a0; rewrite <- a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (@eq dart d1 z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
      absurd (d1 <> nil).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: False *)
(* Goal: forall (_ : not (@eq nat z d1)) (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
       rewrite H3 in H.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
       absurd (exd m nil).
(* Goal: not (exd m nil) *)
      apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (if eq_dart_dec z d1 then d0 else A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z d1 then d0 else if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
   elim (eq_dart_dec z d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart d0 z) *)
(* Goal: forall (_ : not (@eq nat z d1)) (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
      absurd (d0 <> nil).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
       unfold prec_Lq in H.
(* Goal: False *)
(* Goal: forall (_ : not (@eq nat z d1)) (_ : not (@eq nat z d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
       rewrite H3 in H.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
       absurd (exd m nil).
(* Goal: not (exd m nil) *)
      apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (@eq dart (if eq_dart_dec z (cA_1 m k d1) then cA m k d0 else cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
      elim (eq_dart_dec z (cA_1 m k d1)).
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
       elim (eq_dart_dec z (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: and (@eq dart (cA m k d0) z) (@eq dart (cA_1 m k d1) z) *)
(* Goal: forall _ : not (@eq nat z (cA m k d0)), and (@eq dart (cA m k d0) z) (@eq dart (cA_1 m k z) z) *)
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
        rewrite <- a0; rewrite <- a1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
        split.
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: @eq dart (cA_1 m k z) z *)
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
       assert (z = d1).
(* Goal: @eq dart z d1 *)
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: @eq dart (cA_1 m k z) z *)
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
        assert (cA_1 m k z = z).
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
         generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
           tauto.
         symmetry  in H3.
(* Goal: @eq dart z d0 *)
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z (cA_1 m k d1))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
           rewrite H3 in a0.
(* Goal: @eq dart z d1 *)
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: @eq dart (cA_1 m k z) z *)
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
           assert (inj_dart (exd m) (cA_1 m k)).
(* Goal: inj_dart (exd m) (cA_1 m k) *)
(* Goal: @eq dart z d1 *)
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: @eq dart (cA_1 m k z) z *)
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
          apply inj_cA_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
            tauto.
(* Goal: @eq dart z d0 *)
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z (cA_1 m k d1))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
          unfold inj_dart in H4.
(* Goal: @eq dart z d1 *)
(* Goal: @eq dart (cA m k d0) z *)
(* Goal: @eq dart (cA_1 m k z) z *)
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
            generalize (H4 z d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
            intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
            tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
       generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall _ : not (@eq nat z (cA_1 m k d1)), and (@eq dart (cA m k z) z) (@eq dart (if eq_dart_dec z (cA m k d0) then cA_1 m k d1 else cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
     elim (eq_dart_dec z (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
        split.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
       generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z (cA_1 m k d1))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
       assert (z = d0).
(* Goal: @eq dart z d0 *)
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z (cA_1 m k d1))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
        assert (cA m k z = z).
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
         generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
           tauto.
         symmetry  in H3.
(* Goal: @eq dart z d0 *)
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z (cA_1 m k d1))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
           rewrite H3 in a0.
(* Goal: @eq dart z d0 *)
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z (cA_1 m k d1))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
           assert (inj_dart (exd m) (cA m k)).
(* Goal: inj_dart (exd m) (cA m k) *)
(* Goal: @eq dart z d0 *)
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z (cA_1 m k d1))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
          apply inj_cA.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
            tauto.
(* Goal: @eq dart z d0 *)
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z (cA_1 m k d1))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
          unfold inj_dart in H4.
(* Goal: @eq dart z d0 *)
(* Goal: @eq dart (cA_1 m k d1) z *)
(* Goal: forall (_ : not (@eq nat z (cA m k d0))) (_ : not (@eq nat z (cA_1 m k d1))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m z) (_ : not (not (@eq dart (A m k z) nil))) (_ : not (not (@eq dart (A_1 m k z) nil))), and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
            generalize (H4 z d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
            intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
            tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
        generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: and (@eq dart (cA m k z) z) (@eq dart (cA_1 m k z) z) *)
    generalize (IHm k z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Qed.

(* Preservation of the existing successors in the closure: *)

Lemma A_cA :
   forall (m:fmap)(k:dim)(x y:dart), inv_qhmap m ->
      exd m x -> exd m y -> A m k x = y ->
         cA m k x = y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   unfold prec_I in |- *.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
   intros k x y.
(* Goal: forall (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (if eq_dart_dec x d then x else cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   elim (eq_dart_dec x d).
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  intuition.
   rewrite H4; rewrite H0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: False *)
   rewrite H4 in H2.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A m k x) y), @eq dart (cA m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A (L m d d0 d1) k x) y), @eq dart (cA (L m d d0 d1) k x) y *)
     assert (A m k d = nil).
(* Goal: @eq dart (A m di1 x) nil *)
(* Goal: not (not (@eq dart (A m di1 x) nil)) *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
    apply not_exd_A_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
    rewrite H1 in H2.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
      rewrite <- H2 in H0.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
      absurd (exd m nil).
(* Goal: not (exd m nil) *)
     apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
   rewrite a; rewrite H0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   rewrite a in H4.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: and (succ (i m x) k x0) (pred (i m x) k x0) *)
    elim H1.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall _ : exd m y, @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
     rewrite H3 in H2.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
     intuition.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall _ : exd m y, @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
    assert (exd m d).
(* Goal: exd m d *)
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall _ : exd m y, @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
     rewrite <- H2 in H.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k (A_1 m k y0)) (A (B_1 (B m k x0) k y0) k y0) *)
(* Goal: forall _ : not (@eq nat y0 (A m k y0)), @eq dart (A (B_1 (B m k x0) k y0) k y0) (A m k y0) *)
       rewrite <- H2.
(* Goal: exd m (A m j x) *)
(* Goal: @eq dart (A m j x) (A m j x) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       apply succ_exd_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      unfold succ in |- *; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall _ : exd m y, @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
    rewrite <- H3 in H2.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
      apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
     elim H0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
      apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
 intros k x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A m k x) y), @eq dart (if eq_dart_dec x (cA_1 m k d1) then cA m k d0 else cA m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A m k x) y), @eq dart (cA m k x) y *)
   elim (eq_dart_dec x (cA_1 m k d1)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: @eq dart (cA m k d0) y *)
(* Goal: forall (_ : not (@eq nat x (cA_1 m k d1))) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A m k x) y), @eq dart (cA m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A m k x) y), @eq dart (cA m k x) y *)
      assert (cA m k x = y).
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: @eq dart (cA m k d0) y *)
(* Goal: forall (_ : not (@eq nat x (cA_1 m k d1))) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A m k x) y), @eq dart (cA m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A m k x) y), @eq dart (cA m k x) y *)
     assert (cA m k x = d1).
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite a.
(* Goal: @eq dart (cA m k (cA_1 m k d1)) d1 *)
(* Goal: @eq dart (cA m k d0) y *)
(* Goal: forall (_ : not (@eq nat x (cA_1 m k d1))) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A m k x) y), @eq dart (cA m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A m k x) y), @eq dart (cA m k x) y *)
        apply (cA_cA_1 m k d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
      rewrite H3 in H4.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
        rewrite <- H4 in H.
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
        unfold pred in H.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
        rewrite <- a0 in H.
(* Goal: False *)
        assert (x = A_1 m k y).
(* Goal: @eq dart x (A_1 m j (A m j x)) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       apply A_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        symmetry  in |- *; tauto.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
       rewrite <- H5 in H.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
         assert (x <> nil).
(* Goal: not (@eq dart x nil) *)
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
        apply (exd_not_nil m x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
      apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* IDEM: Preservation of the existing predecessors: *)

Lemma A_1_cA_1 :
   forall (m:fmap)(k:dim)(x y:dart), inv_qhmap m ->
      exd m x -> exd m y -> A_1 m k x = y ->
         cA_1 m k x = y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
  unfold prec_I in |- *.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
  intros k x y.
(* Goal: forall (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (if eq_dart_dec x d then x else cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
  elim (eq_dart_dec x d).
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  intuition.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
  rewrite H4 in |- *; rewrite H0 in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: False *)
 rewrite H4 in H2.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   assert (A_1 m k d = nil).
(* Goal: @eq dart (A_1 m di1 x) nil *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
  apply not_exd_A_1_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
 rewrite H1 in H2.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   rewrite <- H2 in H0.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
    absurd (exd m nil).
(* Goal: not (exd m nil) *)
  apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: @eq dart x y *)
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
 rewrite a in |- *; rewrite H0 in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: @eq dart x y *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : and (inv_qhmap m) (and (not (@eq dart d nil)) (not (exd m d)))) (_ : or (@eq dart x d) (exd m x)) (_ : or (@eq dart y d) (exd m y)) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
 rewrite a in H4.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: and (succ (i m x) k x0) (pred (i m x) k x0) *)
  elim H1.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
 intros.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall _ : exd m y, @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   rewrite H3 in H2.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
    intuition.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall _ : exd m y, @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
  assert (exd m d).
(* Goal: exd m d *)
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall _ : exd m y, @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
   rewrite <- H2 in H.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k (A_1 m k y0)) (A (B_1 (B m k x0) k y0) k y0) *)
(* Goal: forall _ : not (@eq nat y0 (A m k y0)), @eq dart (A (B_1 (B m k x0) k y0) k y0) (A m k y0) *)
     rewrite <- H2 in |- *.
(* Goal: exd m (A_1 m k y) *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     apply pred_exd_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   unfold pred in |- *;  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall _ : exd m y, @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
 rewrite <- H3 in H2.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (@eq dim k j) *)
intro.
(* Goal: @eq dart (cA_1 m k x) y *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart (A_1 (L m d d0 d1) k x) y), @eq dart (cA_1 (L m d d0 d1) k x) y *)
  elim H0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (@eq dim k j) *)
intro.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
intros k x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
  unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
  elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
 elim (eq_dart_dec x d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (if eq_dart_dec x (cA m k d0) then cA_1 m k d1 else cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
 elim (eq_dart_dec x (cA m k d0)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
    assert (cA_1 m k x = y).
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
  assert (cA_1 m k x = d0).
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   rewrite a in |- *.
(* Goal: @eq dart (cA_1 m k (cA m k d0)) d0 *)
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
     apply (cA_1_cA m k d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
  rewrite H3 in H4.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
    rewrite <- H4 in H.
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
    unfold pred in H.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
    rewrite <- a0 in H.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
    assert (x = A m k y).
(* Goal: @eq dart y (A m k (A_1 m k y)) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   apply A_1_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   symmetry  in |- *;  tauto.
(* Goal: not (not (@eq dart (A m d d0) nil)) *)
(* Goal: not (@eq dim k d) *)
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
  unfold succ in H.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
    rewrite <- H5 in H.
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
    assert (x <> nil).
(* Goal: not (@eq dart x nil) *)
(* Goal: @eq dart (cA_1 m k d1) y *)
(* Goal: forall (_ : not (@eq nat x (cA m k d0))) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))) (_ : exd m x) (_ : exd m y) (_ : @eq dart (A_1 m k x) y), @eq dart (cA_1 m k x) y *)
   apply (exd_not_nil m x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
 intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
Qed.

(*==========================================================
           A, A_1 on B, B_1 for qhmap
==========================================================*)

Lemma A_B : forall (m:fmap)(k:dim)(x:dart),
  inv_qhmap m ->
     A (B m k x) k x = nil.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   intros k x.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
     unfold prec_Lq in H.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a0.
(* Goal: not (not (@eq dart (A m d d0) nil)) *)
(* Goal: not (@eq dim k d) *)
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
     unfold succ in H.
(* Goal: @eq dart (A m d d0) nil *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B m k x) d d0 d1) k x) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B m k x) d d0 d1) k x) nil *)
     elim (eq_nat_dec (A m d d0) nil).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
     elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
    elim (eq_dart_dec x d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
       apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
    elim (eq_dim_dec k d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
Qed.

(* Action_bis of B on A: OK *)

Lemma A_B_bis : forall (m:fmap)(k:dim)(x y:dart),
   y<>x -> A (B m k x) k y = A m k y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
 intros k x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y) (if eq_dart_dec y d0 then d1 else A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (B_1 m k x) j y) (A m j y) *)
   elim (eq_dart_dec y d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: @eq dart (A m k y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq nat x d0) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A m k y) (A m k y) *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (if eq_dart_dec y d0 then d1 else A m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (A m k y) *)
      rewrite a0 in H.
(* Goal: @eq dart (A m k y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq nat x d0) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A m k y) (A m k y) *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (if eq_dart_dec y d0 then d1 else A m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (A m k y) *)
      rewrite a in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
     elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y) (if eq_dart_dec y d0 then d1 else A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (B_1 m k x) j y) (A m j y) *)
    elim (eq_dart_dec y d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
       apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
    elim (eq_dim_dec k d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
Qed.

(* Action_ter of B on A: OK *)

Lemma A_B_ter : forall (m:fmap)(k j:dim)(x y:dart),
   k<>j -> A (B m k x) j y = A m j y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (k j : dim) (x y : dart) (_ : not (@eq dim k j)), @eq dart (A (B_1 (L m d d0 d1) k x) j y) (A (L m d d0 d1) j y) *)
 intros k j x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
   elim (eq_dim_dec j d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y) (if eq_dart_dec y d0 then d1 else A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (B_1 m k x) j y) (A m j y) *)
    elim (eq_dart_dec y d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: @eq dart (A m j y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq dim j d) (_ : @eq nat x d1) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A m j y) (A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : @eq nat x d1) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A m j y) (A m j y) *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A (L (B_1 m k x) d d0 d1) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (L (B_1 m k x) d d0 d1) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
       rewrite a0 in H; rewrite a2 in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
     elim (eq_dim_dec j d).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite a in H; rewrite a0 in H; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    intros; apply IHm; tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
    elim (eq_dim_dec j d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y) (if eq_dart_dec y d0 then d1 else A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (B_1 m k x) j y) (A m j y) *)
   elim (eq_dart_dec y d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    intros; apply IHm; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   intros; apply IHm; tauto.
Qed.

 (* USEFUL LEMMAS *)

(* Deleting a link from an inexisting dart has no effect: *)

Lemma B_not_exd : forall (m:fmap)(k:dim)(x:dart),
  inv_qhmap m -> ~ exd m x -> B m k x = m.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
   rewrite IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (exd (L m d d0 d1) x)), @eq fmap (B (L m d d0 d1) k x) (L m d d0 d1) *)
 unfold B in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (exd (L m d d0 d1) x)), @eq fmap (if eq_dim_dec k d then if eq_dart_dec x d0 then m else L ((fix B (m : fmap) (k0 : dim) (x0 : dart) {struct m} : fmap := match m with | V => V | I m0 x1 => I (B m0 k0 x0) x1 | L m0 k1 x1 y0 => if eq_dim_dec k0 k1 then if eq_dart_dec x0 x1 then m0 else L (B m0 k0 x0) k1 x1 y0 else L (B m0 k0 x0) k1 x1 y0 end) m k x) d d0 d1 else L ((fix B (m : fmap) (k0 : dim) (x0 : dart) {struct m} : fmap := match m with | V => V | I m0 x1 => I (B m0 k0 x0) x1 | L m0 k1 x1 y0 => if eq_dim_dec k0 k1 then if eq_dart_dec x0 x1 then m0 else L (B m0 k0 x0) k1 x1 y0 else L (B m0 k0 x0) k1 x1 y0 end) m k x) d d0 d1) (L m d d0 d1) *)
   fold B in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : inv_qhmap m) (_ : prec_lh m k x y), inv_qhmap (B_1 (B m k x) k y) *)
   unfold inv_qhmap in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : and ((fix inv_qhmap (m : fmap) : Prop := match m with | V => True | I m0 x0 => and (inv_qhmap m0) (prec_I m0 x0) | L m0 k0 x0 y0 => and (inv_qhmap m0) (prec_Lq m0 k0 x0 y0) end) m) (prec_Lq m d d0 d1)) (_ : not (exd (L m d d0 d1) x)), @eq fmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
   fold inv_qhmap in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq fmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
   simpl in H0.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
     unfold prec_Lq in H.
(* Goal: @eq fmap m (L m d d0 d1) *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
     rewrite <- a in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
   rewrite IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
  rewrite IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* Corollary: deleting a link from nil has no effect: *)

Lemma B_nil : forall (m:fmap)(k:dim),
  inv_qhmap m -> B m k nil = m.
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: @eq fmap (B m k nil) m *)
apply B_not_exd.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: not (exd m nil) *)
 apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* IDEM: *)

Lemma B_1_not_exd : forall (m:fmap)(k:dim)(x:dart),
  inv_qhmap m -> ~ exd m x -> B_1 m k x = m.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
   rewrite IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (exd (L m d d0 d1) x)), @eq fmap (B_1 (L m d d0 d1) k x) (L m d d0 d1) *)
 unfold B_1 in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (exd (L m d d0 d1) x)), @eq fmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L ((fix B_1 (m : fmap) (k0 : dim) (y : dart) {struct m} : fmap := match m with | V => V | I m0 x0 => I (B_1 m0 k0 y) x0 | L m0 k1 x0 y0 => if eq_dim_dec k0 k1 then if eq_dart_dec y y0 then m0 else L (B_1 m0 k0 y) k1 x0 y0 else L (B_1 m0 k0 y) k1 x0 y0 end) m k x) d d0 d1 else L ((fix B_1 (m : fmap) (k0 : dim) (y : dart) {struct m} : fmap := match m with | V => V | I m0 x0 => I (B_1 m0 k0 y) x0 | L m0 k1 x0 y0 => if eq_dim_dec k0 k1 then if eq_dart_dec y y0 then m0 else L (B_1 m0 k0 y) k1 x0 y0 else L (B_1 m0 k0 y) k1 x0 y0 end) m k x) d d0 d1) (L m d d0 d1) *)
   fold B_1 in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : inv_qhmap m) (_ : prec_lh m k x y), inv_qhmap (B_1 (B m k x) k y) *)
   unfold inv_qhmap in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : and ((fix inv_qhmap (m : fmap) : Prop := match m with | V => True | I m0 x0 => and (inv_qhmap m0) (prec_I m0 x0) | L m0 k0 x0 y0 => and (inv_qhmap m0) (prec_Lq m0 k0 x0 y0) end) m) (prec_Lq m d d0 d1)) (_ : not (exd (L m d d0 d1) x)), @eq fmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
   fold inv_qhmap in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq fmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
   simpl in H0.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  elim (eq_dart_dec x d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
     unfold prec_Lq in H.
(* Goal: @eq fmap m (L m d d0 d1) *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
     rewrite <- a in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
   rewrite IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq dim k d), @eq fmap (L (B_1 m k x) d d0 d1) (L m d d0 d1) *)
  rewrite IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

Lemma B_1_nil : forall (m:fmap)(k:dim),
  inv_qhmap m -> B_1 m k nil = m.
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: @eq fmap (B_1 m k nil) m *)
apply B_1_not_exd.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: not (exd m nil) *)
 apply not_exd_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* Action of B on A_1: *)

Lemma A_1_B : forall (m:fmap)(k:dim)(x:dart),
  inv_qhmap m ->
     A_1 (B m k x) k (A m k x) = nil.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x : dart) (_ : inv_qhmap m), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
intros m k x.
(* Goal: forall _ : inv_qhmap m, @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
elim (eq_dart_dec x nil).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
 intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   rewrite a.
(* Goal: @eq dart (A_1 (B m k nil) k (A m k nil)) nil *)
(* Goal: forall (_ : not (@eq nat x nil)) (_ : inv_qhmap m), @eq dart (A_1 (B m k x) k (A m k x)) nil *)
   rewrite B_nil.
(* Goal: @eq dart (A m k nil) nil *)
(* Goal: inv_qhmap m *)
(* Goal: inv_qhmap m *)
(* Goal: forall (_ : not (@eq nat x nil)) (_ : inv_qhmap m), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
  rewrite A_nil.
(* Goal: @eq dart (A m k (A_1 m k nil)) nil *)
(* Goal: inv_qhmap m *)
(* Goal: forall (_ : not (@eq nat x nil)) (_ : inv_qhmap m), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
   rewrite A_1_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
   induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
    elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
   elim (eq_dart_dec x d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
      unfold prec_Lq in H.
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
      unfold pred in H.
(* Goal: @eq dart (A_1 m k d1) nil *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (L (B m k x) d d0 d1) k (A m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (L (B m k x) d d0 d1) k (A m k x)) nil *)
      elim (eq_dart_dec (A_1 m d d1) nil).
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
    simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
      elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (if eq_dart_dec (A m k x) d1 then d0 else A_1 (B m k x) k (A m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (B m k x) k (A m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (L (B m k x) d d0 d1) k (A m k x)) nil *)
     elim (eq_dart_dec (A m k x) d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
        unfold prec_Lq in H.
(* Goal: @eq dart d0 nil *)
(* Goal: forall (_ : not (@eq nat (A m k x) d1)) (_ : @eq dim k d) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (B m k x) k (A m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (B m k x) k (A m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (L (B m k x) d d0 d1) k (A m k x)) nil *)
        assert (x = A_1 m k d1).
(* Goal: @eq dart x (A_1 m j (A m j x)) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       apply A_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: exd m x *)
(* Goal: @eq dart (A m k x) y *)
(* Goal: succ m k y *)
        apply (succ_exd m k x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
         unfold succ in |- *.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
           rewrite a.
(* Goal: not (@eq dart d1 nil) *)
(* Goal: exd m d1 *)
(* Goal: @eq dart d1 (A m k x) *)
(* Goal: @eq dart d0 nil *)
(* Goal: forall (_ : not (@eq nat (A m k x) d1)) (_ : @eq dim k d) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (B m k x) k (A m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (B m k x) k (A m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (L (B m k x) d d0 d1) k (A m k x)) nil *)
           apply (exd_not_nil m d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
          tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
          tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        rewrite a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
          tauto.
(* Goal: False *)
(* Goal: not (pred (B m k x) d d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
       rewrite H0 in b.
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
         unfold pred in H.
(* Goal: @eq dart d0 nil *)
(* Goal: forall (_ : not (@eq nat (A m k x) d1)) (_ : @eq dim k d) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (B m k x) k (A m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (B m k x) k (A m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (L (B m k x) d d0 d1) k (A m k x)) nil *)
         rewrite a0 in b.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
        apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
     elim (eq_dim_dec k d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
      apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
Qed.

(* Action_bis of B on A_1: *)

Lemma A_1_B_bis : forall (m:fmap)(k:dim)(x y:dart),
  inv_qhmap m -> y <> A m k x ->
     A_1 (B m k x) k y = A_1 m k y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
 intros k x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
   elim (eq_dart_dec y d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
     elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
    elim (eq_dart_dec y d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
       apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
    elim (eq_dim_dec k d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Qed.

(* Action_ter of B on A_1: IDEM *)

Lemma A_1_B_ter : forall (m:fmap)(k j:dim)(x y:dart),
  k<>j -> A_1 (B m k x) j y = A_1 m j y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (k j : dim) (x y : dart) (_ : not (@eq dim k j)), @eq dart (A (B_1 (L m d d0 d1) k x) j y) (A (L m d d0 d1) j y) *)
 intros k j x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
   elim (eq_dim_dec j d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
    elim (eq_dart_dec y d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: @eq dart (A m j y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq dim j d) (_ : @eq nat x d1) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A m j y) (A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : @eq nat x d1) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A m j y) (A m j y) *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A (L (B_1 m k x) d d0 d1) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (L (B_1 m k x) d d0 d1) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
       rewrite a0 in H; rewrite a2 in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
     elim (eq_dim_dec j d).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite a in H; rewrite a0 in H; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    intros; apply IHm; tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
    elim (eq_dim_dec j d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
   elim (eq_dart_dec y d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    intros; apply IHm; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   intros; apply IHm; tauto.
Qed.

(* SYMMETRICALLY, WE HAVE: *)

(* Action of B_1 on A_1: *)

Lemma A_1_B_1 : forall (m:fmap)(k:dim)(x:dart),
  inv_qhmap m ->
     A_1 (B_1 m k x) k x = nil.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   intros k x.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  elim (eq_dart_dec x d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
     unfold prec_Lq in H.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a0.
(* Goal: not (not (@eq dart (A m d d0) nil)) *)
(* Goal: not (@eq dim k d) *)
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
     unfold succ in H.
(* Goal: @eq dart (A_1 m d d1) nil *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (L (B_1 m k x) d d0 d1) k x) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A_1 (L (B_1 m k x) d d0 d1) k x) nil *)
     elim (eq_nat_dec (A_1 m d d1) nil).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
     elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    elim (eq_dart_dec x d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
       apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
    elim (eq_dim_dec k d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
Qed.

(* Action_bis of B_1 on A_1: *)

Lemma A_1_B_1_bis : forall (m:fmap)(k:dim)(x y:dart),
  inv_qhmap m -> y <> x ->
     A_1 (B_1 m k x) k y = A_1 m k y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
intros k x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
  elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
 elim (eq_dart_dec x d1).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
  elim (eq_dart_dec y d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (A_1 m k y) d0 *)
(* Goal: forall (_ : not (@eq nat y d1)) (_ : @eq nat x d1) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)) (_ : not (@eq dart y x)), @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)) (_ : not (@eq dart y x)), @eq dart (A_1 (L (B_1 m k x) d d0 d1) k y) (if eq_dart_dec y d1 then d0 else A_1 m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)) (_ : not (@eq dart y x)), @eq dart (A_1 (L (B_1 m k x) d d0 d1) k y) (A_1 m k y) *)
     rewrite <- a0 in a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
  elim (eq_dart_dec y d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
  elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
 elim (eq_dart_dec y d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (@eq dim k j) *)
intro.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
Qed.

(* TEST: OK ...
Lemma A_1_B_1_bis_bis :
  forall (m:fmap)(k:dim)(x y:dart),
  y <> x ->
     A_1 (B_1 m k x) k y = A_1 m k y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
 intros k x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  elim (eq_dart_dec x d1).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
   elim (eq_dart_dec y d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: @eq dart (A m k y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq nat x d0) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A m k y) (A m k y) *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (if eq_dart_dec y d0 then d1 else A m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (A m k y) *)
      rewrite a0 in H.
(* Goal: @eq dart (A m k y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq nat x d0) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A m k y) (A m k y) *)
(* Goal: forall (_ : not (@eq nat x d0)) (_ : @eq dim k d) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (if eq_dart_dec y d0 then d1 else A m k y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dart y x)), @eq dart (A (L (B m k x) d d0 d1) k y) (A m k y) *)
      rewrite a in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
     elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
    elim (eq_dart_dec y d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
       apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
    elim (eq_dim_dec k d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
Qed.
*)

(* Action_ter of B_1 on A: *)

Lemma A_1_B_1_ter : forall (m:fmap)(k j:dim)(x y:dart),
  k<>j -> A_1 (B_1 m k x) j y = A_1 m j y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (k j : dim) (x y : dart) (_ : not (@eq dim k j)), @eq dart (A (B_1 (L m d d0 d1) k x) j y) (A (L m d d0 d1) j y) *)
 intros k j x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  elim (eq_dart_dec x d1).
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
   elim (eq_dim_dec j d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
    elim (eq_dart_dec y d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: @eq dart (A m j y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq dim j d) (_ : @eq nat x d1) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A m j y) (A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : @eq nat x d1) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A m j y) (A m j y) *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A (L (B_1 m k x) d d0 d1) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (L (B_1 m k x) d d0 d1) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
       rewrite a0 in H; rewrite a2 in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
     elim (eq_dim_dec j d).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite a in H; rewrite a0 in H; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    intros; apply IHm; tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
    elim (eq_dim_dec j d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d1 then d0 else A_1 (B_1 m k x) j y) (if eq_dart_dec y d1 then d0 else A_1 m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A_1 (B_1 m k x) j y) (A_1 m j y) *)
   elim (eq_dart_dec y d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    intros; apply IHm; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   intros; apply IHm; tauto.
Qed.

(* Action of B_1 on A: *)

Lemma A_B_1 : forall (m:fmap)(k:dim)(x:dart),
  inv_qhmap m ->
     A (B_1 m k x) k (A_1 m k x) = nil.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x : dart) (_ : inv_qhmap m), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
intros m k x.
(* Goal: forall _ : inv_qhmap m, @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
elim (eq_dart_dec x nil).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
 intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   rewrite a in |- *.
(* Goal: @eq dart (A (B_1 m k nil) k (A_1 m k nil)) nil *)
(* Goal: forall (_ : not (@eq nat x nil)) (_ : inv_qhmap m), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
   rewrite B_1_nil in |- *.
(* Goal: @eq dart (A m k (A_1 m k nil)) nil *)
(* Goal: inv_qhmap m *)
(* Goal: forall (_ : not (@eq nat x nil)) (_ : inv_qhmap m), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
  rewrite A_1_nil in |- *.
(* Goal: @eq dart (A m k nil) nil *)
(* Goal: inv_qhmap m *)
(* Goal: inv_qhmap m *)
(* Goal: forall (_ : not (@eq nat x nil)) (_ : inv_qhmap m), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
   rewrite A_nil in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (@eq dim k j) *)
intro.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
  induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
  elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
 elim (eq_dart_dec x d1).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
    unfold prec_Lq in H.
(* Goal: not (not (@eq dart (A m d d0) nil)) *)
(* Goal: not (@eq dim k d) *)
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
    unfold succ in H.
(* Goal: @eq dart (A m k d0) nil *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
    elim (eq_dart_dec (A m d d0) nil).
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   rewrite a0 in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  rewrite a0 in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (if eq_dart_dec (A_1 m k x) d0 then d1 else A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
  elim (eq_dart_dec (A_1 m k x) d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
     unfold prec_Lq in H.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
     assert (x = A m k d0).
(* Goal: @eq dart y (A m k (A_1 m k y)) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    apply A_1_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: exd m x *)
(* Goal: @eq dart d0 (A_1 m k x) *)
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
    apply (pred_exd m k x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
    unfold pred in |- *.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite a in |- *.
(* Goal: not (@eq dart d0 nil) *)
(* Goal: @eq dart d0 (A_1 m k x) *)
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
      apply (exd_not_nil m d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
    symmetry  in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (not (@eq dart (A m d d0) nil)) *)
(* Goal: not (@eq dim k d) *)
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
   unfold succ in H.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
     rewrite a0 in H0.
(* Goal: @eq dart d1 nil *)
(* Goal: forall (_ : not (@eq nat (A_1 m k x) d0)) (_ : @eq dim k d) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (B_1 m k x) k (A_1 m k x)) nil *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), @eq dart (A (L (B_1 m k x) d d0 d1) k (A_1 m k x)) nil *)
     rewrite <- H0 in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
  elim (eq_dim_dec k d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* Action_bis of B_1 on A: *)

Lemma A_B_1_bis : forall (m:fmap)(k:dim)(x y:dart),
  inv_qhmap m -> y <> A_1 m k x ->
     A (B_1 m k x) k y = A m k y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : not (@eq dart y (A_1 (L m d d0 d1) k x))), @eq dart (A (B_1 (L m d d0 d1) k x) k y) (A (L m d d0 d1) k y) *)
 intros k x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  elim (eq_dart_dec x d1).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y) (if eq_dart_dec y d0 then d1 else A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (B_1 m k x) j y) (A m j y) *)
   elim (eq_dart_dec y d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
     elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y) (if eq_dart_dec y d0 then d1 else A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (B_1 m k x) j y) (A m j y) *)
    elim (eq_dart_dec y d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
       apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
    elim (eq_dim_dec k d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
     apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Qed.

(* Action_ter of B_1 on A: *)

Lemma A_B_1_ter : forall (m:fmap)(k j:dim)(x y:dart),
  k<>j -> A (B_1 m k x) j y = A m j y.
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (k j : dim) (x y : dart) (_ : not (@eq dim k j)), @eq dart (A (B_1 (L m d d0 d1) k x) j y) (A (L m d d0 d1) j y) *)
 intros k j x y.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  elim (eq_dart_dec x d1).
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
   elim (eq_dim_dec j d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y) (if eq_dart_dec y d0 then d1 else A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (B_1 m k x) j y) (A m j y) *)
    elim (eq_dart_dec y d0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: @eq dart (A m j y) d1 *)
(* Goal: forall (_ : not (@eq nat y d0)) (_ : @eq dim j d) (_ : @eq nat x d1) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A m j y) (A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : @eq nat x d1) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A m j y) (A m j y) *)
(* Goal: forall (_ : not (@eq nat x d1)) (_ : @eq dim k d) (_ : not (@eq dim k j)), @eq dart (A (L (B_1 m k x) d d0 d1) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (L (B_1 m k x) d d0 d1) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
       rewrite a0 in H; rewrite a2 in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
     elim (eq_dim_dec j d).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite a in H; rewrite a0 in H; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    intros; apply IHm; tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: forall (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y else A (B_1 m k x) j y) (if eq_dim_dec j d then if eq_dart_dec y d0 then d1 else A m j y else A m j y) *)
    elim (eq_dim_dec j d).
(* Goal: forall (_ : @eq dim j d) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (if eq_dart_dec y d0 then d1 else A (B_1 m k x) j y) (if eq_dart_dec y d0 then d1 else A m j y) *)
(* Goal: forall (_ : not (@eq dim j d)) (_ : not (@eq dim k d)) (_ : not (@eq dim k j)), @eq dart (A (B_1 m k x) j y) (A m j y) *)
   elim (eq_dart_dec y d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    intros; apply IHm; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   intros; apply IHm; tauto.
Qed.

(*=======================================================
        PROPERTIES of B and B_1 on inv_qhmap:
  =======================================================*)

(* B preserves inv_qhmap: *)

Lemma inv_qhmap_B : forall (m:fmap)(k:dim)(x:dart),
  inv_qhmap m -> inv_qhmap (B m k x).
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
   split.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
  unfold prec_I in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
    split.
(* Goal: not (exd (B_1 m k x) d) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)), inv_qhmap (B_1 (L m d d0 d1) k x) *)
   unfold prec_I in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (exd (B_1 m k x) d) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)), inv_qhmap (B_1 (L m d d0 d1) k x) *)
   unfold prec_I in H.
(* Goal: not (exd (B m k x) d) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)), inv_qhmap (B (L m d d0 d1) k x) *)
     generalize (exd_B m k x d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   intros k x.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
   elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d0 then m else L (B m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
  elim (eq_dart_dec x d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
     split.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
    unfold prec_Lq in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
      split.
(* Goal: exd (B m k x) d0 *)
(* Goal: and (exd (B m k x) d1) (and (not (succ (B m k x) d d0)) (not (pred (B m k x) d d1))) *)
     generalize (exd_B m k x d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
     split.
(* Goal: exd (B m k x) d1 *)
(* Goal: and (not (succ (B m k x) d d0)) (not (pred (B m k x) d d1)) *)
      generalize (exd_B m k x d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
      split.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       rewrite a.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
         unfold succ in |- *.
(* Goal: @eq dart (A (B m k x0) k xk) (A m k xk) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart xk (A_1 (B m k x0) k y0)) *)
         rewrite A_B_bis.
(* Goal: not (not (@eq dart (A m d d0) nil)) *)
(* Goal: not (@eq dim k d) *)
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
        unfold succ in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
          tauto.
(* Goal: not (@eq dim k j) *)
        intro.
(* Goal: False *)
(* Goal: not (pred (B m k x) d d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
          rewrite H0 in b.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
          tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
       unfold pred in |- *.
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
         unfold pred in H.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         rewrite a.
(* Goal: not (not (@eq dart (A_1 (B m d x) d d1) nil)) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B m k x) d d0 d1) *)
         elim (eq_dart_dec d1 (A m d x)).
(* Goal: not (@eq dim k j) *)
        intro.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
          rewrite a0.
(* Goal: not (not (@eq dart (A_1 (B m k x) k (A m k x)) nil)) *)
(* Goal: inv_qhmap (B m k x) *)
(* Goal: not (@eq dart (A m k x) y) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
          rewrite A_1_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: not (@eq dim k j) *)
        intro.
(* Goal: @eq dart (A_1 (B m j x) j z) (A_1 m j z) *)
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
          rewrite A_1_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
    simpl in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
    split.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
   apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
     split.
(* Goal: exd (B m k x) d0 *)
(* Goal: and (exd (B m k x) d1) (and (not (succ (B m k x) d d0)) (not (pred (B m k x) d d1))) *)
    generalize (exd_B m k x d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
    split.
(* Goal: exd (B m k x) d1 *)
(* Goal: and (not (succ (B m k x) d d0)) (not (pred (B m k x) d d1)) *)
     generalize (exd_B m k x d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
     split.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
      unfold succ in |- *.
(* Goal: @eq dart (A (B m k x) j z) (A m j z) *)
(* Goal: not (@eq dim k j) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        rewrite A_B_ter.
(* Goal: not (not (@eq dart (A m d d0) nil)) *)
(* Goal: not (@eq dim k d) *)
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
       unfold succ in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
      unfold pred in |- *.
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
        unfold pred in H.
(* Goal: @eq dart (A_1 (B m k x) j z) (A_1 m j z) *)
(* Goal: not (@eq dim k j) *)
        rewrite A_1_B_ter.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
Qed.

(* IDEM: B_1 preserves inv_qhmap: *)

Lemma inv_qhmap_B_1 : forall (m:fmap)(k:dim)(x:dart),
  inv_qhmap m -> inv_qhmap (B_1 m k x).
Proof.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
  split.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
 apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
unfold prec_I in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
  split.
(* Goal: not (exd (B_1 m k x) d) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)), inv_qhmap (B_1 (L m d d0 d1) k x) *)
 unfold prec_I in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (exd (B_1 m k x) d) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)), inv_qhmap (B_1 (L m d d0 d1) k x) *)
unfold prec_I in H.
(* Goal: not (exd (B_1 m k x) d) *)
(* Goal: forall (k : dim) (x : dart) (_ : inv_qhmap (L m d d0 d1)), inv_qhmap (B_1 (L m d d0 d1) k x) *)
  generalize (exd_B_1 m k x d).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall (k : dim) (x : dart) (_ : and (inv_qhmap m) (prec_Lq m d d0 d1)), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
  intros k x.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
  unfold prec_Lq in |- *.
(* Goal: forall _ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1))))), inv_qhmap (if eq_dim_dec k d then if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1 else L (B_1 m k x) d d0 d1) *)
  elim (eq_dim_dec k d).
(* Goal: forall (_ : @eq dim k d) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (if eq_dart_dec x d1 then m else L (B_1 m k x) d d0 d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
 elim (eq_dart_dec x d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
   split.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
  apply IHm.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
 unfold prec_Lq in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
   split.
(* Goal: exd (B_1 m k x) d0 *)
(* Goal: and (exd (B_1 m k x) d1) (and (not (succ (B_1 m k x) d d0)) (not (pred (B_1 m k x) d d1))) *)
  generalize (exd_B_1 m k x d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
 split.
(* Goal: exd (B_1 m k x) d1 *)
(* Goal: and (not (succ (B_1 m k x) d d0)) (not (pred (B_1 m k x) d d1)) *)
  generalize (exd_B_1 m k x d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
 split.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  rewrite a in |- *.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
    unfold succ in |- *.
(* Goal: not (not (@eq dart (A m d d0) nil)) *)
(* Goal: not (@eq dim k d) *)
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
    unfold succ in H.
(* Goal: not (not (@eq dart (A (B_1 m d x) d d0) nil)) *)
(* Goal: not (pred (B_1 m k x) d d1) *)
(* Goal: forall (_ : not (@eq dim k d)) (_ : and (inv_qhmap m) (and (exd m d0) (and (exd m d1) (and (not (succ m d d0)) (not (pred m d d1)))))), inv_qhmap (L (B_1 m k x) d d0 d1) *)
    elim (eq_dart_dec d0 (A_1 m d x)).
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a0 in |- *.
(* Goal: not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 (B m k x) k y)) nil)) *)
(* Goal: @eq dart (A_1 (B m k x) k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 m k y)) nil)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
     rewrite A_B_1 in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: @eq dart (A (B_1 (B m k x) k y) k z) (A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    rewrite A_B_1_bis in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
 unfold pred in |- *.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   rewrite a in |- *.
(* Goal: @eq dart (A_1 (B_1 (B m j x) j y) j z) (A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   rewrite A_1_B_1_bis in |- *.
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
  unfold pred in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (@eq dim k j) *)
 intro.
   symmetry  in H0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
  split.
(* Goal: inv_qhmap (B_1 m k x) *)
(* Goal: prec_Lq (B_1 m k x) d d0 d1 *)
 generalize (IHm k x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
unfold prec_Lq in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
  split.
(* Goal: exd (B_1 m k x) d0 *)
(* Goal: and (exd (B_1 m k x) d1) (and (not (succ (B_1 m k x) d d0)) (not (pred (B_1 m k x) d d1))) *)
 generalize (exd_B_1 m k x d0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
(* Goal: exd (B_1 m k x) d1 *)
(* Goal: and (not (succ (B_1 m k x) d d0)) (not (pred (B_1 m k x) d d1)) *)
 generalize (exd_B_1 m k x d1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
unfold succ in |- *.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
  unfold pred in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
  split.
(* Goal: @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 rewrite A_B_1_ter in |- *.
(* Goal: not (not (@eq dart (A m d d0) nil)) *)
(* Goal: not (@eq dim k d) *)
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
  unfold succ in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
unfold pred in H.
(* Goal: @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  rewrite A_1_B_1_ter in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
Qed.

(*========================================================
                      HMAPS
  ========================================================*)

(* HYPOTHESIS: a hmap could be viewed as a qhmap with
the closed version of A. Hier, it is considered as a completely 
sewn qhmap, which is approximately the same... *)

(* Invariant of the hypermaps: inv_qhmap + completeness *)

Definition inv_hmap(m:fmap):Prop :=
   inv_qhmap m
  /\ forall (x:dart)(k:dim), exd m x ->
       succ m k x /\ pred m k x.

(* Definition of the hypermaps: *)

Definition hmap:Set := {m:fmap | inv_hmap m}.

(* Surjection, bijection on the fmap darts: *)

Definition surj_dart(Df:dart->Prop)(f:dart->dart):Prop:=
  forall y:dart, Df y ->
     exists x:dart, Df x /\ f x = y.

Definition bij_dart(Df:dart->Prop)(f:dart->dart):Prop:=       
  inj_dart Df f /\ surj_dart Df f.

(* Fundamental property: A and A_1 are injections on the hypermap supports: *)

Lemma inj_A:
   forall (m:fmap)(k:dim), inv_hmap m ->
      inj_dart (exd m) (A m k).
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: forall _ : forall _ : inv_qhmap m, inj_dart (pred m k) (A_1 m k), @eq dart x x' *)
unfold inj_dart in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0) *)
unfold inv_hmap in H.
(* Goal: @eq dart x x' *)
generalize (inj_A_qhmap m k).
(* Goal: forall _ : forall _ : inv_qhmap m, inj_dart (pred m k) (A_1 m k), @eq dart x x' *)
unfold inj_dart in |- *.
(* Goal: not (@eq dim k j) *)
intro.
(* Goal: @eq dart x x' *)
apply H3.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 intuition.
(* Goal: pred m k x *)
(* Goal: pred m k x' *)
(* Goal: @eq dart (A_1 m k x) (A_1 m k x') *)
   generalize (H5 x k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 intuition.
(* Goal: pred m k x' *)
(* Goal: @eq dart (A_1 m k x) (A_1 m k x') *)
   generalize (H5 x' k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
Qed.

(* IDEM : *)

Lemma inj_A_1:
   forall (m:fmap)(k:dim), inv_hmap m ->
      inj_dart (exd m) (A_1 m k).
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: forall _ : forall _ : inv_qhmap m, inj_dart (pred m k) (A_1 m k), @eq dart x x' *)
unfold inj_dart in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0) *)
unfold inv_hmap in H.
(* Goal: @eq dart x x' *)
generalize (inj_A_1_qhmap m k).
(* Goal: forall _ : forall _ : inv_qhmap m, inj_dart (pred m k) (A_1 m k), @eq dart x x' *)
unfold inj_dart in |- *.
(* Goal: not (@eq dim k j) *)
intro.
(* Goal: @eq dart x x' *)
apply H3.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 intuition.
(* Goal: pred m k x *)
(* Goal: pred m k x' *)
(* Goal: @eq dart (A_1 m k x) (A_1 m k x') *)
   generalize (H5 x k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 intuition.
(* Goal: pred m k x' *)
(* Goal: @eq dart (A_1 m k x) (A_1 m k x') *)
   generalize (H5 x' k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 tauto.
Qed.

(* Fundamental property: A_1 k is a partial surjection in hypermaps: OK *)

(* First, on domain (succ m k): *)

Lemma surj_A_1_hmap:
   forall (m:fmap)(k:dim), inv_hmap m ->
      surj_dart (succ m k) (A_1 m k).
Proof.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold inv_hmap in |- *.
(* Goal: forall _ : forall _ : inv_hmap m, surj_dart (succ m k) (A m k), @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
unfold surj_dart in |- *.
intros m k Hinv y Hy.
split with (A m k y).
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
unfold succ in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
 decompose [and] Hinv.
   clear Hinv.
   unfold succ in H0.
   unfold succ in Hy.
   elim (H0 (A m k y) k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: exd m (A m j x) *)
(* Goal: @eq dart (A m j x) (A m j x) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  apply succ_exd_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold succ in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
 generalize (A_A_1 m k y (A m k y)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
   symmetry  in |- *.
   apply H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
  eapply succ_exd.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply Hy.
(* Goal: exd m (A m j x) *)
(* Goal: @eq dart (A m j x) (A m j x) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  apply succ_exd_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
Qed.

(* Second, on domain (exd m): *)

Lemma surj_A_1:
   forall (m:fmap)(k:dim), inv_hmap m ->
      surj_dart (exd m) (A_1 m k).
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: forall _ : forall _ : inv_hmap m, surj_dart (succ m k) (A m k), @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
unfold surj_dart in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: @ex dart (fun x : dart => and (exd m x) (@eq dart (A_1 m k x) y)) *)
generalize (surj_A_1_hmap m k).
(* Goal: forall _ : forall _ : inv_hmap m, surj_dart (succ m k) (A m k), @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
unfold surj_dart in |- *.
(* Goal: not (@eq dim k j) *)
intro.
(* Goal: @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
elim (H1 H y).
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: forall _ : and (succ m k x) (@eq dart (A m k x) y), @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
(* Goal: succ m k y *)
   split with x.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
   split.
(* Goal: exd m x *)
(* Goal: @eq dart (A m k x) y *)
(* Goal: succ m k y *)
  apply (succ_exd m k x).
(* Goal: forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0) *)
   unfold inv_hmap in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0) *)
 unfold inv_hmap in H.
(* Goal: succ m k x *)
(* Goal: forall (_ : iff (exd m (A m k x)) (exd (B m k x) (A m k x))) (_ : iff (exd (B m k x) (A m k x)) (exd (B_1 (B m k x) k y) (A m k x))), exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
   decompose [and] H.
(* Goal: succ m k y *)
   generalize (H3 y k).
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: succ m k y *)
   generalize (H4 H0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* Fundamental property: A k is a partial surjection in hypermaps: *)

(* First, on domain (succ m k): *)

Lemma surj_A_hmap:
   forall (m:fmap)(k:dim), inv_hmap m ->
      surj_dart (succ m k) (A m k).
Proof.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold inv_hmap in |- *.
(* Goal: forall _ : forall _ : inv_hmap m, surj_dart (succ m k) (A m k), @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
unfold surj_dart in |- *.
intros m k Hinv y Hy.
split with (A_1 m k y).
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
unfold succ in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
 decompose [and] Hinv.
   clear Hinv.
   elim (H0 (A_1 m k y) k).
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
  unfold succ in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: exd m (A_1 m k y) *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  apply pred_exd_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   elim (H0 y k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
    eapply succ_exd.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
     apply Hy.
 generalize (A_1_A m k (A_1 m k y) y).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
   symmetry  in |- *.
   apply H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
  decompose [and] Hinv.
    clear Hinv.
(* Goal: exd m (A_1 m k y) *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    apply pred_exd_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   elim (H1 y k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
    eapply succ_exd.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
     apply Hy.
  eapply succ_exd.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   apply Hy.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
Qed.

(* Second, on domain (exd m): *)

Lemma surj_A:
   forall (m:fmap)(k:dim), inv_hmap m ->
      surj_dart (exd m) (A m k).
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: forall _ : forall _ : inv_hmap m, surj_dart (succ m k) (A m k), @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
unfold surj_dart in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
generalize (surj_A_hmap m k).
(* Goal: forall _ : forall _ : inv_hmap m, surj_dart (succ m k) (A m k), @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
unfold surj_dart in |- *.
(* Goal: not (@eq dim k j) *)
intro.
(* Goal: @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
elim (H1 H y).
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: forall _ : and (succ m k x) (@eq dart (A m k x) y), @ex dart (fun x : dart => and (exd m x) (@eq dart (A m k x) y)) *)
(* Goal: succ m k y *)
   split with x.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
   split.
(* Goal: exd m x *)
(* Goal: @eq dart (A m k x) y *)
(* Goal: succ m k y *)
  apply (succ_exd m k x).
(* Goal: forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0) *)
   unfold inv_hmap in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0) *)
 unfold inv_hmap in H.
(* Goal: succ m k x *)
(* Goal: forall (_ : iff (exd m (A m k x)) (exd (B m k x) (A m k x))) (_ : iff (exd (B m k x) (A m k x)) (exd (B_1 (B m k x) k y) (A m k x))), exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
   decompose [and] H.
(* Goal: succ m k y *)
   generalize (H3 y k).
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: succ m k y *)
   generalize (H4 H0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* Fundamental theorem: (A m k) is a bijection on
hmap support (exd m): *)

Theorem bij_A:
 forall (m:fmap)(k:dim), inv_hmap m ->
      bij_dart (exd m) (A m k).
Proof.
(* Goal: forall (m : fmap) (k : dim) (_ : inv_hmap m), bij_dart (exd m) (A_1 m k) *)
unfold bij_dart in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
(* Goal: inj_dart (exd m) (A m k) *)
(* Goal: surj_dart (exd m) (A m k) *)
 generalize (inj_A m k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: surj_dart (exd m) (A m k) *)
 generalize (surj_A m k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

Theorem bij_A_1:
 forall (m:fmap)(k:dim), inv_hmap m ->
      bij_dart (exd m) (A_1 m k).
Proof.
(* Goal: forall (m : fmap) (k : dim) (_ : inv_hmap m), bij_dart (exd m) (A_1 m k) *)
unfold bij_dart in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
(* Goal: inj_dart (exd m) (A_1 m k) *)
(* Goal: surj_dart (exd m) (A_1 m k) *)
 generalize (inj_A_1 m k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: surj_dart (exd m) (A_1 m k) *)
 generalize (surj_A_1 m k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(*========================================================
    8 "LITTLE" LEMMAS ON qhmaps WHICH ARE USEFUL IN THE
    PROOF OF CLOSURE CORRECTION 
 =========================================================*)

(* A on x0: *)

Lemma A_B_1_B_x0 : forall(m:fmap)(k:dim)(x0 y0:dart),      
inv_qhmap m ->
     A (B_1 (B m k x0) k y0) k x0 = nil.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x0 y0 : dart) (_ : inv_qhmap m), @eq dart (A (B_1 (B m k x0) k y0) k x0) nil *)
intros m k x0 y0.
(* Goal: not (@eq dim k j) *)
intro.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k x0) nil *)
elim (eq_dart_dec x0 (A_1 (B m k x0) k y0)).
(* Goal: not (@eq dim k j) *)
 intro.
   replace (A (B_1 (B m k x0) k y0) k x0) with
    (A (B_1 (B m k x0) k y0) k
      (A_1 (B m k x0) k y0)).
(* Goal: not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 (B m k x) k y)) nil)) *)
(* Goal: @eq dart (A_1 (B m k x) k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 m k y)) nil)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
  rewrite A_B_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: @eq dart (if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z) (if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  rewrite <- a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: @eq dart (A (B_1 (B m k x) k y) k z) (A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   rewrite A_B_1_bis.
(* Goal: @eq dart (A (B m k x0) k x0) nil *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart x0 (A_1 (B m k x0) k y0)) *)
  rewrite A_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
Qed.

(* A on y0: *)

Lemma A_B_1_B_y0 : forall(m:fmap)(k:dim)(x0 y0:dart),
 inv_qhmap m ->
   exd m x0 -> exd m y0 -> y0<>x0 -> y0<>A m k x0 ->         
        A (B_1 (B m k x0) k y0) k y0 =
         if eq_dart_dec y0 (A m k y0) then nil
         else A m k y0.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x0 y0 : dart) (_ : inv_qhmap m) (_ : exd m x0) (_ : exd m y0) (_ : not (@eq dart y0 x0)) (_ : not (@eq dart y0 (A m k x0))), @eq dart (A (B_1 (B m k x0) k y0) k y0) (if eq_dart_dec y0 (A m k y0) then nil else A m k y0) *)
intros m k x0 y0 H H0 H1 Hx0 Hd.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k y0) (if eq_dart_dec y0 (A m k y0) then nil else A m k y0) *)
elim (eq_dart_dec y0 (A m k y0)).
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k y0) nil *)
(* Goal: forall _ : not (@eq nat y0 (A m k y0)), @eq dart (A (B_1 (B m k x0) k y0) k y0) (A m k y0) *)
   assert (y0 = A_1 m k y0).
(* Goal: @eq dart x (A_1 m j (A m j x)) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  apply A_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
  replace (A (B_1 (B m k x0) k y0) k y0) with
   (A (B_1 (B m k x0) k y0) k
   (A_1 (B m k x0) k y0)).
(* Goal: not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 (B m k x) k y)) nil)) *)
(* Goal: @eq dart (A_1 (B m k x) k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 m k y)) nil)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   rewrite A_B_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k (A_1 (B m k x0) k y0)) (A (B_1 (B m k x0) k y0) k y0) *)
(* Goal: forall _ : not (@eq nat y0 (A m k y0)), @eq dart (A (B_1 (B m k x0) k y0) k y0) (A m k y0) *)
   assert (A_1 (B m k x0) k y0 = A_1 m k y0).
(* Goal: @eq dart (A_1 (B m j x) j z) (A_1 m j z) *)
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    rewrite A_1_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k (A_1 (B m k x0) k y0)) (A (B_1 (B m k x0) k y0) k y0) *)
(* Goal: forall _ : not (@eq nat y0 (A m k y0)), @eq dart (A (B_1 (B m k x0) k y0) k y0) (A m k y0) *)
    rewrite H3.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k (A_1 m k y0)) (A (B_1 (B m k x0) k y0) k y0) *)
(* Goal: forall _ : not (@eq nat y0 (A m k y0)), @eq dart (A (B_1 (B m k x0) k y0) k y0) (A m k y0) *)
      rewrite <- H2.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: @eq dart (A (B_1 (B m k x) k y) k z) (A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   rewrite A_B_1_bis.
(* Goal: @eq dart (A (B m k x0) k xk) (A m k xk) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart xk (A_1 (B m k x0) k y0)) *)
  rewrite A_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: @eq dart (A_1 (B m j x) j z) (A_1 m j z) *)
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  rewrite A_1_B_bis.
(* Goal: not (@eq dart y0 (A_1 m k y0)) *)
(* Goal: inv_qhmap m *)
(* Goal: not (@eq dart y0 (A m k x0)) *)
   assert (inj_dart (succ m k) (A m k)).
(* Goal: inj_dart (succ m k) (A m k) *)
(* Goal: not (@eq dart y0 (A_1 m k y0)) *)
(* Goal: inv_qhmap m *)
(* Goal: not (@eq dart y0 (A m k x0)) *)
    apply inj_A_qhmap.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: not (@eq dart y0 (A_1 m k y0)) *)
(* Goal: inv_qhmap m *)
(* Goal: not (@eq dart y0 (A m k x0)) *)
    unfold inj_dart in H2.
(* Goal: not (@eq dim k j) *)
      intro.
(* Goal: False *)
(* Goal: inv_qhmap m *)
(* Goal: not (@eq dart y0 (A m k x0)) *)
      assert (A m k y0 = A m k (A_1 m k y0)).
(* Goal: @eq dart (A m k y0) (A m k (A_1 m k y0)) *)
(* Goal: False *)
(* Goal: inv_qhmap m *)
(* Goal: not (@eq dart y0 (A m k x0)) *)
     rewrite <- H3.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: False *)
(* Goal: inv_qhmap m *)
(* Goal: not (@eq dart y0 (A m k x0)) *)
     assert (y0 = A m k y0).
(* Goal: @eq dart y (A m k (A_1 m k y)) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      apply A_1_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* A on xk := A m k x0 : *)

Lemma A_B_1_B_xk :
 forall(m:fmap)(k:dim)(x0 y0:dart),
 inv_qhmap m ->
   exd m x0 -> exd m y0 ->
     let xk := A m k x0 in
     let yk := A_1 m k y0 in
     x0 <> xk -> y0 <> xk ->
     A (B_1 (B m k x0) k y0) k xk =
       if eq_dart_dec xk yk then nil
       else A m k xk.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x0 y0 : dart) (_ : inv_qhmap m) (_ : exd m x0) (_ : exd m y0), let xk := A m k x0 in let yk := A_1 m k y0 in forall (_ : not (@eq dart x0 xk)) (_ : not (@eq dart y0 xk)), @eq dart (A (B_1 (B m k x0) k y0) k xk) (if eq_dart_dec xk yk then nil else A m k xk) *)
intros m k x0 y0 H H0 H1 xk yk Hx0 Hd.
(* Goal: @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (if eq_dart_dec xk yk then nil else A_1 m k yk) *)
elim (eq_dart_dec xk yk).
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k xk) nil *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A (B_1 (B m k x0) k y0) k xk) (A m k xk) *)
   assert (yk = A_1 (B m k x0) k y0).
(* Goal: @eq dart yk (A_1 (B m k x0) k y0) *)
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k xk) nil *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A (B_1 (B m k x0) k y0) k xk) (A m k xk) *)
  unfold yk in |- *.
    symmetry  in |- *.
(* Goal: @eq dart (A_1 (B m k x0) k yk) (A_1 m k yk) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart yk y0) *)
    apply A_1_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (@eq dart yk (A m k x0)) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart yk y0) *)
   fold xk in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k xk) nil *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A (B_1 (B m k x0) k y0) k xk) (A m k xk) *)
  rewrite a; rewrite H2.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k (A_1 (B m k x0) k y0)) nil *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A (B_1 (B m k x0) k y0) k xk) (A m k xk) *)
    apply A_B_1.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: @eq dart (A (B_1 (B m k x) k y) k z) (A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   rewrite A_B_1_bis.
(* Goal: @eq dart (A (B m k x0) k xk) (A m k xk) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart xk (A_1 (B m k x0) k y0)) *)
  rewrite A_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: False *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart xk (A_1 (B m k x0) k y0)) *)
     unfold xk in H2.
     symmetry  in H2.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: @eq dart (A_1 (B m j x) j z) (A_1 m j z) *)
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  rewrite A_1_B_bis.
(* Goal: not (@eq dart xk (A_1 m k y0)) *)
(* Goal: inv_qhmap m *)
(* Goal: not (@eq dart y0 (A m k x0)) *)
   fold yk in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
Qed.

(* A on yk:= (A_1 m k y0): *)

Lemma A_B_1_B_yk :
 forall(m:fmap)(k:dim)(x0 y0:dart),
  inv_qhmap m ->
   exd m x0 -> exd m y0 -> y0 <> A m k x0 ->
     A (B_1 (B m k x0) k y0) k (A_1 m k y0) = nil.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x0 y0 : dart) (_ : inv_qhmap m) (_ : exd m x0) (_ : exd m y0) (_ : not (@eq dart y0 (A m k x0))), @eq dart (A (B_1 (B m k x0) k y0) k (A_1 m k y0)) nil *)
intros m k x0 y0 Hinv H0 H1 Ha.
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k (A_1 m k y0)) nil *)
replace (A_1 m k y0) with (A_1 (B m k x0) k y0).
(* Goal: not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 (B m k x) k y)) nil)) *)
(* Goal: @eq dart (A_1 (B m k x) k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 m k y)) nil)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
 rewrite A_B_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: @eq dart (A_1 (B m k x0) k yk) (A_1 m k yk) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart yk y0) *)
 apply A_1_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
Qed.

(* THE SYMMETRICS, PROVEN TOO: *)

(* A_1 on y0: *)

Lemma A_1_B_1_B_y0 : forall(m:fmap)(k:dim)(x0 y0:dart),        inv_qhmap m ->
     A_1 (B_1 (B m k x0) k y0) k y0 = nil.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x0 y0 : dart) (_ : inv_qhmap m), @eq dart (A_1 (B_1 (B m k x0) k y0) k y0) nil *)
intros m k x0 y0 Hinv.
(* Goal: @eq dart (A_1 (B_1 (B m k x0) k y0) k y0) nil *)
apply A_1_B_1.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
tauto.
Qed.

(* A_1 on x0: *)

Lemma A_1_B_1_B_x0 : forall(m:fmap)(k:dim)(x0 y0:dart),
 inv_qhmap m ->
   exd m x0 -> exd m y0 -> y0<>x0 -> y0<>A m k x0 ->         
   A_1 (B_1 (B m k x0) k y0) k x0 =
         if eq_dart_dec x0 (A m k x0) then nil
         else A_1 m k x0.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x0 y0 : dart) (_ : inv_qhmap m) (_ : exd m x0) (_ : exd m y0) (_ : not (@eq dart y0 x0)) (_ : not (@eq dart y0 (A m k x0))), @eq dart (A_1 (B_1 (B m k x0) k y0) k x0) (if eq_dart_dec x0 (A m k x0) then nil else A_1 m k x0) *)
intros m k x0 y0 Hinv Hx0 Hy0 Hd Hd1.
(* Goal: @eq dart (A_1 (B_1 (B m k x0) k y0) k x0) (if eq_dart_dec x0 (A m k x0) then nil else A_1 m k x0) *)
elim (eq_dart_dec x0 (A m k x0)).
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) nil *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (A_1 m k yk) *)
   set (m1 := B m k x0) in |- *.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   rewrite a.
(* Goal: @eq dart (A_1 (B_1 (B m j x) j y) j z) (A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   rewrite A_1_B_1_bis.
(* Goal: inv_qhmap m1 *)
(* Goal: not (@eq dart yk y0) *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (A_1 m k yk) *)
  unfold m1 in |- *.
(* Goal: @eq dart (A_1 (B m k x0) k (A m k x0)) nil *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart (A m k x0) y0) *)
    apply A_1_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: inv_qhmap m1 *)
(* Goal: not (@eq dart yk y0) *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (A_1 m k yk) *)
  unfold m1 in |- *.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: False *)
(* Goal: forall _ : not (@eq nat x0 (A m k x0)), @eq dart (A_1 (B_1 (B m k x0) k y0) k x0) (A_1 m k x0) *)
    rewrite H in a.
    symmetry  in a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) nil *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (A_1 m k yk) *)
   set (m1 := B m k x0) in |- *.
(* Goal: @eq dart (A_1 (B_1 (B m j x) j y) j z) (A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   rewrite A_1_B_1_bis.
(* Goal: inv_qhmap m1 *)
(* Goal: not (@eq dart yk y0) *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (A_1 m k yk) *)
  unfold m1 in |- *.
(* Goal: @eq dart (A_1 (B m k x0) k yk) (A_1 m k yk) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart yk y0) *)
    apply A_1_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: inv_qhmap m1 *)
(* Goal: not (@eq dart yk y0) *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (A_1 m k yk) *)
  unfold m1 in |- *.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
  intro.
    symmetry  in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Qed.

(* A_1 on yk: *)

Lemma A_1_B_1_B_yk : forall(m:fmap)(k:dim)(x0 y0:dart),
 inv_qhmap m ->
   exd m x0 -> exd m y0 ->
     let xk := A m k x0 in
     let yk := A_1 m k y0 in
     y0 <> yk -> y0 <> xk ->
       A_1 (B_1 (B m k x0) k y0) k yk =
          if eq_dart_dec xk yk then nil
          else A_1 m k yk.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x0 y0 : dart) (_ : inv_qhmap m) (_ : exd m x0) (_ : exd m y0), let xk := A m k x0 in let yk := A_1 m k y0 in forall (_ : not (@eq dart y0 yk)) (_ : not (@eq dart y0 xk)), @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (if eq_dart_dec xk yk then nil else A_1 m k yk) *)
intros m k x0 y0 Hinv Hx Hy xk yk Hd Hd1.
(* Goal: @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (if eq_dart_dec xk yk then nil else A_1 m k yk) *)
 unfold inv_qhmap in Hinv.
(* Goal: @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (if eq_dart_dec xk yk then nil else A_1 m k yk) *)
 elim (eq_dart_dec xk yk).
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) nil *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (A_1 m k yk) *)
   set (m1 := B m k x0) in |- *.
(* Goal: @eq dart (A_1 (B_1 (B m j x) j y) j z) (A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   rewrite A_1_B_1_bis.
(* Goal: inv_qhmap m1 *)
(* Goal: not (@eq dart yk y0) *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (A_1 m k yk) *)
  unfold m1 in |- *.
(* Goal: @eq dart (if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z) (if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    rewrite <- a.
(* Goal: not (@eq dart yk (A m k x0)) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart yk y0) *)
    unfold xk in |- *.
(* Goal: @eq dart (A_1 (B m k x0) k (A m k x0)) nil *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart (A m k x0) y0) *)
    apply A_1_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: inv_qhmap m1 *)
(* Goal: not (@eq dart yk y0) *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A_1 (B_1 (B m k x0) k y0) k yk) (A_1 m k yk) *)
  unfold m1 in |- *.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
  intro.
    symmetry  in H.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: @eq dart (A_1 (B_1 (B m j x) j y) j z) (A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   rewrite A_1_B_1_bis.
(* Goal: @eq dart (A_1 (B m k x0) k yk) (A_1 m k yk) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart yk y0) *)
  apply A_1_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (@eq dart yk (A m k x0)) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart yk y0) *)
   fold xk in |- *.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     symmetry  in H; tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    symmetry  in H; tauto.
Qed.

(* A_1 on xk: *)

Lemma A_1_B_1_B_xk : forall(m:fmap)(k:dim)(x0 y0:dart),
 inv_qhmap m ->
   exd m x0 -> exd m y0 -> y0<>A m k x0 ->
    A_1 (B_1 (B m k x0) k y0) k (A m k x0) = nil.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x0 y0 : dart) (_ : inv_qhmap m) (_ : exd m x0) (_ : exd m y0) (_ : not (@eq dart y0 (A m k x0))), @eq dart (A_1 (B_1 (B m k x0) k y0) k (A m k x0)) nil *)
intros m k x0 y0 Hinv Hx Hy Hd.
(* Goal: @eq dart (A_1 (B_1 (B m j x) j y) j z) (A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
rewrite A_1_B_1_bis.
(* Goal: @eq dart (A_1 (B m k x0) k (A m k x0)) nil *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart (A m k x0) y0) *)
 apply A_1_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
 apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   symmetry  in H; tauto.
Qed.

(*==========================================================
            TOPOLOGICAL HMAP OPERATIONS 
==========================================================*)

(* Empty hmap: *)

Definition v:= V.

(* Insertion of an isolated dart, sewn to itself: *)

Definition prec_i (m:fmap)(x:dart):=
  prec_I m x.

Definition i(m:fmap)(x:dart):=
  L (L (I m x) di0 x x) di1 x x.

(* Correction of i for hmaps: proof obligation: *)

Lemma inv_hmap_i:
  forall (m:fmap)(x:dart),
  inv_hmap m -> prec_i m x -> inv_hmap (i m x).
Proof.
(* Goal: forall (m : fmap) (x : dart) (_ : inv_hmap m) (_ : prec_i m x), inv_hmap (i m x) *)
unfold inv_hmap at 2 in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_i m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
unfold prec_i in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
unfold prec_I in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold inv_hmap in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
 split.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
  split.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
   split.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
    unfold prec_I in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
   unfold prec_Lq in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
     split.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
    simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
    split.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
     simpl in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
     unfold succ in |- *; unfold pred in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
       simpl in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
       split.
(* Goal: not (not (@eq dart (A m di0 x) nil)) *)
(* Goal: not (not (@eq dart (A_1 m di0 x) nil)) *)
(* Goal: prec_Lq (L (I m x) di0 x x) di1 x x *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
      assert (A m di0 x = nil).
(* Goal: @eq dart (A m di1 x) nil *)
(* Goal: not (not (@eq dart (A m di1 x) nil)) *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
       apply not_exd_A_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (not (@eq dart (A_1 m di0 x) nil)) *)
(* Goal: prec_Lq (L (I m x) di0 x x) di1 x x *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
      assert (A_1 m di0 x = nil).
(* Goal: @eq dart (A_1 m di1 x) nil *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
       apply not_exd_A_1_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
  unfold prec_Lq in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
    simpl in |- *.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
    unfold succ in |- *; unfold pred in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
    simpl in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
    split.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
   split.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
    split.
(* Goal: not (not (@eq dart (A m di1 x) nil)) *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
     assert (A m di1 x = nil).
(* Goal: @eq dart (A m di1 x) nil *)
(* Goal: not (not (@eq dart (A m di1 x) nil)) *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
      apply not_exd_A_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
     assert (A_1 m di1 x = nil).
(* Goal: @eq dart (A_1 m di1 x) nil *)
(* Goal: not (not (@eq dart (A_1 m di1 x) nil)) *)
(* Goal: forall (x0 : dart) (k : dim) (_ : or (@eq dart x0 x) (exd m x0)), and (succ (i m x) k x0) (pred (i m x) k x0) *)
      apply not_exd_A_1_nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: and (succ (i m x) k x0) (pred (i m x) k x0) *)
   elim H1.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: and (succ (i m x) k x0) (pred (i m x) k x0) *)
(* Goal: forall _ : exd m x0, and (succ (i m x) k x0) (pred (i m x) k x0) *)
    rewrite H2.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
    unfold succ in |- *; unfold pred in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
    simpl in |- *.
(* Goal: forall _ : exd m x0, and (not (@eq dart (if eq_dim_dec k di1 then if eq_dart_dec x0 x then x else if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A m k x0 else A m k x0 else if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A m k x0 else A m k x0) nil)) (not (@eq dart (if eq_dim_dec k di1 then if eq_dart_dec x0 x then x else if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A_1 m k x0 else A_1 m k x0 else if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A_1 m k x0 else A_1 m k x0) nil)) *)
    elim (eq_dim_dec k di1).
(* Goal: forall (_ : @eq dim k di0) (_ : not (@eq dim k di1)), and (not (@eq dart (if eq_dart_dec x x then x else A m k x) nil)) (not (@eq dart (if eq_dart_dec x x then x else A_1 m k x) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)), and (not (@eq dart (A m k x) nil)) (not (@eq dart (A_1 m k x) nil)) *)
(* Goal: forall _ : exd m x0, and (succ (i m x) k x0) (pred (i m x) k x0) *)
   elim (eq_dart_dec x x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A m k x0 else A m k x0) nil)) (not (@eq dart (if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A_1 m k x0 else A_1 m k x0) nil)) *)
   elim (eq_dim_dec k di0).
(* Goal: forall (_ : @eq dim k di0) (_ : not (@eq dim k di1)), and (not (@eq dart (if eq_dart_dec x x then x else A m k x) nil)) (not (@eq dart (if eq_dart_dec x x then x else A_1 m k x) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)), and (not (@eq dart (A m k x) nil)) (not (@eq dart (A_1 m k x) nil)) *)
(* Goal: forall _ : exd m x0, and (succ (i m x) k x0) (pred (i m x) k x0) *)
    elim (eq_dart_dec x x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
      induction k.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
  unfold succ in |- *; unfold pred in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
    simpl in |- *.
(* Goal: forall _ : exd m x0, and (not (@eq dart (if eq_dim_dec k di1 then if eq_dart_dec x0 x then x else if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A m k x0 else A m k x0 else if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A m k x0 else A m k x0) nil)) (not (@eq dart (if eq_dim_dec k di1 then if eq_dart_dec x0 x then x else if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A_1 m k x0 else A_1 m k x0 else if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A_1 m k x0 else A_1 m k x0) nil)) *)
    elim (eq_dim_dec k di1).
(* Goal: forall (_ : @eq dim k di0) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (if eq_dart_dec x0 x then x else A m k x0) nil)) (not (@eq dart (if eq_dart_dec x0 x then x else A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
   elim (eq_dart_dec x0 x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A m k x0 else A m k x0) nil)) (not (@eq dart (if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A_1 m k x0 else A_1 m k x0) nil)) *)
    elim (eq_dim_dec k di0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq nat x0 x)) (_ : @eq dim k di1) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A m k x0 else A m k x0) nil)) (not (@eq dart (if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A_1 m k x0 else A_1 m k x0) nil)) *)
       rewrite a0 in a.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq nat x0 x)) (_ : @eq dim k di1) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A m k x0 else A m k x0) nil)) (not (@eq dart (if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A_1 m k x0 else A_1 m k x0) nil)) *)
       inversion a.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: not (not (@eq dart (A_1 (B_1 m k x) d d1) nil)) *)
       unfold succ in H; unfold pred in H.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
       elim H.
(* Goal: not (@eq dim k j) *)
       intro.
(* Goal: not (@eq dim k j) *)
       intro.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
       apply H4.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A m k x0 else A m k x0) nil)) (not (@eq dart (if eq_dim_dec k di0 then if eq_dart_dec x0 x then x else A_1 m k x0 else A_1 m k x0) nil)) *)
   elim (eq_dim_dec k di0).
(* Goal: forall (_ : @eq dim k di0) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (if eq_dart_dec x0 x then x else A m k x0) nil)) (not (@eq dart (if eq_dart_dec x0 x then x else A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
    elim (eq_dart_dec x0 x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
       elim H.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       intros.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
       unfold succ in H4.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
       unfold pred in H4.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
       apply H4.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
      induction k.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
Qed.

(* Changing k-links: effect: breaking/merging of orbits *)

(* Precondition for hmaps: *)

Definition prec_lh (m:fmap)(k:dim)(x y:dart)
  := exd m x /\ exd m y /\ y <> A m k x.

(* Note that the construction of fixpoints is allowed: *)

Definition l (m:fmap)(k:dim)(x y:dart) :=
   let xk  := (A m k x) in
   let y_k := (A_1 m k y) in
   let m1 := (B_1 (B m k x) k y) in
   (L (L m1 k x y) k y_k xk).

Lemma y_xk_vs_yk_x : forall(m:fmap)(k:dim)(x y:dart),
  inv_hmap m -> exd m x -> exd m y ->
  let xk:= A m k x in
  let yk:= A_1 m k y in
     y <> xk <-> yk <> x.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: @eq dart yk (A_1 (B m k x0) k y0) *)
(* Goal: @eq dart (A (B_1 (B m k x0) k y0) k xk) nil *)
(* Goal: forall _ : not (@eq nat xk yk), @eq dart (A (B_1 (B m k x0) k y0) k xk) (A m k xk) *)
unfold xk in |- *; unfold yk in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A m k x)), @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   assert (y = A m k x).
(* Goal: @eq dart y (A m k (A_1 m k y)) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  apply A_1_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   unfold inv_hmap in H; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
   symmetry  in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: not (@eq dim k j) *)
 intro.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: False *)
   assert (x = A_1 m k y).
(* Goal: @eq dart x (A_1 m j (A m j x)) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
  apply A_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   unfold inv_hmap in H; tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: False *)
  rewrite H4 in H2.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Qed.

(*========================================================
     Correction of l for hmaps : PROOF OBLIGATION
 ========================================================*)

(* BY PARTS: *)

(* From qhmap, by B then by B_1, we arrive in qhmap: *)

Lemma inv_qhmap_l_11:
  forall (m:fmap)(k:dim)(x y:dart),
  inv_qhmap m -> prec_lh m k x y ->
      inv_qhmap (B_1 (B m k x) k y).
Proof.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : inv_qhmap m) (_ : prec_lh m k x y), inv_qhmap (B_1 (B m k x) k y) *)
unfold inv_qhmap in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: (fix inv_qhmap (m : fmap) : Prop := match m with | V => True | I m0 x0 => and (inv_qhmap m0) (prec_I m0 x0) | L m0 k0 x0 y0 => and (inv_qhmap m0) (prec_Lq m0 k0 x0 y0) end) (B_1 (B m k x) k y) *)
apply inv_qhmap_B_1.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
tauto.
Qed.

(* Precondition for sewing in a qhmap is satified: *)

Lemma inv_qhmap_l_12:
  forall (m:fmap)(k:dim)(x y:dart),
  inv_qhmap m -> prec_lh m k x y ->
      prec_Lq (B_1 (B m k x) k y) k x y.
Proof.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
unfold prec_Lq in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold prec_lh in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
(* Goal: exd (B_1 (B m k x) k y) x *)
(* Goal: and (exd (B_1 (B m k x) k y) y) (and (not (succ (B_1 (B m k x) k y) k x)) (not (pred (B_1 (B m k x) k y) k y))) *)
 generalize (exd_B_1 (B m k x) k y x).
(* Goal: forall _ : iff (exd (B m k x) x) (exd (B_1 (B m k x) k y) x), exd (B_1 (B m k x) k y) x *)
(* Goal: and (exd (B_1 (B m k x) k y) y) (and (not (succ (B_1 (B m k x) k y) k x)) (not (pred (B_1 (B m k x) k y) k y))) *)
   generalize (exd_B m k x x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
 split.
(* Goal: exd (B_1 (B m k x) k y) y *)
(* Goal: and (not (succ (B_1 (B m k x) k y) k x)) (not (pred (B_1 (B m k x) k y) k y)) *)
  generalize (exd_B_1 (B m k x) k y y).
(* Goal: forall _ : iff (exd (B m k x) y) (exd (B_1 (B m k x) k y) y), exd (B_1 (B m k x) k y) y *)
(* Goal: and (not (succ (B_1 (B m k x) k y) k x)) (not (pred (B_1 (B m k x) k y) k y)) *)
    generalize (exd_B m k x y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
  unfold succ in |- *.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
    unfold pred in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
    split.
(* Goal: not (not (@eq dart (A (B_1 (B m k x) k y) k x) nil)) *)
(* Goal: not (not (@eq dart (A_1 (B_1 (B m k x) k y) k y) nil)) *)
   rewrite A_B_1_B_x0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (not (@eq dart (A_1 (B_1 (B m k x) k y) k y) nil)) *)
   rewrite A_1_B_1_B_y0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Qed.

(* The following needs a hmap: *)

Lemma inv_hmap_l_13:
  forall (m:fmap)(k:dim)(x y:dart),
  inv_hmap m -> prec_lh m k x y ->
     prec_Lq (L (B_1 (B m k x) k y) k x y)
          k (A_1 m k y) (A m k x).
Proof.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold inv_hmap in |- *.
(* Goal: forall (m : fmap) (k : dim) (x y : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : prec_lh m k x y), prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
unfold prec_Lq in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold prec_lh in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: exd (B_1 (B m k x) k y) (A_1 m k y) *)
(* Goal: and (exd (L (B_1 (B m k x) k y) k x y) (A m k x)) (and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)))) *)
   generalize (exd_B_1 (B m k x) k y (A_1 m k y)).
(* Goal: forall _ : iff (exd (B m k x) (A_1 m k y)) (exd (B_1 (B m k x) k y) (A_1 m k y)), exd (B_1 (B m k x) k y) (A_1 m k y) *)
(* Goal: and (exd (L (B_1 (B m k x) k y) k x y) (A m k x)) (and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)))) *)
   generalize (exd_B m k x (A_1 m k y)).
(* Goal: forall (_ : iff (exd m (A_1 m k y)) (exd (B m k x) (A_1 m k y))) (_ : iff (exd (B m k x) (A_1 m k y)) (exd (B_1 (B m k x) k y) (A_1 m k y))), exd (B_1 (B m k x) k y) (A_1 m k y) *)
(* Goal: and (exd (L (B_1 (B m k x) k y) k x y) (A m k x)) (and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)))) *)
   assert (exd m (A_1 m k y)).
(* Goal: exd m (A_1 m k y) *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  apply pred_exd_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: succ m k x *)
(* Goal: forall (_ : iff (exd m (A m k x)) (exd (B m k x) (A m k x))) (_ : iff (exd (B m k x) (A m k x)) (exd (B_1 (B m k x) k y) (A m k x))), exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
   decompose [and] H.
(* Goal: pred m k y *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     generalize (H2 y k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
 split.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  simpl in |- *.
(* Goal: exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
    generalize (exd_B_1 (B m k x) k y (A m k x)).
(* Goal: forall _ : iff (exd (B m k x) (A m k x)) (exd (B_1 (B m k x) k y) (A m k x)), exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
    generalize (exd_B m k x (A m k x)).
(* Goal: forall (_ : iff (exd m (A m k x)) (exd (B m k x) (A m k x))) (_ : iff (exd (B m k x) (A m k x)) (exd (B_1 (B m k x) k y) (A m k x))), exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
    assert (exd m (A m k x)).
(* Goal: exd m (A m j x) *)
(* Goal: @eq dart (A m j x) (A m j x) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   apply succ_exd_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: succ m k x *)
(* Goal: forall (_ : iff (exd m (A m k x)) (exd (B m k x) (A m k x))) (_ : iff (exd (B m k x) (A m k x)) (exd (B_1 (B m k x) k y) (A m k x))), exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
    decompose [and] H.
(* Goal: succ m k x *)
(* Goal: forall (_ : iff (exd m (A m k x)) (exd (B m k x) (A m k x))) (_ : iff (exd (B m k x) (A m k x)) (exd (B_1 (B m k x) k y) (A m k x))), exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
      generalize (H2 x k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
  split.
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold succ in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
     simpl in |- *.
(* Goal: not (not (@eq dart (if eq_dim_dec k k then if eq_dart_dec (A m k x) y then x else A_1 (B_1 (B m k x) k y) k (A m k x) else A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
     elim (eq_dim_dec k k).
(* Goal: forall _ : @eq dim k k, not (not (@eq dart (if eq_dart_dec (A_1 m k y) x then y else A (B_1 (B m k x) k y) k (A_1 m k y)) nil)) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 m k y)) nil)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
    elim (eq_dart_dec (A_1 m k y) x).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
(* Goal: @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A m k x)), @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       assert (y = A m k x).
(* Goal: @eq dart y (A m k (A_1 m k y)) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      apply A_1_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       rewrite a.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     intros.
       replace (A_1 m k y) with
          (A_1 (B m k x) k y).
(* Goal: not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 (B m k x) k y)) nil)) *)
(* Goal: @eq dart (A_1 (B m k x) k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A (B_1 (B m k x) k y) k (A_1 m k y)) nil)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
      rewrite A_B_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: @eq dart (A_1 (B m j x) j z) (A_1 m j z) *)
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      rewrite A_1_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
   unfold pred in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
     simpl in |- *.
(* Goal: not (not (@eq dart (if eq_dim_dec k k then if eq_dart_dec (A m k x) y then x else A_1 (B_1 (B m k x) k y) k (A m k x) else A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
     elim (eq_dim_dec k k).
(* Goal: forall _ : @eq dim k k, not (not (@eq dart (if eq_dart_dec (A m k x) y then x else A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
    elim (eq_dart_dec (A m k x) y).
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: forall _ : @eq dim k k, not (not (@eq dart x nil)) *)
(* Goal: forall (_ : not (@eq nat (A m k x) y)) (_ : @eq dim k k), not (not (@eq dart (A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
       rewrite a in H0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: not (@eq dim k j) *)
       intro.
(* Goal: @eq dart (A_1 (B_1 (B m j x) j y) j z) (A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       rewrite A_1_B_1_bis.
(* Goal: not (not (@eq dart (A_1 (B m k x) k (A m k x)) nil)) *)
(* Goal: inv_qhmap (B m k x) *)
(* Goal: not (@eq dart (A m k x) y) *)
(* Goal: forall _ : not (@eq dim k k), not (not (@eq dart (A_1 (B_1 (B m k x) k y) k (A m k x)) nil)) *)
      rewrite A_1_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Qed.

(* First PART: *)

Lemma inv_hmap_l_1:
  forall (m:fmap)(k:dim)(x y:dart),
  inv_hmap m -> prec_lh m k x y -> inv_qhmap (l m k x y).
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold l in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
(* Goal: forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0) *)
unfold inv_hmap in H.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
 split.
(* Goal: inv_qhmap (B_1 (B m k x) k y) *)
(* Goal: prec_Lq (B_1 (B m k x) k y) k x y *)
(* Goal: prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
  apply inv_qhmap_l_11.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: prec_Lq (B_1 (B m k x) k y) k x y *)
(* Goal: prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
  apply inv_qhmap_l_12.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: prec_Lq (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x) *)
 apply inv_hmap_l_13.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
Qed.

(* Second PART: *)

Lemma inv_hmap_l_2: forall (m:fmap)(k:dim)(x y:dart),
 inv_hmap m -> prec_lh m k x y ->
  (forall (x0 : dart) (k0 : dim),
    exd (l m k x y) x0 ->
      succ (l m k x y) k0 x0 /\ pred (l m k x y) k0 x0).
Proof.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold l in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold inv_hmap in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold prec_lh in |- *.
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
unfold succ in |- *; unfold pred in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
assert (exd m x0).
 generalize (exd_B_1 (B m k x) k y x0).
   generalize (exd_B m k x x0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: succ m k x *)
(* Goal: forall (_ : iff (exd m (A m k x)) (exd (B m k x) (A m k x))) (_ : iff (exd (B m k x) (A m k x)) (exd (B_1 (B m k x) k y) (A m k x))), exd (B_1 (B m k x) k y) (A m k x) *)
(* Goal: and (not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y))) (not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x))) *)
 decompose [and] H.
   clear H.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
   split.
  elim (eq_dim_dec k0 k).
   elim (eq_dart_dec x0 (A_1 m k y)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
      generalize (H4 x k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: forall (_ : @eq dim k di0) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (if eq_dart_dec x0 x then x else A m k x0) nil)) (not (@eq dart (if eq_dart_dec x0 x then x else A_1 m k x0) nil)) *)
(* Goal: forall (_ : not (@eq dim k di0)) (_ : not (@eq dim k di1)) (_ : exd m x0), and (not (@eq dart (A m k x0) nil)) (not (@eq dart (A_1 m k x0) nil)) *)
      elim (eq_dart_dec x0 x).
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: forall _ : exd m y, not (@eq dart y nil) *)
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
       eapply exd_not_nil.
(* Goal: @eq dart x x' *)
      apply H3.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       rewrite a.
(* Goal: @eq dart (A (B_1 (B m k x) k y) k z) (A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       rewrite A_B_1_bis.
(* Goal: @eq dart (A (B m k x0) k xk) (A m k xk) *)
(* Goal: inv_qhmap (B m k x0) *)
(* Goal: not (@eq dart xk (A_1 (B m k x0) k y0)) *)
      rewrite A_B_bis.
       generalize (H4 x0 k).
(* Goal: not (succ (L (B_1 (B m k x) k y) k x y) k (A_1 m k y)) *)
(* Goal: not (pred (L (B_1 (B m k x) k y) k x y) k (A m k x)) *)
         unfold succ in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: @eq dart (A_1 (B m j x) j z) (A_1 m j z) *)
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      rewrite A_1_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite A_B_1_ter.
(* Goal: @eq dart (A (B m k x) j z) (A m j z) *)
(* Goal: not (@eq dim k j) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    rewrite A_B_ter.
     generalize (H4 x0 k0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (@eq dim k j) *)
     intro.
       rewrite H in b.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (@eq dim k j) *)
    intro.
      rewrite H in b.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
  elim (eq_dim_dec k0 k).
   elim (eq_dart_dec x0 (A m k x)).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
      generalize (H4 y k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
      elim (eq_dart_dec x0 y).
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: forall _ : exd m y, not (@eq dart y nil) *)
(* Goal: @eq dart x (A_1 m k y) *)
(* Goal: forall (_ : not (@eq nat x d)) (_ : @eq dart y (A m k x)), @eq dart x (A_1 m k y) *)
(* Goal: forall (k : dim) (x y : dart) (_ : inv_qhmap (L m d d0 d1)) (_ : exd (L m d d0 d1) x) (_ : exd (L m d d0 d1) y) (_ : @eq dart y (A (L m d d0 d1) k x)), @eq dart x (A_1 (L m d d0 d1) k y) *)
       eapply exd_not_nil.
(* Goal: @eq dart x x' *)
      apply H3.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: not (@eq dim k j) *)
     intro.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       rewrite a.
(* Goal: @eq dart (A_1 (B_1 (B m j x) j y) j z) (A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       rewrite A_1_B_1_bis.
(* Goal: @eq dart (A_1 (B m j x) j z) (A_1 m j z) *)
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      rewrite A_1_B_bis.
       generalize (H4 x0 k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     rewrite A_1_B_1_ter.
(* Goal: @eq dart (A_1 (B m k x) j z) (A_1 m j z) *)
(* Goal: not (@eq dim k j) *)
    rewrite A_1_B_ter.
     generalize (H4 x0 k0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (@eq dim k j) *)
     intro.
       rewrite H in b.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: not (@eq dim k j) *)
    intro.
      rewrite H in b.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
Qed.

(* CORRECTION of l : PROOF OBLIGATION: *)

Theorem inv_hmap_l:
  forall (m:fmap)(k:dim)(x y:dart),
    inv_hmap m -> prec_lh m k x y -> inv_hmap (l m k x y).
Proof.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
intros.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold inv_hmap in |- *.
(* Goal: and (inv_qhmap (l m k x y)) (forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0)) *)
split.
(* Goal: inv_qhmap (l m k x y) *)
(* Goal: forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0) *)
 apply inv_hmap_l_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
(* Goal: forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0) *)
 unfold inv_hmap in H.
(* Goal: forall (x0 : dart) (k0 : dim) (_ : exd (l m k x y) x0), and (succ (l m k x y) k0 x0) (pred (l m k x y) k0 x0) *)
   apply inv_hmap_l_2.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
  unfold inv_hmap in |- *.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  tauto.
Qed.

(*=========================================================
     COMPLEMENTAR PROPERTIES of v, i, l for hmaps :
==========================================================*)

(* A, A_1 on v: *)

Theorem A_A_1_v :
 forall (m:fmap)(j:dim)(x z : dart),
  inv_hmap m ->
    A v j z = nil
 /\ A_1 v j z = nil.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
Proof. simpl in |- *. tauto. Qed.

(* A, A_1 on i: *)

Theorem A_A_1_i :
 forall (m:fmap)(j:dim)(x z : dart),
  inv_hmap m -> prec_i m x ->
    (A (i m x) j z =
       if eq_dart_dec z x then x
       else A m j z)
 /\ (A_1 (i m x) j z =
       if eq_dart_dec z x then x
       else A_1 m j z).
Proof.
(* Goal: forall (m : fmap) (j : dim) (x z : dart) (_ : inv_hmap m) (_ : prec_i m x), @eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z) *)
intros m j x z.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold inv_hmap in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_i m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
unfold prec_i in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : prec_I m x), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
unfold prec_I in |- *.
(* Goal: forall (_ : and (inv_qhmap m) (forall (x : dart) (k : dim) (_ : exd m x), and (succ m k x) (pred m k x))) (_ : and (not (@eq dart x nil)) (not (exd m x))), and (@eq dart (A (i m x) j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
induction m.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   elim (eq_dart_dec z x).
(* Goal: and (@eq dart (if eq_dim_dec j di1 then if eq_dart_dec z x then x else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di1 then if eq_dart_dec z x then x else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
  elim (eq_dim_dec j di1).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq dim j di1), and (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
   elim (eq_dim_dec j di0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (@eq dart (A m j z) x) (@eq dart (A_1 m j z) x) *)
(* Goal: forall (_ : not (@eq nat z x)) (_ : not (@eq dim j di0)) (_ : not (@eq dim j di1)), and (@eq dart (A m j z) (A m j z)) (@eq dart (A_1 m j z) (A_1 m j z)) *)
(* Goal: forall (_ : and (inv_qhmap (L m d d0 d1)) (forall (x : dart) (k : dim) (_ : exd (L m d d0 d1) x), and (succ (L m d d0 d1) k x) (pred (L m d d0 d1) k x))) (_ : and (not (@eq dart x nil)) (not (exd (L m d d0 d1) x))), and (@eq dart (A (i (L m d d0 d1) x) j z) (if eq_dart_dec z x then x else A (L m d d0 d1) j z)) (@eq dart (A_1 (i (L m d d0 d1) x) j z) (if eq_dart_dec z x then x else A_1 (L m d d0 d1) j z)) *)
      induction j.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: and (@eq dart (if eq_dim_dec j di1 then if eq_dart_dec z x then x else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di1 then if eq_dart_dec z x then x else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
  elim (eq_dim_dec j di1).
(* Goal: forall _ : not (@eq dim j di1), and (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
   elim (eq_dim_dec j di0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq dim j di1), and (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
   elim (eq_dim_dec j di0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
 simpl in |- *.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: and (@eq dart (if eq_dim_dec j di1 then if eq_dart_dec z x then x else if eq_dim_dec j di0 then if eq_dart_dec z x then x else A m j z else A m j z else if eq_dim_dec j di0 then if eq_dart_dec z x then x else A m j z else A m j z) (if eq_dart_dec z x then x else A m j z)) (@eq dart (if eq_dim_dec j di1 then if eq_dart_dec z x then x else if eq_dim_dec j di0 then if eq_dart_dec z x then x else A_1 m j z else A_1 m j z else if eq_dim_dec j di0 then if eq_dart_dec z x then x else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else A_1 m j z)) *)
(* Goal: forall (_ : and (inv_qhmap (L m d d0 d1)) (forall (x : dart) (k : dim) (_ : exd (L m d d0 d1) x), and (succ (L m d d0 d1) k x) (pred (L m d d0 d1) k x))) (_ : and (not (@eq dart x nil)) (not (exd (L m d d0 d1) x))), and (@eq dart (A (i (L m d d0 d1) x) j z) (if eq_dart_dec z x then x else A (L m d d0 d1) j z)) (@eq dart (A_1 (i (L m d d0 d1) x) j z) (if eq_dart_dec z x then x else A_1 (L m d d0 d1) j z)) *)
   simpl in IHm.
(* Goal: and (@eq dart (if eq_dim_dec j di1 then if eq_dart_dec z x then x else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di1 then if eq_dart_dec z x then x else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
   elim (eq_dim_dec j di1).
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  elim (eq_dart_dec z x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq dim j di1), and (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
   elim (eq_dim_dec j di0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq dim j di1), and (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
  elim (eq_dim_dec j di0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   elim (eq_dart_dec z x).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (@eq dart (A m j z) x) (@eq dart (A_1 m j z) x) *)
(* Goal: forall (_ : not (@eq nat z x)) (_ : not (@eq dim j di0)) (_ : not (@eq dim j di1)), and (@eq dart (A m j z) (A m j z)) (@eq dart (A_1 m j z) (A_1 m j z)) *)
(* Goal: forall (_ : and (inv_qhmap (L m d d0 d1)) (forall (x : dart) (k : dim) (_ : exd (L m d d0 d1) x), and (succ (L m d d0 d1) k x) (pred (L m d d0 d1) k x))) (_ : and (not (@eq dart x nil)) (not (exd (L m d d0 d1) x))), and (@eq dart (A (i (L m d d0 d1) x) j z) (if eq_dart_dec z x then x else A (L m d d0 d1) j z)) (@eq dart (A_1 (i (L m d d0 d1) x) j z) (if eq_dart_dec z x then x else A_1 (L m d d0 d1) j z)) *)
      induction j.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
 intros.
(* Goal: and (@eq dart (A (i (L m d d0 d1) x) j z) (if eq_dart_dec z x then x else A (L m d d0 d1) j z)) (@eq dart (A_1 (i (L m d d0 d1) x) j z) (if eq_dart_dec z x then x else A_1 (L m d d0 d1) j z)) *)
   unfold i in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
   simpl in |- *.
(* Goal: and (@eq dart (if eq_dim_dec j di1 then if eq_dart_dec z x then x else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di1 then if eq_dart_dec z x then x else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
   elim (eq_dim_dec j di1).
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
  elim (eq_dart_dec z x).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall _ : not (@eq dim j di1), and (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
   elim (eq_dim_dec j di0).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: and (@eq dart (if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
(* Goal: forall (_ : not (@eq dim j di0)) (_ : not (@eq nat z x)) (_ : @eq dim j di1), and (@eq dart (if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
(* Goal: forall _ : not (@eq dim j di1), and (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
      rewrite a in a0.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq dim j di1), and (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j di0 then if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
  elim (eq_dim_dec j di0).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   tauto.
(* Goal: forall (_ : not (@eq dim j di0)) (_ : not (@eq dim j di1)), and (@eq dart (if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d0 then d1 else A m j z else A m j z)) (@eq dart (if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z) (if eq_dart_dec z x then x else if eq_dim_dec j d then if eq_dart_dec z d1 then d0 else A_1 m j z else A_1 m j z)) *)
   elim j.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
Qed.

(* A on i: *)

Theorem A_i :
 forall (m:fmap)(j:dim)(x z : dart),
  inv_hmap m -> prec_i m x ->
    (A (i m x) j z =
       if eq_dart_dec z x then x
       else A m j z).
Proof.
(* Goal: forall (m : fmap) (j : dim) (x z : dart) (_ : inv_hmap m) (_ : prec_i m x), @eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z) *)
intros m j x z.
(* Goal: forall (_ : inv_hmap m) (_ : prec_i m x), @eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z) *)
generalize (A_A_1_i m j x z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
tauto.
Qed.

(* A_1 on i: *)

Theorem A_1_i :
 forall (m:fmap)(j:dim)(x z : dart),
  inv_hmap m -> prec_i m x ->
    (A_1 (i m x) j z =
       if eq_dart_dec z x then x
       else A_1 m j z).
Proof.
(* Goal: forall (m : fmap) (j : dim) (x z : dart) (_ : inv_hmap m) (_ : prec_i m x), @eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z) *)
intros m j x z.
(* Goal: forall (_ : inv_hmap m) (_ : prec_i m x), @eq dart (A_1 (i m x) j z) (if eq_dart_dec z x then x else A_1 m j z) *)
generalize (A_A_1_i m j x z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
tauto.
Qed.

(* A, A_1 on l: *)

Theorem A_A_1_l :
 forall (m:fmap)(k j:dim)(x y z : dart),
  inv_hmap m -> prec_lh m k x y ->
    (A (l m k x y) j z =
      if eq_dim_dec j k
      then if eq_dart_dec z x then y
           else if eq_dart_dec z (A_1 m k y)
	        then A m k x
		else A m k z
      else A m j z)
 /\ (A_1 (l m k x y) j z =
      if eq_dim_dec j k
      then if eq_dart_dec z y then x
           else if eq_dart_dec z (A m k x)
                then A_1 m k y
                else A_1 m k z
      else A_1 m j z).
Proof.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold l in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold prec_lh in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
unfold inv_hmap in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (A (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (L (L (B_1 (B m k x) k y) k x y) k (A_1 m k y) (A m k x)) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
simpl in |- *.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : and (inv_qhmap m) (forall (x0 : dart) (k0 : dim) (_ : exd m x0), and (succ m k0 x0) (pred m k0 x0))) (_ : and (exd m x) (and (exd m y) (not (@eq dart y (A m k x))))), and (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z else A (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z)) *)
intuition.
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 elim (eq_dim_dec j k).
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) j z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    rewrite a.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else if eq_dart_dec z x then y else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    elim (eq_dart_dec z x).
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite a0.
(* Goal: @eq dart (if eq_dart_dec x (A_1 m k y) then A m k x else y) y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     elim (eq_dart_dec x (A_1 m k y)).
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      elim (eq_dart_dec x (A m k x)).
(* Goal: forall _ : @eq nat x (A m k x), @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A m k x)), @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     elim (eq_dart_dec x y).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: @eq dart (A m k x) y *)
(* Goal: forall (_ : not (@eq nat x y)) (_ : @eq nat x (A m k x)), @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A m k x)), @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        rewrite <- a2.
(* Goal: @eq dart (A m k x) x *)
(* Goal: forall (_ : not (@eq nat x y)) (_ : @eq nat x (A m k x)), @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A m k x)), @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        rewrite <- a2 in a1.
        symmetry  in a3.
        symmetry  in a1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      intros.
(* Goal: @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A m k x)), @eq dart (A m k x) y *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        assert (y = A m k x).
(* Goal: @eq dart (A_1 m j y) x *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       rewrite a1.
(* Goal: @eq dart y (A m k (A_1 m k y)) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         apply A_1_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: exd m (A_1 m k y) *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        apply pred_exd_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
         intros.
(* Goal: pred m k y *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
           generalize (H2 y k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
           tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       symmetry  in |- *; tauto.
(* Goal: not (@eq dim k j) *)
     intro.
       symmetry  in |- *.
(* Goal: @eq dart (A_1 m j y) x *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       rewrite a1.
(* Goal: @eq dart y (A m k (A_1 m k y)) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       apply A_1_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: exd m (A_1 m k y) *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      apply pred_exd_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
       intros.
(* Goal: pred m k y *)
(* Goal: exd m y *)
(* Goal: @eq dart (A_1 m k y) (A_1 m k y) *)
(* Goal: forall _ : not (@eq nat x (A_1 m k y)), @eq dart y y *)
(* Goal: forall _ : not (@eq nat z x), @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         generalize (H2 y k).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
         tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: @eq dart (if eq_dart_dec z (A_1 m k y) then A m k x else A (B_1 (B m k x) k y) k z) (if eq_dart_dec z (A_1 m k y) then A m k x else A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     elim (eq_dart_dec z (A_1 m k y)).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: @eq dart (A (B_1 (B m k x) k y) k z) (A m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite A_B_1_bis.
(* Goal: @eq dart (A (B m k x) k z) (A m k z) *)
(* Goal: inv_qhmap (B m k x) *)
(* Goal: not (@eq dart z (A_1 (B m k x) k y)) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     apply A_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: @eq dart (A_1 (B m j x) j z) (A_1 m j z) *)
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     rewrite A_1_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: @eq dart (A (B_1 (B m k x) k y) j z) (A m j z) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    rewrite A_B_1_ter.
(* Goal: @eq dart (A (B m k x) j z) (A m j z) *)
(* Goal: not (@eq dim k j) *)
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
   rewrite A_B_ter.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      rewrite H3 in b; tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     rewrite H3 in b; symmetry  in H3; tauto.
(* Goal: @eq dart (if eq_dim_dec j k then if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z else if eq_dim_dec j k then if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z else A_1 (B_1 (B m k x) k y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
 elim (eq_dim_dec j k).
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: @eq dart (if eq_dart_dec z (A m k x) then A_1 m k y else if eq_dart_dec z y then x else A_1 (B_1 (B m k x) k y) j z) (if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    rewrite <- a.
(* Goal: @eq dart (if eq_dart_dec z (A m j x) then A_1 m j y else if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else if eq_dart_dec z (A m j x) then A_1 m j y else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    elim (eq_dart_dec z (A m j x)).
(* Goal: @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   elim (eq_dart_dec z y).
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    intros.
(* Goal: @eq dart (A_1 m j y) x *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      rewrite a0 in a1.
(* Goal: @eq dart (A_1 m j y) x *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      rewrite a1.
      symmetry  in |- *.
(* Goal: @eq dart x (A_1 m j (A m j x)) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      apply A_A_1.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: exd m (A m j x) *)
(* Goal: @eq dart (A m j x) (A m j x) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     apply succ_exd_A.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: succ m j x *)
(* Goal: @eq dart (A m j x) (A m j x) *)
(* Goal: forall (_ : not (@eq nat z y)) (_ : @eq nat z (A m j x)), @eq dart (A_1 m j y) (A_1 m j y) *)
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      generalize (H2 x j).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
        tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: forall _ : not (@eq nat z (A m j x)), @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
   intros.
(* Goal: @eq dart (if eq_dart_dec z y then x else A_1 (B_1 (B m j x) j y) j z) (if eq_dart_dec z y then x else A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     elim (eq_dart_dec z y).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: @eq dart (A_1 (B_1 (B m j x) j y) j z) (A_1 m j z) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
      rewrite A_1_B_1_bis.
(* Goal: @eq dart (A_1 (B m j x) j z) (A_1 m j z) *)
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     rewrite A_1_B_bis.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: inv_qhmap (B m j x) *)
(* Goal: not (@eq dart z y) *)
(* Goal: forall _ : not (@eq dim j k), @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
     apply inv_qhmap_B.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
       tauto.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     tauto.
(* Goal: not (@eq dim k j) *)
  intro.
(* Goal: @eq dart (A_1 (B_1 (B m k x) k y) j z) (A_1 m j z) *)
    rewrite A_1_B_1_ter.
(* Goal: @eq dart (A_1 (B m k x) j z) (A_1 m j z) *)
(* Goal: not (@eq dim k j) *)
   rewrite A_1_B_ter.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
    tauto.
(* Goal: not (@eq dim k j) *)
    intro.
(* Goal: False *)
(* Goal: not (@eq dim k j) *)
      rewrite H3 in b.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
      tauto.
(* Goal: not (@eq dim k j) *)
   intro.
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
     symmetry  in H3; tauto.
Qed.

(* A on l: *)

Theorem A_l :
 forall (m:fmap)(k j:dim)(x y z : dart),
  inv_hmap m -> prec_lh m k x y ->
    (A (l m k x y) j z =
      if eq_dim_dec j k
      then if eq_dart_dec z x then y
           else if eq_dart_dec z (A_1 m k y)
	        then A m k x
		else A m k z
      else A m j z).
Proof.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
intros m k j x y z.
(* Goal: forall (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
generalize (A_A_1_l m k j x y z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
tauto.
Qed.

(* A_1 on l: *)

Theorem A_1_l :
 forall (m:fmap)(k j:dim)(x y z : dart),
  inv_hmap m -> prec_lh m k x y ->
    (A_1 (l m k x y) j z =
      if eq_dim_dec j k
      then if eq_dart_dec z y then x
           else if eq_dart_dec z (A m k x)
                then A_1 m k y
                else A_1 m k z
      else A_1 m j z).
Proof.
(* Goal: forall (m : fmap) (k j : dim) (x y z : dart) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
intros m k j x y z.
(* Goal: forall (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
generalize (A_A_1_l m k j x y z).
(* Goal: forall (_ : forall (_ : inv_hmap m) (_ : prec_lh m k x y), and (@eq dart (A (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z x then y else if eq_dart_dec z (A_1 m k y) then A m k x else A m k z else A m j z)) (@eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z))) (_ : inv_hmap m) (_ : prec_lh m k x y), @eq dart (A_1 (l m k x y) j z) (if eq_dim_dec j k then if eq_dart_dec z y then x else if eq_dart_dec z (A m k x) then A_1 m k y else A_1 m k z else A_1 m j z) *)
tauto.
Qed.

(*========================================================
                     END OF PART 1
==========================================================*)
