def Q3_1(): clear() A = Var("A") B = Var("B") p1 = premise(Or(A, B)) return orE(p1, arrowI(assume(A), orIR(assumed(A), Or(B, A)), Arrow(A, Or(B, A))), arrowI(assume(B), orIL(assumed(B), Or(B, A)), Arrow(B, Or(B, A))), Or(B, A))
def Q3_2(): clear() A = Var("A") B = Var("B") p1 = premise(Or(A, B)) p2 = premise(Not(B)) return orE(p1, Arrow(A,A), arrowI(assume(B), FE(notE(assumed(B), p2, false()), A), Arrow(B, A)), A)
def Q3_3(): clear() A = Var("A") B = Var("B") p1 = premise(Or(Not(A), Not(B))) end = Not(And(A,B)) A_B = And(A,B) return orE(p1, arrowI(assume(Not(A)), notI(arrowI(assume(A_B), notE(andEL(assumed(A_B), A), assumed(Not(A)), false()), Arrow(A_B, false())), Not(A_B)), Arrow(Not(A), Not(A_B))), arrowI(assume(Not(B)), notI(arrowI(assume(A_B), notE(andER(assumed(A_B), B), assumed(Not(B)), false()), Arrow(A_B, false())), Not(A_B)), Arrow(Not(B), Not(A_B))), end)
def andComm(): clear() a = Var("A") b = Var("B") p1 = premise(And(a, b)) # The proof itself looks different, but it's really just on it's side. # # each proof rule is written as rule(support, expression) # since the andI rule B && A needs two pieces (B and A), we need the two proofs # the proof for B is andER, and the proof of A is andEL return andI(andER(p1, b), \ andEL(p1, a), \ And(b,a))
def example(): clear() p1 = premise(parse("EX x. FA y. P(x,y)")) a1 = assume(parse("FA y. P(u,y)")) a2 = assume(Var("v")) l1 = assumed(parse("FA y. P(u,y)")) l2 = forallE(l1, "v", parse("P(u,v)")) l3 = existsI(l2, "u", parse("EX x. P(x,v)")) l4 = forallI(a2, l3, parse("FA y. EX x. P(x,y)")) l5 = arrowI(a1, l4, parse("(FA y. P(u,y)) -> (FA y. EX x. P(x,y))")) l6 = existsE(p1, "u", l5, parse("FA y. EX x. P(x,y)")) return l6
def main(): try: clear() forall_comm().print_proof() clear() DM1().print_proof() clear() DM2().print_proof() clear() DM3().print_proof() clear() contra().print_proof() except (ParseException, LexException) as e: print(str(e)) except (ProofException) as e: e.print() except Exception as e: print(e)
def main(): try: clear() ren_forall().print_proof() clear() ren_exists().print_proof() clear() exists_comm().print_proof() except (ProofException) as e: e.print()
def main(): try: clear() orComm().print_proof() clear() disSyl().print_proof() clear() DM1().print_proof() clear() a = Var("a") b = Var("b") dlPrem = premise(Not(Or(Not(a), Not(b)))) DL1(dlPrem).print_proof() clear() dlPrem = premise(Not(Or(Not(a), Not(b)))) DL2(dlPrem).print_proof() clear() DM2().print_proof() except (ProofException) as e: e.print()