Require Import VST.floyd.proofauto.
Require Import VST.progs.revarray.
Require Import VST.floyd.sublist.

Instance CompSpecs : compspecs. make_compspecs prog. Defined.
Definition Vprog : varspecs. mk_varspecs prog. Defined.

Definition reverse_spec :=
 DECLARE _reverse
  WITH a0: val, sh : share, contents : list int, size: Z
  PRE [ _a OF (tptr tint), _n OF tint ]
          PROP (0 <= size <= Int.max_signed; writable_share sh)
          LOCAL (temp _a a0; temp _n (Vint (Int.repr size)))
          SEP (data_at sh (tarray tint size) (map Vint contents) a0)
  POST [ tvoid ]
     PROP() LOCAL()
     SEP(data_at sh (tarray tint size) (map Vint (rev contents)) a0).

Definition main_spec :=
 DECLARE _main
  WITH gv : globals
  PRE  [] main_pre prog nil gv
  POST [ tint ] main_post prog nil gv.

Definition Gprog : funspecs :=   ltac:(with_library prog [reverse_spec; main_spec]).

(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr j))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size j)))) (@nil localdef))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) a0) (@nil mpred)))))) (local (@liftx (LiftEnviron Prop) (tc_val tint (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))))) *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr j))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size j)))) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) a0) (@nil mpred))))) (Ssequence (Sassign (Ederef (Ebinop Oadd (Etempvar _a (tptr tint)) (Ebinop Osub (Etempvar _hi tint) (Econst_int (Int.repr (Zpos xH)) tint) tint) (tptr tint)) tint) (Etempvar _t tint)) MORE_COMMANDS) POSTCONDITION *)
Definition flip_ends {A} lo hi (contents: list A) :=
  sublist 0 lo (rev contents)
  ++ sublist lo hi contents
  ++ sublist hi (Zlength contents) (rev contents).

Definition reverse_Inv a0 sh contents size :=
 (EX j:Z,
  (PROP  (0 <= j; j <= size-j)
   LOCAL  (temp _a a0; temp _lo (Vint (Int.repr j)); temp _hi (Vint (Int.repr (size-j))))
   SEP (data_at sh (tarray tint size) (flip_ends j (size-j) contents) a0)))%assert.


Lemma Zlength_flip_ends:
 forall A i j (al: list A),
 0 <= i  -> i<=j -> j <= Zlength al ->
 Zlength (flip_ends i j al) = Zlength al.
Proof.
(* Goal: forall (A : Type) (d : Inhabitant A) (al : list A) (size j : Z) (_ : @eq Z (@Zlength A al) size) (_ : Z.lt j (Z.sub (Z.sub size j) (Zpos xH))) (_ : Z.le Z0 j), @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends A j (Z.sub size j) al)) *)
intros.
(* Goal: @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends A j (Z.sub size j) al)) *)
unfold flip_ends.
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (Z.sub (Z.sub (Z.sub size j) (Zpos xH)) Z0) (Z.add (Z.sub (Z.add j (Zpos xH)) j) (Z.sub size (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
autorewrite with sublist. omega.
Qed.
Hint Rewrite @Zlength_flip_ends using (autorewrite with sublist; omega) : sublist.

Lemma flip_fact_1: forall A size (contents: list A) j,
  Zlength contents = size ->
  0 <= j ->
  size - j - 1 <= j <= size - j ->
  flip_ends j (size - j) contents = rev contents.
Proof.
(* Goal: forall (A : Type) (d : Inhabitant A) (al : list A) (size j : Z) (_ : @eq Z (@Zlength A al) size) (_ : Z.lt j (Z.sub (Z.sub size j) (Zpos xH))) (_ : Z.le Z0 j), @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends A j (Z.sub size j) al)) *)
  intros.
(* Goal: @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends A j (Z.sub size j) al)) *)
  unfold flip_ends.
  rewrite <- (Zlen_le_1_rev (sublist j (size-j) contents))
      by (autorewrite with sublist; omega).
(* Goal: @eq (list A) (@app A (@sublist A Z0 j (@rev A contents)) (@app A (@rev A (@sublist A j (Z.sub size j) contents)) (@sublist A (Z.sub size j) (@Zlength A contents) (@rev A contents)))) (@rev A contents) *)
  rewrite !sublist_rev by (autorewrite with sublist; omega).
(* Goal: @eq (list A) (@app A (@rev A (@sublist A (Z.sub (@Zlength A contents) j) (Z.sub (@Zlength A contents) Z0) contents)) (@app A (@rev A (@sublist A j (Z.sub size j) contents)) (@rev A (@sublist A (Z.sub (@Zlength A contents) (@Zlength A contents)) (Z.sub (@Zlength A contents) (Z.sub size j)) contents)))) (@rev A contents) *)
 rewrite <- !rev_app_distr, ?H.
(* Goal: @eq (list A) (@rev A (@app A (@app A (@sublist A (Z.sub size size) (Z.sub size (Z.sub size j)) contents) (@sublist A j (Z.sub size j) contents)) (@sublist A (Z.sub size j) (Z.sub size Z0) contents))) (@rev A contents) *)
 autorewrite with sublist; auto.
Qed.

Lemma flip_fact_3:
 forall A (al: list A) j size,
  size = Zlength al ->
  0 <= j < size - j - 1 ->
