(* Access to the tag of a dart: 0%nat is the nil tag *)

Fixpoint ftag(m:fmap)(x:dart){struct m}:tag:=
  match m with
      V => 0%nat
    | I m0 x0 t0 _ =>
         if eq_dart_dec x0 x then t0
	 else ftag m0 x
    | L m0 k x0 y0 => ftag m0 x
  end.(* Access to the point of a dart: (0, 0) is the nil point *)

Fixpoint fpoint(m:fmap)(x:dart){struct m}:point:=
  match m with
      V => (0%R, 0%R)
    | I m0 x0 _ p0 =>
         if eq_dart_dec x0 x then p0
	 else fpoint m0 x
    | L m0 k x0 y0 => fpoint m0 x
  end.(* 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 k0 k
          then if eq_dart_dec x0 x 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.

(* Specifications: *)
Lemma succ_dec: forall (m:fmap)(k:dim)(x:dart), {succ m k x} + {~succ m k x}.