static void Main(string[] args) { var P = new TrueExpr(); var Q = new Not(new TrueExpr()); TestLogicalEquivalence(P, Q); TestLogicalEquivalence( new Not(P), new Nand(P, P)); TestLogicalEquivalence( new And(P, Q), new Nand(new Nand(P, Q), new Nand(P, Q))); TestLogicalEquivalence( new Or(P, Q), new Nand(new Nand(P, P), new Nand(Q, Q))); TestLogicalEquivalence( new Xor(P, Q), new Nand( new Nand(P, new Nand(P, Q)), new Nand(Q, new Nand(P, Q))) ); Console.ReadKey(true); }
public string Visit(TrueExpr expr) { return("True"); }
public bool Visit(TrueExpr expr) { return(true); }