signature PROP = sig datatype prop = (* A ::= *) Atom of string (* P *) | True (* | T *) | And of prop * prop (* | A1 & A2 *) | False (* | F *) | Or of prop * prop (* | A1 | A2 *) | Implies of prop * prop (* | A1 => A2 *) val Not : prop -> prop (* ~A := A => F *) val toString : prop -> string end structure Prop :> PROP = struct datatype prop = Atom of string | True | And of prop * prop | False | Or of prop * prop | Implies of prop * prop fun Not A = Implies (A, False) fun toStringImp (Implies (A, B)) = toStringAndOr A ^ " => " ^ toStringImp B | toStringImp A = toStringAndOr A and toStringAndOr (And (A, B)) = toStringAtomic A ^ " & " ^ toStringAtomic B | toStringAndOr (Or (A, B)) = toStringAtomic A ^ " | " ^ toStringAtomic B | toStringAndOr A = toStringAtomic A and toStringAtomic (Atom s) = s | toStringAtomic True = "T" | toStringAtomic False = "F" | toStringAtomic A = "(" ^ toStringImp A ^ ")" fun toString x = toStringImp x end signature G4IP = sig (* [decide A = true] iff . ===> A has a proof, [decide A = false] iff . ===> A has no proof *) val decide : Prop.prop -> bool end