sublist 0 j (flip_ends j (size - j) al) ++
sublist (size - j - 1) (size - j) al ++
sublist (j + 1) size
  (sublist 0 (size - j - 1) (flip_ends j (size - j) al) ++
   sublist j (j + 1) (flip_ends j (size - j) al) ++
   sublist (size - j) size (flip_ends j (size - j) al)) =
flip_ends (j + 1) (size - (j + 1)) al.
Proof.
(* Goal: forall (A : Type) (d : Inhabitant A) (al : list A) (size j : Z) (_ : @eq Z (@Zlength A al) size) (_ : Z.lt j (Z.sub (Z.sub size j) (Zpos xH))) (_ : Z.le Z0 j), @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends A j (Z.sub size j) al)) *)
intros.
(* Goal: @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends A j (Z.sub size j) al)) *)
unfold flip_ends.
(* Goal: @eq (list A) (@app A (@sublist A Z0 j (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) (@Zlength A al) (@rev A al))))) (@app A (@sublist A (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist A (Z.add j (Zpos xH)) size (@app A (@sublist A Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) (@Zlength A al) (@rev A al))))) (@app A (@sublist A j (Z.add j (Zpos xH)) (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) (@Zlength A al) (@rev A al))))) (@sublist A (Z.sub size j) size (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) (@Zlength A al) (@rev A al)))))))))) (@app A (@sublist A Z0 (Z.add j (Zpos xH)) (@rev A al)) (@app A (@sublist A (Z.add j (Zpos xH)) (Z.sub size (Z.add j (Zpos xH))) al) (@sublist A (Z.sub size (Z.add j (Zpos xH))) (@Zlength A al) (@rev A al)))) *)
rewrite <- H.
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (Z.sub (Z.sub (Z.sub size j) (Zpos xH)) Z0) (Z.add (Z.sub (Z.add j (Zpos xH)) j) (Z.sub size (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
autorewrite with sublist.
(* Goal: @eq (list A) (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist A (Z.add j (Zpos xH)) size (@app A (@sublist A Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) size (@rev A al))))) (@app A (@sublist A j (Z.add j (Zpos xH)) (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) size (@rev A al))))) (@sublist A (Z.sub size j) size (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) size (@rev A al)))))))))) (@app A (@sublist A Z0 (Z.add j (Zpos xH)) (@rev A al)) (@app A (@sublist A (Z.add j (Zpos xH)) (Z.sub size (Z.add j (Zpos xH))) al) (@sublist A (Z.sub size (Z.add j (Zpos xH))) size (@rev A al)))) *)
rewrite (sublist_split 0 j (j+1)) by (autorewrite with sublist; omega).
(* Goal: @eq (list A) (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist A (Z.add j (Zpos xH)) size (@app A (@sublist A Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) size (@rev A al))))) (@app A (@sublist A j (Z.add j (Zpos xH)) (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) size (@rev A al))))) (@sublist A (Z.sub size j) size (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) size (@rev A al)))))))))) (@app A (@app A (@sublist A Z0 j (@rev A al)) (@sublist A j (Z.add j (Zpos xH)) (@rev A al))) (@app A (@sublist A (Z.add j (Zpos xH)) (Z.sub size (Z.add j (Zpos xH))) al) (@sublist A (Z.sub size (Z.add j (Zpos xH))) size (@rev A al)))) *)
rewrite !app_ass.
(* Goal: @eq mpred (@field_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@nil gfield) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)))) (Vint (@Znth Int.int Inhabitant_int (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) contents))) a0) (@field_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@nil gfield) (@flip_ends val (Z.succ j) (Z.sub (@Zlength val (@map Int.int val Vint contents)) (Z.succ j)) (@map Int.int val Vint contents)) a0) *)
f_equal. f_equal.
(* Goal: @eq Z (Z.add i (Z.add (Z.sub j i) (Z.sub (@Zlength A al) j))) (@Zlength A al) *)
rewrite !sublist_rev, <- ?H by omega.
(* Goal: @eq (list A) (@sublist A (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@rev A (@sublist A (Z.sub size (Z.add j (Zpos xH))) (Z.sub size j) al)) *)
(* Goal: @eq (list A) (@sublist A (Z.add j (Zpos xH)) size (@app A (@sublist A Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) size (@rev A al))))) (@app A (@sublist A j (Z.add j (Zpos xH)) (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) size (@rev A al))))) (@sublist A (Z.sub size j) size (@app A (@sublist A Z0 j (@rev A al)) (@app A (@sublist A j (Z.sub size j) al) (@sublist A (Z.sub size j) size (@rev A al)))))))) (@app A (@sublist A (Z.add j (Zpos xH)) (Z.sub size (Z.add j (Zpos xH))) al) (@sublist A (Z.sub size (Z.add j (Zpos xH))) size (@rev A al))) *)
rewrite Zlen_le_1_rev by (autorewrite with sublist; omega).
(* Goal: @eq Z (Z.add i (Z.add (Z.sub j i) (Z.sub (@Zlength A al) j))) (@Zlength A al) *)
f_equal; omega.
rewrite (sublist_app2 (size-j) size)
 by (autorewrite with sublist; omega).
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (Z.sub (Z.sub (Z.sub size j) (Zpos xH)) Z0) (Z.add (Z.sub (Z.add j (Zpos xH)) j) (Z.sub size (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
autorewrite with sublist.
rewrite sublist_app'
 by (autorewrite with sublist; omega).
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (Z.sub (Z.sub (Z.sub size j) (Zpos xH)) Z0) (Z.add (Z.sub (Z.add j (Zpos xH)) j) (Z.sub size (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
autorewrite with sublist.
(* Goal: @eq mpred (@field_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@nil gfield) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)))) (Vint (@Znth Int.int Inhabitant_int (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) contents))) a0) (@field_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@nil gfield) (@flip_ends val (Z.succ j) (Z.sub (@Zlength val (@map Int.int val Vint contents)) (Z.succ j)) (@map Int.int val Vint contents)) a0) *)
f_equal.
(* Goal: @eq Z (Z.add i (Z.add (Z.sub j i) (Z.sub (@Zlength A al) j))) (@Zlength A al) *)
f_equal; omega.
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (Z.sub (Z.sub (Z.sub size j) (Zpos xH)) Z0) (Z.add (Z.sub (Z.add j (Zpos xH)) j) (Z.sub size (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
autorewrite with sublist.
  rewrite <- (Zlen_le_1_rev (sublist j (1+j) al))
      by (autorewrite with sublist; omega).
(* Goal: @eq Z (Z.add i (Z.add (Z.sub j i) (Z.sub (@Zlength A al) j))) (@Zlength A al) *)
rewrite !sublist_rev, <- ?H by omega.
(* Goal: @eq (list A) (@app A (@rev A (@sublist A j (Z.add (Zpos xH) j) al)) (@rev A (@sublist A (Z.sub size (Z.add j (Z.sub size j))) (Z.sub size (Z.sub size j)) al))) (@rev A (@sublist A (Z.sub size size) (Z.sub size (Z.sub size (Z.add j (Zpos xH)))) al)) *)
 rewrite <- !rev_app_distr, <- ?H.
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (Z.sub (Z.sub (Z.sub size j) (Zpos xH)) Z0) (Z.add (Z.sub (Z.add j (Zpos xH)) j) (Z.sub size (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
 autorewrite with sublist.
(* Goal: @eq Z (Z.add i (Z.add (Z.sub j i) (Z.sub (@Zlength A al) j))) (@Zlength A al) *)
 f_equal; f_equal; omega.
Qed.

Lemma flip_ends_map:
  forall A B (F: A -> B) lo hi (al: list A),
  flip_ends lo hi (map F al) = map F (flip_ends lo hi al).
Proof.
(* Goal: forall (A : Type) (d : Inhabitant A) (al : list A) (size j : Z) (_ : @eq Z (@Zlength A al) size) (_ : Z.lt j (Z.sub (Z.sub size j) (Zpos xH))) (_ : Z.le Z0 j), @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends A j (Z.sub size j) al)) *)
intros.
(* Goal: @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends A j (Z.sub size j) al)) *)
unfold flip_ends.
(* Goal: @eq (list B) (@app B (@sublist B Z0 lo (@rev B (@map A B F al))) (@app B (@sublist B lo hi (@map A B F al)) (@sublist B hi (@Zlength B (@map A B F al)) (@rev B (@map A B F al))))) (@map A B F (@app A (@sublist A Z0 lo (@rev A al)) (@app A (@sublist A lo hi al) (@sublist A hi (@Zlength A al) (@rev A al))))) *)
rewrite !map_app.
(* Goal: @eq (list B) (@app B (@sublist B Z0 lo (@rev B (@map A B F al))) (@app B (@sublist B lo hi (@map A B F al)) (@sublist B hi (@Zlength B (@map A B F al)) (@rev B (@map A B F al))))) (@app B (@map A B F (@sublist A Z0 lo (@rev A al))) (@app B (@map A B F (@sublist A lo hi al)) (@map A B F (@sublist A hi (@Zlength A al) (@rev A al))))) *)
rewrite !map_sublist, !map_rev, Zlength_map.
(* Goal: @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) *)
auto.
Qed.

Lemma flip_fact_2:
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr j))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size j)))) (@nil localdef))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) a0) (@nil mpred)))))) (local (@liftx (LiftEnviron Prop) (tc_val tint (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))))) *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr j))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size j)))) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) a0) (@nil mpred))))) (Ssequence (Sassign (Ederef (Ebinop Oadd (Etempvar _a (tptr tint)) (Ebinop Osub (Etempvar _hi tint) (Econst_int (Int.repr (Zpos xH)) tint) tint) (tptr tint)) tint) (Etempvar _t tint)) MORE_COMMANDS) POSTCONDITION *)
  forall {A}{d: Inhabitant A} (al: list A) size j,
 Zlength al = size ->
  j < size - j - 1 ->
   0 <= j ->
  Znth (size - j - 1) al =
  Znth (size - j - 1) (flip_ends j (size - j) al).
