Opaque member_dec.

(* Specifications: *)
Lemma struct_pred_ext_derives: forall m {A0 A1} (P0: forall it, A0 it -> val -> mpred) (P1: forall it, A1 it -> val -> mpred) v0 v1 p,
members_no_replicate m = true ->
(forall i d0 d1, in_members i m ->
P0 _ (proj_struct i m v0 d0) p |-- P1 _ (proj_struct i m v1 d1) p) ->
struct_pred m P0 v0 p |-- struct_pred m P1 v1 p.
Lemma struct_pred_ext: forall m {A0 A1} (P0: forall it, A0 it -> val -> mpred) (P1: forall it, A1 it -> val -> mpred) v0 v1 p,
members_no_replicate m = true ->
(forall i d0 d1, in_members i m ->
P0 _ (proj_struct i m v0 d0) p = P1 _ (proj_struct i m v1 d1) p) ->
struct_pred m P0 v0 p = struct_pred m P1 v1 p.
Lemma struct_pred_not_member: forall m {A} (P: forall it, A it -> val -> mpred) (i: ident) v p,
let P' it := if ident_eq i (fst it) then fun _ _ => emp else P it in
~ in_members i m ->
struct_pred m P v p = struct_pred m P' v p.
Lemma struct_pred_proj: forall m {A} (P: forall it, A it -> val -> mpred) (i: ident) v p d,
let P' it := if ident_eq i (fst it) then fun _ _ => emp else P it in
members_no_replicate m = true ->
in_members i m ->
struct_pred m P v p = P _ (proj_struct i m v d) p * struct_pred m P' v p.
Lemma struct_pred_upd: forall m {A} (P: forall it, A it -> val -> mpred) (i: ident) v p v0,
let P' it := if ident_eq i (fst it) then fun _ _ => emp else P it in
members_no_replicate m = true ->
in_members i m ->
struct_pred m P (upd_struct i m v v0) p = P _ v0 p * struct_pred m P' v p.
Lemma struct_pred_ramif: forall m {A} (P: forall it, A it -> val -> mpred) (i: ident) v p d,
in_members i m ->
members_no_replicate m = true ->
struct_pred m P v p |--
P _ (proj_struct i m v d) p *
(ALL v0: _, P _ v0 p -* struct_pred m P (upd_struct i m v v0) p).
Lemma at_offset_struct_pred: forall m {A} (P: forall it, A it -> val -> mpred) v p ofs,
at_offset (struct_pred m P v) ofs p = struct_pred m (fun it v => at_offset (P it v) ofs) v p.
Lemma corable_andp_struct_pred: forall m {A} (P: forall it, A it -> val -> mpred) v p Q,
corable Q ->
Q && struct_pred m P v p =
match m with
| nil => Q && emp
| _ => struct_pred m (fun it v p => Q && P it v p) v p
end.
Lemma struct_pred_sepcon: forall m {A} (P Q: forall it, A it -> val -> mpred) v p,
struct_pred m P v p * struct_pred m Q v p = struct_pred m (fun it => P it * Q it) v p.
Lemma compact_sum_inj_eq_spec: forall {A} a0 a1 (l: list A) F0 F1 (v0: compact_sum (map F0 (a0 :: a1 :: l))) (v1: compact_sum (map F1 (a0 :: a1 :: l))) H,
~ In a0 (a1 :: l) ->
((forall a, compact_sum_inj v0 a H <-> compact_sum_inj v1 a H) <->
match v0, v1 with
| inl _, inl _ => True
| inr v0, inr v1 => forall a, compact_sum_inj (v0: compact_sum (map F0 (a1 :: l))) a H <-> compact_sum_inj (v1: compact_sum (map F1 (a1 :: l))) a H
| _, _ => False
end).
Lemma union_pred_ext_derives: forall m {A0 A1} (P0: forall it, A0 it -> val -> mpred) (P1: forall it, A1 it -> val -> mpred) v0 v1 p,
members_no_replicate m = true ->
(forall it, members_union_inj v0 it <-> members_union_inj v1 it) ->
(forall i d0 d1, members_union_inj v0 (i, field_type i m) -> members_union_inj v1 (i, field_type i m) ->
P0 _ (proj_union i m v0 d0) p |-- P1 _ (proj_union i m v1 d1) p) ->
union_pred m P0 v0 p |-- union_pred m P1 v1 p.
Lemma union_pred_ext: forall m {A0 A1} (P0: forall it, A0 it -> val -> mpred) (P1: forall it, A1 it -> val -> mpred) v0 v1 p,
members_no_replicate m = true ->
(forall it, members_union_inj v0 it <-> members_union_inj v1 it) ->
(forall i d0 d1, members_union_inj v0 (i, field_type i m) -> members_union_inj v1 (i, field_type i m) ->
P0 _ (proj_union i m v0 d0) p = P1 _ (proj_union i m v1 d1) p) ->
union_pred m P0 v0 p = union_pred m P1 v1 p.
Lemma union_pred_derives_const: forall m {A} (P: forall it, A it -> val -> mpred) p v R,
members_no_replicate m = true ->
m <> nil ->
(forall i (v: A (i, field_type i m)), in_members i m -> P _ v p |-- R) ->
union_pred m P v p |-- R.
Lemma union_pred_proj: forall m {A} (P: forall it, A it -> val -> mpred) (i: ident) v p d,
members_no_replicate m = true ->
in_members i m ->
(forall i' (v': A (i', field_type i' m)), in_members i' m -> P _ v' p |-- P _ d p) ->
union_pred m P v p |-- P _ (proj_union i m v d) p.
Lemma union_pred_upd: forall m {A} (P: forall it, A it -> val -> mpred) (i: ident) v p v0,
members_no_replicate m = true ->
in_members i m ->
union_pred m P (upd_union i m v v0) p = P _ v0 p.
Lemma union_pred_ramif: forall m {A} (P: forall it, A it -> val -> mpred) (i: ident) v p d,
(forall i' (v': A (i', field_type i' m)), in_members i' m -> P _ v' p |-- P _ d p) ->
in_members i m ->
members_no_replicate m = true ->
union_pred m P v p |--
P _ (proj_union i m v d) p *
(ALL v0: _, P _ v0 p -* union_pred m P (upd_union i m v v0) p).
Lemma at_offset_union_pred: forall m {A} (P: forall it, A it -> val -> mpred) v p ofs,
at_offset (union_pred m P v) ofs p = union_pred m (fun it v => at_offset (P it v) ofs) v p.
Lemma andp_union_pred: forall m {A} (P: forall it, A it -> val -> mpred) v p Q,
Q && union_pred m P v p =
match m with
| nil => Q && emp
| _ => union_pred m (fun it v p => Q && P it v p) v p
end.
Lemma union_pred_sepcon: forall m {A} (P Q: forall it, A it -> val -> mpred) v p,
union_pred m P v p * union_pred m Q v p = union_pred m (fun it => P it * Q it) v p.
Lemma struct_Prop_compact_prod_gen: forall m (F: ident * type -> Type) (P: forall it, F it -> Prop) (f: forall it, F it),
members_no_replicate m = true ->
(forall i, in_members i m -> P (i, field_type i m) (f (i, field_type i m))) ->
struct_Prop m P (compact_prod_gen f m).
Lemma struct_Prop_proj: forall m (F: ident * type -> Type) (P: forall it, F it -> Prop) v i d,
in_members i m ->
struct_Prop m P v ->
P (i, field_type i m) (proj_struct i m v d).
Lemma union_Prop_compact_sum_gen: forall m (F: ident * type -> Type) (P: forall it, F it -> Prop) (f: forall it, F it),
members_no_replicate m = true ->
(forall i, in_members i m -> P (i, field_type i m) (f (i, field_type i m))) ->
union_Prop m P (compact_sum_gen (fun _ => true) f m).
Lemma union_Prop_proj: forall m (F: ident * type -> Type) (P: forall it, F it -> Prop) v i d,
members_union_inj v (i, field_type i m) ->
union_Prop m P v ->
P (i, field_type i m) (proj_union i m v d).
Lemma array_pred_local_facts: forall {A}{d: Inhabitant A} lo hi P v p Q,
(forall i x, lo <= i < hi -> P i x p |-- !! Q x) ->
array_pred lo hi P v p |-- !! (Zlength v = hi - lo /\ Forall Q v).
Lemma struct_pred_local_facts: forall m {A} (P: forall it, A it -> val -> mpred)v p (R: forall it, A it -> Prop),
members_no_replicate m = true ->
(forall i v0, in_members i m -> P (i, field_type i m) v0 p |-- !! R _ v0) ->
struct_pred m P v p |-- !! struct_Prop m R v.
Lemma union_pred_local_facts: forall m {A} (P: forall it, A it -> val -> mpred)v p (R: forall it, A it -> Prop),
members_no_replicate m = true ->
(forall i v0, in_members i m -> P (i, field_type i m) v0 p |-- !! R _ v0) ->
union_pred m P v p |-- !! union_Prop m R v.