(* EXTRACTION, OK: *)

Definition P4(m:fmap)(z t:dart)(s:set):Set:=
 inv_hmap m -> exd m z -> exds s t ->
   (card s <= ndN m)%nat ->
   let sr:= Iter_rem_aux m z s in
   let nr:= Iter_upb_aux m z s in
   ~ exds sr t ->
      {i:nat | (i < nr)%nat /\ Iter (f m) i z = t}.

(* Specifications: *)
Lemma ex_i_aux :forall(m:fmap)(z t:dart)(s:set), inv_hmap m -> exd m z -> exds s t -> (card s <= ndN m)%nat -> let sr:= Iter_rem_aux m z s in let nr:= Iter_upb_aux m z s in ~ exds sr t -> {i:nat | (i < nr)%nat /\ Iter (f m) i z = t}.
Lemma ex_i :forall(m:fmap)(z t:dart), inv_hmap m -> exd m z -> exd m t -> let sr:= Iter_rem m z in let nr:= Iter_upb m z in ~ exds sr t -> {i : nat | (i < nr)%nat /\ Iter (f m) i z = t}.
Lemma ex_i_upb :forall(m:fmap)(z:dart), inv_hmap m -> exd m z -> let nr:= Iter_upb m z in {i : nat | (i < nr)%nat /\ Iter (f m) i z = Iter (f m) nr z}.
Lemma Iter_plus:forall(m:fmap)(z:dart)(p i:nat), inv_hmap m -> exd m z -> Iter (f m) (p + i)%nat z = Iter (f m) i z -> Iter (f m) p z = z.
Lemma Iter_plus_inv:forall(m:fmap)(z:dart)(p i:nat), inv_hmap m -> exd m z -> Iter (f m) p z = z -> Iter (f m) (p + i)%nat z = Iter (f m) i z.
Lemma Iter_mult:forall(m:fmap)(z:dart)(n p:nat), inv_hmap m -> exd m z -> Iter (f m) p z = z -> Iter (f m) (n*p)%nat z = z.
Lemma Iter_plus_mult:forall(m:fmap)(z:dart)(n p i:nat), inv_hmap m -> exd m z -> Iter (f m) p z = z -> Iter (f m) (i + n*p)%nat z = Iter (f m) i z.
Lemma Iter_comp:forall(m:fmap)(i j:nat)(z:dart), Iter (f m) (i+j)%nat z = Iter (f m) i (Iter (f m) j z).
Lemma f_1_Iter_f:forall(m:fmap)(i:nat)(z:dart), inv_hmap m -> exd m z -> (f_1 m) (Iter (f m) (S i) z) = Iter (f m) i z.
Lemma Iter_f_f_1 :forall(m:fmap)(i j:nat)(z:dart), inv_hmap m -> exd m z -> (j <= i)%nat -> Iter (f_1 m) j (Iter (f m) i z) = Iter (f m) (i - j)%nat z.
Lemma Iter_f_f_1_i:forall(m:fmap)(i:nat)(z:dart), inv_hmap m -> exd m z -> Iter (f_1 m) i (Iter (f m) i z) = z.
Lemma Iter_f_Si:forall(m:fmap)(i:nat)(z:dart), inv_hmap m -> exd m z -> Iter (f m) (S i) z = Iter (f m) i (f m z).
Lemma Iter_f_1_Si:forall(m:fmap)(i:nat)(z:dart), inv_hmap m -> exd m z -> Iter (f_1 m) (S i) z = Iter (f_1 m) i (f_1 m z).