(* degree OF A CELL: OK! *)

Function degree_aux(m:fmap)(z:dart)(n:nat)
   {measure (fun i:nat => ndN m - i) n}:nat:=
  if le_lt_dec n (ndN m) 
  then if eq_dart_dec z (Iter (f m) n z) then n
       else if eq_nat_dec n (ndN m) then (ndN m) + 1 
            else degree_aux m z (n+1)
  else (ndN m) + 1.Definition degree(m:fmap)(z:dart):= 
  degree_aux m z 1.Definition P_degree_pos(m:fmap)(z:dart)(n1 n2:nat):
  Prop:= exd m z -> 0 < n1 -> 0 < n2.

(* Specifications: *)
Lemma degree_pos_aux:forall(m:fmap)(z:dart), P_degree_pos m z 1 (degree m z).
Theorem degree_pos:forall(m:fmap)(z:dart), exd m z -> 0 < degree m z.