Prover/Formulae.pizza
changeset 96 907b1fff5637
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Prover/Formulae.pizza	Thu Mar 15 10:07:28 2012 +0000
@@ -0,0 +1,48 @@
+
+package G4ip;
+
+/** Class for propositional formulae.<p>
+  * @author      Christian Urban
+  */
+public class Form {
+
+  public case False();         
+  public case And(Form c1,Form c2);
+  public case Or(Form c1,Form c2);
+  public case Imp(Form c1,Form c2);
+  //public case Equ(Form c1,Form c2);
+  public case Atm(String c);
+
+  public String toString() {
+    switch(this) {
+    case False(): 
+      return "false"; 
+    case And(Form c1,Form c2): 
+      return "(" + c1.toString() + " & "   + c2.toString() + ")"; 
+    case Or(Form c1,Form c2):  
+      return "(" + c1.toString() + " v "   + c2.toString() + ")"; 
+    case Imp(Form c1,Form c2): 
+      return "(" + c1.toString() + " -> "  + c2.toString() + ")"; 
+    case Atm(String c): 
+      return c; 
+    }
+  }
+
+  // for testing
+  public String internalString() {
+    switch(this) {
+    case False(): 
+      return "false"; 
+    case And(Form c1,Form c2): 
+      return "And(" + c1.internalString() + ","   + c2.internalString() + ")"; 
+    case Or(Form c1,Form c2):  
+      return "Or(" + c1.internalString() + ","   + c2.internalString() + ")"; 
+    case Imp(Form c1,Form c2): 
+      return "Imp(" + c1.internalString() + ","  + c2.internalString() + ")"; 
+    case Atm(String c): 
+      return "Atm(\"p"+ c + "\")"; 
+    }
+  }
+
+}
+