(* 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.

(* Specifications: *)
Lemma exd_B : forall (m:fmap)(k:dim)(x y:dart), exd m y <-> exd (B m k x) y.
Lemma exd_B_r : forall (m:fmap)(k:dim)(x y:dart), exd m y -> exd (B m k x) y.
Lemma exd_B_l : forall (m:fmap)(k:dim)(x y:dart), exd (B m k x) y -> exd m y.
Lemma exd_B_1 : forall (m:fmap)(k:dim)(x y:dart), exd m y <-> exd (B_1 m k x) y.
Lemma exd_B_1_r : forall (m:fmap)(k:dim)(x y:dart), exd m y -> exd (B_1 m k x) y.
Lemma exd_B_1_l : forall (m:fmap)(k:dim)(x y:dart), exd (B_1 m k x) y -> exd m y.