Proof.
(* Goal: forall (A : Type) (d : Inhabitant A) (al : list A) (size j : Z) (_ : @eq Z (@Zlength A al) size) (_ : Z.lt j (Z.sub (Z.sub size j) (Zpos xH))) (_ : Z.le Z0 j), @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends A j (Z.sub size j) al)) *)
intros.
(* Goal: @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends A j (Z.sub size j) al)) *)
unfold flip_ends.
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (Z.sub (Z.sub (Z.sub size j) (Zpos xH)) Z0) (Z.add (Z.sub (Z.add j (Zpos xH)) j) (Z.sub size (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
autorewrite with sublist. auto.
Qed.

Lemma body_reverse: semax_body Vprog Gprog f_reverse reverse_spec.
Proof.
(* Goal: semax_body Vprog Gprog CompSpecs f_main main_spec *)
start_function.
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint four_contents) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
forward.  (* lo = 0; *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint four_contents) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
forward. (* hi = n; *)

assert_PROP (Zlength (map Vint contents) = size)
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _hi (Vint (Int.sub (Int.repr (Z.sub size j)) (Int.repr (Zpos xH))))) (@cons localdef (temp _lo (Vint (Int.add (Int.repr j) (Int.repr (Zpos xH))))) (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub size j) (@map Int.int val Vint contents)))) (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) a0) (@nil mpred)))))) (PROPx (@cons Prop (Z.le Z0 (Z.succ j)) (@cons Prop (Z.le (Z.succ j) (Z.sub size (Z.succ j))) (@nil Prop))) (LOCALx (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr (Z.succ j)))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size (Z.succ j))))) (@nil localdef)))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) (Z.succ j) (Z.sub size (Z.succ j)) (@map Int.int val Vint contents)) a0) (@nil mpred))))) *)
    as ZL by entailer!.
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _hi (Vint (Int.repr size))) (@cons localdef (temp _lo (Vint (Int.repr Z0))) (@cons localdef (temp _a a0) (@cons localdef (temp _n (Vint (Int.repr size))) (@nil localdef))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@map Int.int val Vint contents) a0) (@nil mpred))))) (Ssequence (Swhile (Ebinop Olt (Etempvar _lo tint) (Ebinop Osub (Etempvar _hi tint) (Econst_int (Int.repr (Zpos xH)) tint) tint) tint) LOOP_BODY) MORE_COMMANDS) POSTCONDITION *)
forward_while (reverse_Inv a0 sh (map Vint contents) size).
* (* Prove that current precondition implies loop invariant *)
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _hi (Vint (Int.repr size))) (@cons localdef (temp _lo (Vint (Int.repr Z0))) (@cons localdef (temp _a a0) (@cons localdef (temp _n (Vint (Int.repr size))) (@nil localdef))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@map Int.int val Vint contents) a0) (@nil mpred)))))) (@exp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) Z (fun j : Z => PROPx (@cons Prop (Z.le Z0 j) (@cons Prop (Z.le j (Z.sub size j)) (@nil Prop))) (LOCALx (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr j))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size j)))) (@nil localdef)))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) a0) (@nil mpred)))))) *)
Exists 0.
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _hi (Vint (Int.sub (Int.repr (Z.sub size j)) (Int.repr (Zpos xH))))) (@cons localdef (temp _lo (Vint (Int.add (Int.repr j) (Int.repr (Zpos xH))))) (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub size j) (@map Int.int val Vint contents)))) (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) a0) (@nil mpred)))))) (PROPx (@cons Prop (Z.le Z0 (Z.succ j)) (@cons Prop (Z.le (Z.succ j) (Z.sub size (Z.succ j))) (@nil Prop))) (LOCALx (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr (Z.succ j)))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size (Z.succ j))))) (@nil localdef)))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) (Z.succ j) (Z.sub size (Z.succ j)) (@map Int.int val Vint contents)) a0) (@nil mpred))))) *)
entailer!.
(* Goal: @eq (list A) (@rev A (@app A (@app A (@sublist A (Z.sub size size) (Z.sub size (Z.sub size j)) contents) (@sublist A j (Z.sub size j) contents)) (@sublist A (Z.sub size j) (Z.sub size Z0) contents))) (@rev A contents) *)
unfold flip_ends; autorewrite with sublist; auto.
* (* Prove that loop invariant implies typechecking condition *)
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _hi (Vint (Int.sub (Int.repr (Z.sub size j)) (Int.repr (Zpos xH))))) (@cons localdef (temp _lo (Vint (Int.add (Int.repr j) (Int.repr (Zpos xH))))) (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub size j) (@map Int.int val Vint contents)))) (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) a0) (@nil mpred)))))) (PROPx (@cons Prop (Z.le Z0 (Z.succ j)) (@cons Prop (Z.le (Z.succ j) (Z.sub size (Z.succ j))) (@nil Prop))) (LOCALx (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr (Z.succ j)))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size (Z.succ j))))) (@nil localdef)))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) (Z.succ j) (Z.sub size (Z.succ j)) (@map Int.int val Vint contents)) a0) (@nil mpred))))) *)
entailer!.
* (* Prove that loop body preserves invariant *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint four_contents) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
forward. (* t = a[lo]; *)
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr j))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size j)))) (@nil localdef))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) a0) (@nil mpred)))))) (local (@liftx (LiftEnviron Prop) (tc_val tint (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))))) *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr j))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size j)))) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) a0) (@nil mpred))))) (Ssequence (Sassign (Ederef (Ebinop Oadd (Etempvar _a (tptr tint)) (Ebinop Osub (Etempvar _hi tint) (Econst_int (Int.repr (Zpos xH)) tint) tint) (tptr tint)) tint) (Etempvar _t tint)) MORE_COMMANDS) POSTCONDITION *)
{
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _hi (Vint (Int.sub (Int.repr (Z.sub size j)) (Int.repr (Zpos xH))))) (@cons localdef (temp _lo (Vint (Int.add (Int.repr j) (Int.repr (Zpos xH))))) (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub size j) (@map Int.int val Vint contents)))) (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) a0) (@nil mpred)))))) (PROPx (@cons Prop (Z.le Z0 (Z.succ j)) (@cons Prop (Z.le (Z.succ j) (Z.sub size (Z.succ j))) (@nil Prop))) (LOCALx (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr (Z.succ j)))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size (Z.succ j))))) (@nil localdef)))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) (Z.succ j) (Z.sub size (Z.succ j)) (@map Int.int val Vint contents)) a0) (@nil mpred))))) *)
  entailer!.
