(* This file was originally generated by why.
   It can be modified; only the generated parts will be overwritten. *)

Require Import Why.

(* Why obligation from file "csearch.c", characters 233-237 *)
Lemma index_po_1 : 
  forall (n: Z),
  forall (v: Z),
  forall (t: (array Z)),
  forall (Pre5: (array_length t) = n),
  forall (i: Z),
  forall (Post4: i = 0),
  forall (Variant1: Z),
  forall (i1: Z),
  forall (Pre4: Variant1 = (n - i1)),
  forall (Pre3: 0 <= i1 /\
                (forall (k:Z), (0 <= k /\ k < i1 -> (access t k) <> v))),
  forall (Test2: i1 < n),
  0 <= i1 /\ i1 < (array_length t).
Proof.
intuition.
Qed.

(* Why obligation from file "csearch.c", characters 233-242 *)
Lemma index_po_2 : 
  forall (n: Z),
  forall (v: Z),
  forall (t: (array Z)),
  forall (Pre5: (array_length t) = n),
  forall (i: Z),
  forall (Post4: i = 0),
  forall (Variant1: Z),
  forall (i1: Z),
  forall (Pre4: Variant1 = (n - i1)),
  forall (Pre3: 0 <= i1 /\
                (forall (k:Z), (0 <= k /\ k < i1 -> (access t k) <> v))),
  forall (Test2: i1 < n),
  forall (Pre2: 0 <= i1 /\ i1 < (array_length t)),
  forall (c_aux_1: Z),
  forall (Post1: c_aux_1 = (access t i1)),
  forall (result0: bool),
  forall (Post14: (if result0 then c_aux_1 = v else c_aux_1 <> v)),
  (if result0 then (0 <= i1 /\ i1 < n -> (access t i1) = v)
   else (forall (i:Z),
         (i = (i1 + 1) -> (0 <= i /\
          (forall (k:Z), (0 <= k /\ k < i -> (access t k) <> v))) /\
          (Zwf 0 (n - i) (n - i1))))).
Proof.
simple_destruct result0; intuition.
assert (k = i1 \/ (k < i1)%Z).
 omega.
 intuition.
subst k c_aux_1; auto.
apply (H0 k); auto with *.
Qed.

(* Why obligation from file "csearch.c", characters 150-198 *)
Lemma index_po_3 : 
  forall (n: Z),
  forall (v: Z),
  forall (t: (array Z)),
  forall (Pre5: (array_length t) = n),
  forall (i: Z),
  forall (Post4: i = 0),
  0 <= i /\ (forall (k:Z), (0 <= k /\ k < i -> (access t k) <> v)).
Proof.
intuition.
Qed.

(* Why obligation from file "csearch.c", characters 116-263 *)
Lemma index_po_4 : 
  forall (n: Z),
  forall (v: Z),
  forall (t: (array Z)),
  forall (Pre5: (array_length t) = n),
  forall (i: Z),
  forall (Post4: i = 0),
  forall (i1: Z),
  forall (Post3: (0 <= i1 /\
                 (forall (k:Z), (0 <= k /\ k < i1 -> (access t k) <> v))) /\
                 i1 >= n),
  (0 <= i1 /\ i1 < n -> (access t i1) = v).
Proof.
intuition.
Qed.


(* Why obligation from file "csearch.c", characters 566-570 *)
Lemma index2_po_1 : 
  forall (n: Z),
  forall (v: Z),
  forall (t: (array Z)),
  forall (Pre5: (array_length t) = n),
  forall (i: Z),
  forall (Post4: i = 0),
  forall (Variant1: Z),
  forall (i1: Z),
  forall (Pre4: Variant1 = (n - i1)),
  forall (Pre3: 0 <= i1 /\
                (forall (k:Z), (0 <= k /\ k < i1 -> (access t k) <> v))),
  forall (Test2: i1 < n),
  0 <= i1 /\ i1 < (array_length t).
Proof.
intuition.
Qed.

(* Why obligation from file "csearch.c", characters 566-575 *)
Lemma index2_po_2 : 
  forall (n: Z),
  forall (v: Z),
  forall (t: (array Z)),
  forall (Pre5: (array_length t) = n),
  forall (i: Z),
  forall (Post4: i = 0),
  forall (Variant1: Z),
  forall (i1: Z),
  forall (Pre4: Variant1 = (n - i1)),
  forall (Pre3: 0 <= i1 /\
                (forall (k:Z), (0 <= k /\ k < i1 -> (access t k) <> v))),
  forall (Test2: i1 < n),
  forall (Pre2: 0 <= i1 /\ i1 < (array_length t)),
  forall (c_aux_2: Z),
  forall (Post1: c_aux_2 = (access t i1)),
  forall (result0: bool),
  forall (Post15: (if result0 then c_aux_2 = v else c_aux_2 <> v)),
  (if result0 then (0 <= i1 /\ i1 < n -> (access t i1) = v)
   else (forall (i:Z),
         (i = (i1 + 1) -> (0 <= i /\
          (forall (k:Z), (0 <= k /\ k < i -> (access t k) <> v))) /\
          (Zwf 0 (n - i) (n - i1))))).
Proof.
simple_destruct result0; intuition.
assert (k = i1 \/ (k < i1)%Z).
 omega.
 intuition.
subst k c_aux_2; auto.
apply (H0 k); auto with *.
Qed.

(* Why obligation from file "csearch.c", characters 483-531 *)
Lemma index2_po_3 : 
  forall (n: Z),
  forall (v: Z),
  forall (t: (array Z)),
  forall (Pre5: (array_length t) = n),
  forall (i: Z),
  forall (Post4: i = 0),
  0 <= i /\ (forall (k:Z), (0 <= k /\ k < i -> (access t k) <> v)).
Proof.
intuition.
Qed.

(* Why obligation from file "csearch.c", characters 609-610 *)
Lemma index2_po_4 : 
  forall (n: Z),
  forall (v: Z),
  forall (t: (array Z)),
  forall (Pre5: (array_length t) = n),
  forall (i: Z),
  forall (Post4: i = 0),
  forall (i1: Z),
  forall (Post3: (0 <= i1 /\
                 (forall (k:Z), (0 <= k /\ k < i1 -> (access t k) <> v))) /\
                 i1 >= n),
  (0 <= n /\ n < n -> (access t n) = v).
Proof.
intuition.
Qed.

