Module BarebonesLogic <: VERISTAR_LOGIC.
Definition loc := loc.
Instance Join_loc : Join loc := @Join_equiv _.
Instance Perm_loc : Perm_alg loc := _.
Instance Sep_loc : Sep_alg loc := _.
Instance Canc_loc : Canc_alg loc := _.
Instance Join_nat : Join nat := @Join_discrete _.
Instance Pos_nat : @Pos_alg nat (@Join_discrete _) := @psa_discrete _.
Instance Canc_nat : @Canc_alg nat Join_nat.
unfold Canc_alg; intros ? ? ? ? H; inv H.
Qed.
Definition val := val.
Instance Join_val : Join val := Join_lower Join_nat.
Instance Perm_val : Perm_alg val := _.
Instance Sep_val : Sep_alg val := _.
Instance Canc_val : Canc_alg val := @Canc_lower _ _ _ Canc_nat.
repeat intro. inv H; auto. Qed.
Hint Resolve identity_None.
Definition val2loc (v: val) : option loc :=
match v with Some (S n) => Some (S n) | _ => None end.
Definition nil_val : val := Some O.
Definition full (v: val) := forall v2, joins v v2 -> identity v2.
intro H; destruct v as [[|n]|]; inv H.
unfold full; intros v2 [[x|] H]; inv H; auto; inversion H3.
Qed.
unfold full, nil_val; intros x H; inversion H as [x0 H0]; inv H0; auto; inv H2.
Qed.
unfold not, full, empty_val; intros. specialize (H (Some O)).
spec H. econstructor; constructor. specialize (H None (Some O)).
spec H. constructor. inv H.
Qed.
unfold val2loc; intros. destruct v1; inv H. destruct n; inv H2.
destruct v2; inv H0. destruct n0; inv H1. auto.
Qed.

Lemma loc_eq_dec (l1 l2 : loc) : Decidable.decidable (l1=l2).