(* Goal: is_int I32 Signed (@Znth val Vundef j (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents))) *)
  clear - H0 HRE.
  autorewrite with sublist in *|-*.
(* Goal: is_int I32 Signed (@Znth val Vundef (Z.sub (Z.sub (@Zlength Int.int contents) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength Int.int contents) j) (@map Int.int val Vint contents))) *)
  rewrite flip_ends_map.
(* Goal: is_int I32 Signed (@Znth val Vundef (Z.sub (Z.sub (@Zlength Int.int contents) j) (Zpos xH)) (@map Int.int val Vint (@flip_ends Int.int j (Z.sub (@Zlength Int.int contents) j) contents))) *)
  rewrite Znth_map by list_solve.
(* Goal: is_int I32 Signed (Vint (@Znth Int.int Inhabitant_int (Z.sub (Z.sub (@Zlength Int.int contents) j) (Zpos xH)) (@flip_ends Int.int j (Z.sub (@Zlength Int.int contents) j) contents))) *)
  apply I.
}
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint four_contents) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
forward.  (* s = a[hi-1]; *)
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr j))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size j)))) (@nil localdef))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) a0) (@nil mpred)))))) (local (@liftx (LiftEnviron Prop) (tc_val tint (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))))) *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr j))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size j)))) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) a0) (@nil mpred))))) (Ssequence (Sassign (Ederef (Ebinop Oadd (Etempvar _a (tptr tint)) (Ebinop Osub (Etempvar _hi tint) (Econst_int (Int.repr (Zpos xH)) tint) tint) (tptr tint)) tint) (Etempvar _t tint)) MORE_COMMANDS) POSTCONDITION *)
{
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _hi (Vint (Int.sub (Int.repr (Z.sub size j)) (Int.repr (Zpos xH))))) (@cons localdef (temp _lo (Vint (Int.add (Int.repr j) (Int.repr (Zpos xH))))) (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub size j) (@map Int.int val Vint contents)))) (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) a0) (@nil mpred)))))) (PROPx (@cons Prop (Z.le Z0 (Z.succ j)) (@cons Prop (Z.le (Z.succ j) (Z.sub size (Z.succ j))) (@nil Prop))) (LOCALx (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr (Z.succ j)))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size (Z.succ j))))) (@nil localdef)))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) (Z.succ j) (Z.sub size (Z.succ j)) (@map Int.int val Vint contents)) a0) (@nil mpred))))) *)
  entailer!.
