Definition ad_monotonic (pf:ad -> ad) :=
forall a a':ad, Nless a a' = true -> Nless (pf a) (pf a') = true.

(* Specifications: *)
Lemma Ndouble_monotonic : ad_monotonic Ndouble.
Lemma Ndouble_plus_one_monotonic : ad_monotonic Ndouble_plus_one.
Lemma ad_comp_monotonic :
forall pf pf':ad -> ad,
ad_monotonic pf ->
ad_monotonic pf' -> ad_monotonic (fun a0:ad => pf (pf' a0)).
Lemma ad_comp_double_monotonic :
forall pf:ad -> ad,
ad_monotonic pf -> ad_monotonic (fun a0:ad => pf (Ndouble a0)).
Lemma ad_comp_double_plus_un_monotonic :
forall pf:ad -> ad,
ad_monotonic pf -> ad_monotonic (fun a0:ad => pf (Ndouble_plus_one a0)).
Lemma alist_of_Map_sorts_1 :
forall (m:Map A) (pf:ad -> ad),
ad_monotonic pf ->
alist_sorted_2
(MapFold1 A (alist A) (anil A) (aapp A)
(fun (a:ad) (y:A) => acons A (a, y) (anil A)) pf m).
Lemma alist_of_Map_sorts :
forall m:Map A, alist_sorted (alist_of_Map A m) = true.
Lemma alist_of_Map_sorts1 :
forall m:Map A, alist_sorted_1 (alist_of_Map A m).
Lemma alist_of_Map_sorts2 :
forall m:Map A, alist_sorted_2 (alist_of_Map A m).
Lemma alist_too_low :
forall (l:alist A) (a a':ad) (y:A),
Nless a a' = true ->
alist_sorted_2 ((a', y) :: l) ->
alist_semantics A ((a', y) :: l) a = None.
Lemma alist_semantics_nth_ad :
forall (l:alist A) (a:ad) (y:A),
alist_semantics A l a = Some y ->
{n : nat | S n <= length l /\ alist_nth_ad n l = a}.
Lemma alist_semantics_tail :
forall (l:alist A) (a:ad) (y:A),
alist_sorted_2 ((a, y) :: l) ->
eqm A (alist_semantics A l)
(fun a0:ad =>
if Neqb a a0 then None else alist_semantics A ((a, y) :: l) a0).
Lemma alist_semantics_same_tail :
forall (l l':alist A) (a:ad) (y:A),
alist_sorted_2 ((a, y) :: l) ->
alist_sorted_2 ((a, y) :: l') ->
eqm A (alist_semantics A ((a, y) :: l))
(alist_semantics A ((a, y) :: l')) ->
eqm A (alist_semantics A l) (alist_semantics A l').
Lemma alist_sorted_tail :
forall (l:alist A) (a:ad) (y:A),
alist_sorted_2 ((a, y) :: l) -> alist_sorted_2 l.
Lemma alist_canonical :
forall l l':alist A,
eqm A (alist_semantics A l) (alist_semantics A l') ->
alist_sorted_2 l -> alist_sorted_2 l' -> l = l'.