(*s Definition of concrete formulas : 
    [(CGleq x y d)] means $x\leq y+d$, [(CGeq x y d)] means $x=y+d$
 *)

Inductive CGForm : Set :=
  | CGleq : ad -> ad -> D -> CGForm
  | CGeq : ad -> ad -> D -> CGForm
  | CGand : CGForm -> CGForm -> CGForm
  | CGor : CGForm -> CGForm -> CGForm
  | CGimp : CGForm -> CGForm -> CGForm
  | CGnot : CGForm -> CGForm.(*s Definition of concrete formulas : 
    [(CGleq x y d)] means $x\leq y+d$, [(CGeq x y d)] means $x=y+d$
 *)

Inductive CGForm : Set :=
  | CGleq : ad -> ad -> D -> CGForm
  | CGeq : ad -> ad -> D -> CGForm
  | CGand : CGForm -> CGForm -> CGForm
  | CGor : CGForm -> CGForm -> CGForm
  | CGimp : CGForm -> CGForm -> CGForm
  | CGnot : CGForm -> CGForm.(*s Definition of concrete formulas : 
    [(CGleq x y d)] means $x\leq y+d$, [(CGeq x y d)] means $x=y+d$
 *)

Inductive CGForm : Set :=
  | CGleq : ad -> ad -> D -> CGForm
  | CGeq : ad -> ad -> D -> CGForm
  | CGand : CGForm -> CGForm -> CGForm
  | CGor : CGForm -> CGForm -> CGForm
  | CGimp : CGForm -> CGForm -> CGForm
  | CGnot : CGForm -> CGForm.(*s Definition of concrete formulas : 
    [(CGleq x y d)] means $x\leq y+d$, [(CGeq x y d)] means $x=y+d$
 *)

Inductive CGForm : Set :=
  | CGleq : ad -> ad -> D -> CGForm
  | CGeq : ad -> ad -> D -> CGForm
  | CGand : CGForm -> CGForm -> CGForm
  | CGor : CGForm -> CGForm -> CGForm
  | CGimp : CGForm -> CGForm -> CGForm
  | CGnot : CGForm -> CGForm.(*s Definition of concrete formulas : 
    [(CGleq x y d)] means $x\leq y+d$, [(CGeq x y d)] means $x=y+d$
 *)

Inductive CGForm : Set :=
  | CGleq : ad -> ad -> D -> CGForm
  | CGeq : ad -> ad -> D -> CGForm
  | CGand : CGForm -> CGForm -> CGForm
  | CGor : CGForm -> CGForm -> CGForm
  | CGimp : CGForm -> CGForm -> CGForm
  | CGnot : CGForm -> CGForm.(*s Definition of concrete formulas : 
    [(CGleq x y d)] means $x\leq y+d$, [(CGeq x y d)] means $x=y+d$
 *)

Inductive CGForm : Set :=
  | CGleq : ad -> ad -> D -> CGForm
  | CGeq : ad -> ad -> D -> CGForm
  | CGand : CGForm -> CGForm -> CGForm
  | CGor : CGForm -> CGForm -> CGForm
  | CGimp : CGForm -> CGForm -> CGForm
  | CGnot : CGForm -> CGForm.(*s Definition of concrete formulas : 
    [(CGleq x y d)] means $x\leq y+d$, [(CGeq x y d)] means $x=y+d$
 *)

Inductive CGForm : Set :=
  | CGleq : ad -> ad -> D -> CGForm
  | CGeq : ad -> ad -> D -> CGForm
  | CGand : CGForm -> CGForm -> CGForm
  | CGor : CGForm -> CGForm -> CGForm
  | CGimp : CGForm -> CGForm -> CGForm
  | CGnot : CGForm -> CGForm.(*s Interpretation of concrete formulas as proposition *)

Fixpoint CGeval (rho : ad -> D) (f : CGForm) {struct f} : Prop :=
  match f with
  | CGleq x y d => Dle (rho x) (Dplus (rho y) d) = true
  | CGeq x y d => rho x = Dplus (rho y) d
  | CGand f0 f1 => CGeval rho f0 /\ CGeval rho f1
  | CGor f0 f1 => CGeval rho f0 \/ CGeval rho f1
  | CGimp f0 f1 => CGeval rho f0 -> CGeval rho f1
  | CGnot f0 => ~ CGeval rho f0
  end.

(* Specifications: *)
Lemma CGeval_dec : forall (f : CGForm) (rho : ad -> D), {CGeval rho f} + {~ CGeval rho f}.