Hint Extern 1 (_ |-- valid_pointer ?Q) =>
lazymatch Q with
| offset_val _ _ => fail
| _ => apply valid_pointer_offset_zero
end.
Hint Extern 2 (memory_block _ _ _ |-- weak_valid_pointer _) =>
(apply SeparationLogic.memory_block_weak_valid_pointer;
[rep_omega | rep_omega | auto with valid_pointer]) : valid_pointer.
Ltac field_at_conflict z fld :=
eapply derives_trans with FF; [ | apply FF_left];
rewrite <- ?sepcon_assoc;
unfold data_at_, data_at, field_at_;
let x := fresh "x" in set (x := field_at _ _ fld _ z); pull_right x;
let y := fresh "y" in set (y := field_at _ _ fld _ z); pull_right y;
try (rewrite sepcon_assoc; eapply sepcon_FF_derives');
subst x y;
apply field_at_conflict; auto;
try solve [simpl; computable].
Ltac data_at_conflict z := field_at_conflict z (@nil gfield).
Ltac data_at_conflict_neq_aux1 A sh fld E x y :=
match A with
| context [data_at sh _ _ y] => unify fld (@nil gfield)
| context [data_at_ sh _ y]  => unify fld (@nil gfield)
| context [field_at sh _ fld _ y] => idtac
| context [field_at_ sh _ fld y]  => idtac
end;
apply derives_trans with (!! (~ E) && A);
[apply andp_right; [ | apply derives_refl];
let H := fresh in
apply not_prop_right; intro H;
(rewrite H || rewrite (ptr_eq_e _ _ H));
field_at_conflict y fld
| apply derives_extract_prop;
let H1 := fresh in intro H1;
rewrite (eq_True _ H1)
].
Ltac data_at_conflict_neq_aux2 A E x y :=
match A with
| context [data_at ?sh _ _ x] => data_at_conflict_neq_aux1 A sh (@nil gfield) E x y
| context [data_at_ ?sh _ x]  => data_at_conflict_neq_aux1 A sh (@nil gfield) E x y
| context [field_at ?sh _ ?fld _ x] => data_at_conflict_neq_aux1 A sh fld E x y
| context [field_at_ ?sh _ ?fld x]  => data_at_conflict_neq_aux1 A sh fld E x y
end.
Ltac data_at_conflict_neq :=
match goal with |- ?A |-- ?B =>
match B with
| context [?x <> ?y] => data_at_conflict_neq_aux2 A (x=y) x y
| context [~ ptr_eq ?x ?y] => data_at_conflict_neq_aux2 A (ptr_eq x y) x y
end
end.
Definition natural_aligned {cs: compspecs} (na: Z) (t: type): bool := (na mod (hardware_alignof ha_env_cs t) =? 0) && is_aligned cenv_cs ha_env_cs la_env_cs t 0.
Definition natural_aligned_soundness {cs: compspecs}: Prop :=
forall na ofs t,
complete_legal_cosu_type t = true ->
natural_aligned na t = true ->
(na | ofs) ->
align_compatible_rec cenv_cs t ofs.

(* Specifications: *)
Lemma natural_aligned_sound {cs: compspecs}:
natural_aligned_soundness.