diff -r 345dd18f020e -r 907b1fff5637 Prover/Contexts.pizza --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Prover/Contexts.pizza Thu Mar 15 10:07:28 2012 +0000 @@ -0,0 +1,70 @@ +package G4ip; + +import java.util.Vector; +import G4ip.Form.*; + +/** Context acts as a multiset.

+ * Typical contexts in logical rules are Gamma, Delta, etc. + * @author Christian Urban + */ +public class Context extends Vector { + + public Context() { super(); } + + public Context(Context init_context) { + super(); + for (int i=0;i 0) { // add last formula + s=s.concat(elementAt(i).toString()); + } + return s; + } + + /** returns a context with one additional formula at the beginning + * @param new_formula a formula + */ + public Context add(Form new_formula) { + Context new_c = new Context(this); + new_c.insertElementAt(new_formula,0); + return new_c; + } + + /** returns a context with two additional formulae at the beginning + * @param new_formula1,new_formula2 two formulae + */ + public Context add(Form new_formula1, Form new_formula2) { + Context new_c = new Context(this); + new_c.insertElementAt(new_formula1,0); + new_c.insertElementAt(new_formula2,0); + return new_c; + } + + /** tests whether a context contains a specific atom + * @param a a formula + */ + public boolean includes(Form a) { + if (a instanceof Atm) { + for (int i=0;i