Definition deterministic_rel {T} (R: relation T) :=
forall s s' s'', R s s' /\ R s s'' -> s'=s''.
Definition pfunc T R := T -> option R.
Definition address := nat.
Inductive val : Type :=
| Vint : nat -> val
| Vptr : address -> val
| Vundef.
(* Generic Operational Semantics *)
Class GenericSemantics
(W : Type) (* Worlds *)
(V : relation W -> Prop) (* Primitive commands *)
(G : pfunc W val -> Prop) (* Primitive expressions *)
: Type := mkGenericSem {
}.
Section Expressions.
Variables
(W : Type)
(G : pfunc W val -> Prop) (* Primitive expressions *).
Inductive unop := UNeg.
Inductive binop := BAdd.
Inductive expr : Type :=
| EVal : forall (v : val), expr
| EUnop : forall (op : unop) (e : expr), expr
| EBinop : forall (op : binop) (e1 e2 : expr), expr
| EPrim : forall (f : pfunc W val), expr.
Definition is_true (v : val) :=
exists n, (v = Vint n \/ v = Vptr n) /\ n <> O.

(* Specifications: *)
Lemma is_true_dec : forall v, {is_true v} + {~ is_true v}.
Definition unopDenote (op : unop) (v : val) : val :=
match op, is_true_dec v with
| UNeg, left _ => Vint 0
| UNeg, right _ => Vint 1
end.