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

Require Export search_spec_why.

(* Why obligation from file "/home/cmarche/recherche/why/examples-c/tutorial/search.c", line 8, characters 16-64: *)
(*Why goal*) Lemma index_impl_po_1 : 
  forall (t: (pointer global)),
  forall (n: Z),
  forall (v: Z),
  forall (alloc: alloc_table),
  forall (intM_global: (memory Z global)),
  forall (HW_1: (* CADUCEUS_1 *) (valid_range alloc t 0 (n - 1))),
  (* CADUCEUS_3 *) (0 <= 0 /\
  (forall (k:Z), (0 <= k /\ k < 0 -> (acc intM_global (shift t k)) <> v))).
Proof.
intuition.
Save.

(* Why obligation from file "/home/cmarche/recherche/why/examples-c/tutorial/search.c", line 11, characters 8-12: *)
(*Why goal*) Lemma index_impl_po_2 : 
  forall (t: (pointer global)),
  forall (n: Z),
  forall (v: Z),
  forall (alloc: alloc_table),
  forall (intM_global: (memory Z global)),
  forall (HW_1: (* CADUCEUS_1 *) (valid_range alloc t 0 (n - 1))),
  forall (i: Z),
  forall (HW_2: (* CADUCEUS_3 *) (0 <= i /\
                (forall (k:Z),
                 (0 <= k /\ k < i -> (acc intM_global (shift t k)) <> v)))),
  forall (HW_3: i < n),
  forall (result: (pointer global)),
  forall (HW_4: result = (shift t i)),
  (valid alloc result).
Proof.
intuition; subst; auto.
Save.

(* Why obligation from file "/home/cmarche/recherche/why/examples-c/tutorial/search.c", line 3, characters 4-105: *)
(*Why goal*) Lemma index_impl_po_3 : 
  forall (t: (pointer global)),
  forall (n: Z),
  forall (v: Z),
  forall (alloc: alloc_table),
  forall (intM_global: (memory Z global)),
  forall (HW_1: (* CADUCEUS_1 *) (valid_range alloc t 0 (n - 1))),
  forall (i: Z),
  forall (HW_2: (* CADUCEUS_3 *) (0 <= i /\
                (forall (k:Z),
                 (0 <= k /\ k < i -> (acc intM_global (shift t k)) <> v)))),
  forall (HW_3: i < n),
  forall (result: (pointer global)),
  forall (HW_4: result = (shift t i)),
  forall (HW_5: (valid alloc result)),
  forall (result0: Z),
  forall (HW_6: result0 = (acc intM_global result)),
  forall (HW_7: result0 = v),
  (* CADUCEUS_2 *)
  (((0 <= i /\ i < n -> (acc intM_global (shift t i)) = v)) /\
  ((i = n ->
    (forall (i:Z), (0 <= i /\ i < n -> (acc intM_global (shift t i)) <> v))))).
Proof.
intuition.
subst;auto.
Save.

(* Why obligation from file "/home/cmarche/recherche/why/examples-c/tutorial/search.c", line 8, characters 16-64: *)
(*Why goal*) Lemma index_impl_po_4 : 
  forall (t: (pointer global)),
  forall (n: Z),
  forall (v: Z),
  forall (alloc: alloc_table),
  forall (intM_global: (memory Z global)),
  forall (HW_1: (* CADUCEUS_1 *) (valid_range alloc t 0 (n - 1))),
  forall (i: Z),
  forall (HW_2: (* CADUCEUS_3 *) (0 <= i /\
                (forall (k:Z),
                 (0 <= k /\ k < i -> (acc intM_global (shift t k)) <> v)))),
  forall (HW_3: i < n),
  forall (result: (pointer global)),
  forall (HW_4: result = (shift t i)),
  forall (HW_5: (valid alloc result)),
  forall (result0: Z),
  forall (HW_6: result0 = (acc intM_global result)),
  forall (HW_8: result0 <> v),
  forall (i0: Z),
  forall (HW_9: i0 = (i + 1)),
  (* CADUCEUS_3 *) (0 <= i0 /\
  (forall (k:Z), (0 <= k /\ k < i0 -> (acc intM_global (shift t k)) <> v))).
Proof.
intuition.
assert (h : k<i \/ k=i); [ omega | inversion_clear h].
(* case k < i *)
apply (H0 k); auto.
(* case k=i *)
subst; auto.
Save.

(* Why obligation from file "/home/cmarche/recherche/why/examples-c/tutorial/search.c", line 9, characters 14-19: *)
(*Why goal*) Lemma index_impl_po_5 : 
  forall (t: (pointer global)),
  forall (n: Z),
  forall (v: Z),
  forall (alloc: alloc_table),
  forall (intM_global: (memory Z global)),
  forall (HW_1: (* CADUCEUS_1 *) (valid_range alloc t 0 (n - 1))),
  forall (i: Z),
  forall (HW_2: (* CADUCEUS_3 *) (0 <= i /\
                (forall (k:Z),
                 (0 <= k /\ k < i -> (acc intM_global (shift t k)) <> v)))),
  forall (HW_3: i < n),
  forall (result: (pointer global)),
  forall (HW_4: result = (shift t i)),
  forall (HW_5: (valid alloc result)),
  forall (result0: Z),
  forall (HW_6: result0 = (acc intM_global result)),
  forall (HW_8: result0 <> v),
  forall (i0: Z),
  forall (HW_9: i0 = (i + 1)),
  (Zwf 0 ((* CADUCEUS_4 *) (n - i0)) ((* CADUCEUS_4 *) (n - i))).
Proof.
intuition.
apply H0 with i0; auto with *.
Save.
(* Why obligation from file "/home/cmarche/recherche/why/examples-c/tutorial/search.c", line 3, characters 4-105: *)
(*Why goal*) Lemma index_impl_po_6 : 
  forall (t: (pointer global)),
  forall (n: Z),
  forall (v: Z),
  forall (alloc: alloc_table),
  forall (intM_global: (memory Z global)),
  forall (HW_1: (* CADUCEUS_1 *) (valid_range alloc t 0 (n - 1))),
  forall (i: Z),
  forall (HW_2: (* CADUCEUS_3 *) (0 <= i /\
                (forall (k:Z),
                 (0 <= k /\ k < i -> (acc intM_global (shift t k)) <> v)))),
  forall (HW_10: i >= n),
  (* CADUCEUS_2 *)
  (((0 <= i /\ i < n -> (acc intM_global (shift t i)) = v)) /\
  ((i = n ->
    (forall (i:Z), (0 <= i /\ i < n -> (acc intM_global (shift t i)) <> v))))).
Proof.
intuition.
(* FILL PROOF HERE *)
Save.