(* Goal: is_int I32 Signed (@Znth val Vundef (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents))) *)
  clear - H H0 HRE.
  autorewrite with sublist in *|-*.
(* Goal: is_int I32 Signed (@Znth val Vundef (Z.sub (Z.sub (@Zlength Int.int contents) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength Int.int contents) j) (@map Int.int val Vint contents))) *)
  rewrite flip_ends_map.
(* Goal: is_int I32 Signed (@Znth val Vundef (Z.sub (Z.sub (@Zlength Int.int contents) j) (Zpos xH)) (@map Int.int val Vint (@flip_ends Int.int j (Z.sub (@Zlength Int.int contents) j) contents))) *)
  rewrite Znth_map by list_solve.
(* Goal: is_int I32 Signed (Vint (@Znth Int.int Inhabitant_int (Z.sub (Z.sub (@Zlength Int.int contents) j) (Zpos xH)) (@flip_ends Int.int j (Z.sub (@Zlength Int.int contents) j) contents))) *)
  apply I.
}
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr j))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size j)))) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) a0) (@nil mpred))))) (Ssequence (Sassign (Ederef (Ebinop Oadd (Etempvar _a (tptr tint)) (Ebinop Osub (Etempvar _hi tint) (Econst_int (Int.repr (Zpos xH)) tint) tint) (tptr tint)) tint) (Etempvar _t tint)) MORE_COMMANDS) POSTCONDITION *)
rewrite <- flip_fact_2 by (rewrite ?Zlength_flip_ends; omega).
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint four_contents) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
forward. (*  a[hi-1] = t; *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint four_contents) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
forward. (* a[lo] = s; *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint four_contents) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
forward. (* lo++; *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint four_contents) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
forward. (* hi--; *)
(* Prove postcondition of loop body implies loop invariant *)
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _hi (Vint (Int.sub (Int.repr (Z.sub size j)) (Int.repr (Zpos xH))))) (@cons localdef (temp _lo (Vint (Int.add (Int.repr j) (Int.repr (Zpos xH))))) (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub size j) (@map Int.int val Vint contents)))) (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) a0) (@nil mpred)))))) (@exp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) Z (fun a : Z => PROPx (@cons Prop (Z.le Z0 a) (@cons Prop (Z.le a (Z.sub size a)) (@nil Prop))) (LOCALx (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr a))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size a)))) (@nil localdef)))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a0 => if type_is_by_value (Tint i s a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a0 => if type_is_by_value (Tlong s a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a0 => if type_is_by_value (Tfloat f a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a0 => if type_is_by_value (Tpointer t0 a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a0 => if type_is_by_value (Tarray t0 z a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a0 => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a0 => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a0 => if type_is_by_value (Tint i s a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a0 => if type_is_by_value (Tlong s a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a0 => if type_is_by_value (Tfloat f a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a0 => if type_is_by_value (Tpointer t0 a0) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a0 => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a0 => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a0 => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a0 => O | Tlong s a0 => O | Tfloat f a0 => O | Tpointer t0 a0 => O | Tarray t' z a0 => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a0 => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a0 => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) a (Z.sub size a) (@map Int.int val Vint contents)) a0) (@nil mpred)))))) *)
 Exists (Z.succ j).
(* Goal: @derives (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (@andp (forall _ : environ, mpred) (@LiftNatDed' mpred Nveric) (local (tc_environ Delta)) (PROPx (@nil Prop) (LOCALx (@cons localdef (temp _hi (Vint (Int.sub (Int.repr (Z.sub size j)) (Int.repr (Zpos xH))))) (@cons localdef (temp _lo (Vint (Int.add (Int.repr j) (Int.repr (Zpos xH))))) (@cons localdef (temp _s (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) (@cons localdef (temp _t (@Znth val Vundef j (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)))) (@cons localdef (temp _a a0) (@nil localdef)))))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub size j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub size j) (@map Int.int val Vint contents)))) (@Znth val Vundef (Z.sub (Z.sub size j) (Zpos xH)) (@map Int.int val Vint contents))) a0) (@nil mpred)))))) (PROPx (@cons Prop (Z.le Z0 (Z.succ j)) (@cons Prop (Z.le (Z.succ j) (Z.sub size (Z.succ j))) (@nil Prop))) (LOCALx (@cons localdef (temp _a a0) (@cons localdef (temp _lo (Vint (Int.repr (Z.succ j)))) (@cons localdef (temp _hi (Vint (Int.repr (Z.sub size (Z.succ j))))) (@nil localdef)))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) (Z.succ j) (Z.sub size (Z.succ j)) (@map Int.int val Vint contents)) a0) (@nil mpred))))) *)
 entailer!.
(* Goal: @eq Z (Z.add i (Z.add (Z.sub j i) (Z.sub (@Zlength A al) j))) (@Zlength A al) *)
 f_equal; f_equal; omega.
(* Goal: @derives mpred Nveric (@data_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)))) (Vint (@Znth Int.int Inhabitant_int (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) contents))) a0) (@data_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@flip_ends (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) (Z.succ j) (Z.sub (@Zlength val (@map Int.int val Vint contents)) (Z.succ j)) (@map Int.int val Vint contents)) a0) *)
 simpl.
(* Goal: @derives mpred Nveric (@data_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)))) (Vint (@Znth Int.int Inhabitant_int (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) contents))) a0) (@data_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@flip_ends val (Z.succ j) (Z.sub (@Zlength val (@map Int.int val Vint contents)) (Z.succ j)) (@map Int.int val Vint contents)) a0) *)
 apply derives_refl'.
(* Goal: @eq mpred (@field_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@nil gfield) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)))) (Vint (@Znth Int.int Inhabitant_int (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) contents))) a0) (@field_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@nil gfield) (@flip_ends val (Z.succ j) (Z.sub (@Zlength val (@map Int.int val Vint contents)) (Z.succ j)) (@map Int.int val Vint contents)) a0) *)
 unfold data_at.    f_equal.
(* Goal: @eq (list val) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)))) (Vint (@Znth Int.int Inhabitant_int (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) contents))) (@flip_ends val (Z.succ j) (Z.sub (@Zlength val (@map Int.int val Vint contents)) (Z.succ j)) (@map Int.int val Vint contents)) *)
 clear - H0 HRE H1.
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) (@Zlength val al) (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (Z.sub (Z.sub (Z.sub size j) (Zpos xH)) Z0) (Z.add (Z.sub (Z.add j (Zpos xH)) j) (Z.sub (@Zlength val al) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) (@Zlength val al) (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
 unfold Z.succ.
(* Goal: @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) *)
 rewrite <- flip_fact_3 by auto.
 rewrite <- (Znth_map (Zlength (map Vint contents)-j-1) Vint) by (autorewrite with sublist in *; list_solve).
(* Goal: @eq (list val) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)) (@Znth val Vundef j (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)))) (@Znth val Inhabitant_val (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (@map Int.int val Vint contents))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents))) (@app val (@sublist val (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)) (@sublist val (Z.add j (Zpos xH)) (@Zlength val (@map Int.int val Vint contents)) (@app val (@sublist val Z0 (Z.sub (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents))) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents))) (@sublist val (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@Zlength val (@map Int.int val Vint contents)) (@flip_ends val j (Z.sub (@Zlength val (@map Int.int val Vint contents)) j) (@map Int.int val Vint contents)))))))) *)
 forget (map Vint contents) as al. clear contents.
(* Goal: @eq (list val) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub (@Zlength val al) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val al) j) al) (@Znth val Vundef j (@flip_ends val j (Z.sub (@Zlength val al) j) al))) (@Znth val Inhabitant_val (Z.sub (Z.sub (@Zlength val al) j) (Zpos xH)) al)) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub (@Zlength val al) j) al)) (@app val (@sublist val (Z.sub (Z.sub (@Zlength val al) j) (Zpos xH)) (Z.sub (@Zlength val al) j) al) (@sublist val (Z.add j (Zpos xH)) (@Zlength val al) (@app val (@sublist val Z0 (Z.sub (Z.sub (@Zlength val al) j) (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val al) j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub (@Zlength val al) j) al)) (@sublist val (Z.sub (@Zlength val al) j) (@Zlength val al) (@flip_ends val j (Z.sub (@Zlength val al) j) al))))))) *)
 remember (Zlength al) as size.
(* Goal: @eq (list val) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al) (@Znth val Vundef j (@flip_ends val j (Z.sub size j) al))) (@Znth val Inhabitant_val (Z.sub (Z.sub size j) (Zpos xH)) al)) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
 repeat match goal with |- context [reptype ?t] => change (reptype t) with val end.
(* Goal: @eq (list val) (@upd_Znth val j (@upd_Znth val (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al) (@Znth val Vundef j (@flip_ends val j (Z.sub size j) al))) (@Znth val Inhabitant_val (Z.sub (Z.sub size j) (Zpos xH)) al)) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
 unfold upd_Znth.
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@cons val (@Znth val Vundef j (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) (@Zlength val (@flip_ends val j (Z.sub size j) al)) (@flip_ends val j (Z.sub size j) al))))) (@cons val (@Znth val Inhabitant_val (Z.sub (Z.sub size j) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (@Zlength val (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@cons val (@Znth val Vundef j (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) (@Zlength val (@flip_ends val j (Z.sub size j) al)) (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@cons val (@Znth val Vundef j (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) (@Zlength val (@flip_ends val j (Z.sub size j) al)) (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
 rewrite !Znth_cons_sublist by (repeat rewrite Zlength_flip_ends; try omega).
(* Goal: @eq Z (Z.add i (Z.add (Z.sub j i) (Z.sub (@Zlength A al) j))) (@Zlength A al) *)
 rewrite ?Zlength_app, ?Zlength_firstn, ?Z.max_r by omega.
(* Goal: @eq Z (Z.add i (Z.add (Z.sub j i) (Z.sub (@Zlength A al) j))) (@Zlength A al) *)
 rewrite ?Zlength_flip_ends by omega.
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) (@Zlength val al) (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (@Zlength val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al))) (Z.add (@Zlength val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al))) (@Zlength val (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) (@Zlength val al) (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) (@Zlength val al) (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
 rewrite ?Zlength_sublist by (rewrite ?Zlength_flip_ends ; omega).
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (Z.sub (Z.sub (Z.sub size j) (Zpos xH)) Z0) (Z.add (Z.sub (Z.add j (Zpos xH)) j) (Z.sub size (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH))))) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Zpos xH)) size (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
 unfold Z.succ. rewrite <- Heqsize. autorewrite with sublist.
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) (Z.add (Z.sub (Z.sub size j) (Zpos xH)) (Z.add (Zpos xH) j)) (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
 replace (size - j - 1 + (1 + j)) with size by (clear; omega).
(* Goal: @eq (list val) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) (@app val (@sublist val Z0 j (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val (Z.sub (Z.sub size j) (Zpos xH)) (Z.sub size j) al) (@sublist val (Z.add j (Zpos xH)) size (@app val (@sublist val Z0 (Z.sub (Z.sub size j) (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@app val (@sublist val j (Z.add j (Zpos xH)) (@flip_ends val j (Z.sub size j) al)) (@sublist val (Z.sub size j) size (@flip_ends val j (Z.sub size j) al))))))) *)
 reflexivity.
* (* after the loop *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint four_contents) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
forward. (* return; *)
(* Goal: @eq A (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) (@Znth A d (Z.sub (Z.sub size j) (Zpos xH)) al) *)
rewrite map_rev. rewrite flip_fact_1; try omega; auto.
(* Goal: @derives mpred Nveric (@data_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@rev (@projT1 Type (fun x : Type => x) ((fix type_func_rec (n : nat) (t : type) {struct n} : @sigT Type (fun x : Type => x) := match n with | O => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 z a => if type_is_by_value (Tarray t0 z a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tstruct id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end | Tunion id a => match @PTree.get composite id (@cenv_cs CompSpecs) with | Some c => if type_is_by_value (Tunion id a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | None => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => if type_is_by_value (field_type (@fst ident type it) (co_members (@get_co CompSpecs id))) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt) (co_members (@get_co CompSpecs id))))) end end | S n' => match t with | Tvoid => if type_is_by_value Tvoid then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tint i s a => if type_is_by_value (Tint i s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tlong s a => if type_is_by_value (Tlong s a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tfloat f a => if type_is_by_value (Tfloat f a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tpointer t0 a => if type_is_by_value (Tpointer t0 a) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tarray t0 n0 a => @existT Type (fun x : Type => x) (list (@projT1 Type (fun x : Type => x) (type_func_rec n' t0))) (@list_repeat (@projT1 Type (fun x : Type => x) (type_func_rec n' t0)) (Z.to_nat n0) (@projT2 Type (fun x : Type => x) (type_func_rec n' t0))) | Tfunction t0 t1 c => if type_is_by_value (Tfunction t0 t1 c) then @existT Type (fun x : Type => x) val Vundef else @existT Type (fun x : Type => x) unit tt | Tstruct id a => @existT Type (fun x : Type => x) (@compact_prod_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_prod_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) | Tunion id a => @existT Type (fun x : Type => x) (@compact_sum_sigT_type Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) (@compact_sum_sigT_value Type (fun x : Type => x) (@type_induction.decay (prod ident type) (@sigT Type (fun x : Type => x)) (co_members (@get_co CompSpecs id)) (@type_induction.ListTypeGen (prod ident type) (fun _ : prod ident type => @sigT Type (fun x : Type => x)) (fun it : prod ident type => type_func_rec n' (field_type (@fst ident type it) (co_members (@get_co CompSpecs id)))) (co_members (@get_co CompSpecs id))))) end end) ((fix rank_type (ce : composite_env) (t : type) {struct t} : nat := match t with | Tvoid => O | Tint i s a => O | Tlong s a => O | Tfloat f a => O | Tpointer t0 a => O | Tarray t' z a => S (rank_type ce t') | Tfunction t0 t1 c => O | Tstruct id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end | Tunion id a => match @PTree.get composite id ce with | Some co => S (co_rank co) | None => O end end) (@cenv_cs CompSpecs) tint) tint)) (@map Int.int val Vint contents)) a0) (@data_at CompSpecs sh (tarray tint (@Zlength val (@map Int.int val Vint contents))) (@rev val (@map Int.int val Vint contents)) a0) *)
cancel.
Qed.

Definition four_contents := [Int.repr 1; Int.repr 2; Int.repr 3; Int.repr 4].

Lemma body_main:  semax_body Vprog Gprog f_main main_spec.
Proof.
(* Goal: semax_body Vprog Gprog CompSpecs f_main main_spec *)
name four _four.
(* Goal: semax_body Vprog Gprog CompSpecs f_main main_spec *)
start_function.

forward_call  (*  revarray(four,4); *)
  (gv _four, Ews, four_contents, 4).
(* Goal: and (and (Z.le Z0 (Zpos (xO (xO xH)))) (Z.le (Zpos (xO (xO xH))) Int.max_signed)) (writable_share Ews) *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint (@rev Int.int (@rev Int.int four_contents))) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
   split; [computable | auto].
forward_call  (*  revarray(four,4); *)
    (gv _four,Ews, rev four_contents,4).
(* Goal: and (and (Z.le Z0 (Zpos (xO (xO xH)))) (Z.le (Zpos (xO (xO xH))) Int.max_signed)) (writable_share Ews) *)
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint (@rev Int.int (@rev Int.int four_contents))) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
   split; [computable | auto].
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint (@rev Int.int (@rev Int.int four_contents))) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
rewrite rev_involutive.
(* Goal: semax CompSpecs Espec Delta (PROPx (@nil Prop) (LOCALx (@cons localdef (gvars gv) (@nil localdef)) (SEPx (@cons mpred (@data_at CompSpecs Ews (tarray tint (Zpos (xO (xO xH)))) (@map Int.int val Vint four_contents) (gv _four)) (@nil mpred))))) (Ssequence (Sreturn (@Some expr (Econst_int (Int.repr Z0) tint))) MORE_COMMANDS) POSTCONDITION *)
forward. (* return s; *)
Qed.

Existing Instance NullExtension.Espec.

Lemma prog_correct:
  semax_prog prog Vprog Gprog.
Proof.
(* Goal: semax_prog NullExtension.Espec CompSpecs prog Vprog Gprog *)
prove_semax_prog.
(* Goal: semax_func NullExtension.Espec Vprog Gprog CompSpecs (@cons (prod ident (fundef function)) (@pair ident (fundef function) _reverse (@Internal function f_reverse)) (@cons (prod ident (fundef function)) (@pair ident (fundef function) _main (@Internal function f_main)) (@nil (prod ident (fundef function))))) (@cons (prod ident funspec) (@pair ident funspec _reverse (NDmk_funspec (@pair (list (prod ident type)) type (@cons (prod ident type) (@pair ident type _a (tptr tint)) (@cons (prod ident type) (@pair ident type _n tint) (@nil (prod ident type)))) tvoid) cc_default (prod (prod (prod val share) (list Int.int)) Z) (fun x : prod (prod (prod val share) (list Int.int)) Z => let (p, size) := x in let (p0, contents) := p in let (a0, sh) := p0 in PROPx (@cons Prop (and (Z.le Z0 size) (Z.le size Int.max_signed)) (@cons Prop (writable_share sh) (@nil Prop))) (LOCALx (@cons localdef (temp _a a0) (@cons localdef (temp _n (Vint (Int.repr size))) (@nil localdef))) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@map Int.int val Vint contents) a0) (@nil mpred))))) (fun x : prod (prod (prod val share) (list Int.int)) Z => let (p, size) := x in let (p0, contents) := p in let (a0, sh) := p0 in PROPx (@nil Prop) (LOCALx (@nil localdef) (SEPx (@cons mpred (@data_at CompSpecs sh (tarray tint size) (@map Int.int val Vint (@rev Int.int contents)) a0) (@nil mpred))))))) (@cons (prod ident funspec) (@pair ident funspec _main (NDmk_funspec (@pair (list (prod ident type)) type (@nil (prod ident type)) tint) cc_default globals (fun gv : globals => main_pre prog (@nil Type) gv) (fun gv : globals => main_post prog (@nil Type) gv))) (@nil (prod ident funspec)))) *)
semax_func_cons body_reverse.
(* Goal: semax_func NullExtension.Espec Vprog Gprog CompSpecs (@cons (prod ident (fundef function)) (@pair ident (fundef function) _main (@Internal function f_main)) (@nil (prod ident (fundef function)))) (@cons (prod ident funspec) (@pair ident funspec _main (NDmk_funspec (@pair (list (prod ident type)) type (@nil (prod ident type)) tint) cc_default globals (fun gv : globals => main_pre prog (@nil Type) gv) (fun gv : globals => main_post prog (@nil Type) gv))) (@nil (prod ident funspec))) *)
semax_func_cons body_main.
Qed.
