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 orComm(): 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_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 disSyl(): A = Var("a") B = Var("b") p1 = premise(Or(A, B)) p2 = premise(Not(B)) return orE( p1, arrowI(assume(A), assumed(A), Arrow(A, A)), arrowI(assume(B), FE(notE(assumed(B), p2, false()), A), Arrow(B, A)), A)
def doubleNeg(p, a): l1 = LEM(Or(a, Not(a))) l2 = assume(a) l3 = assumed(a) l4 = arrowI(l2, l3, Arrow(a, a)) l5 = assume(Not(a)) l6 = assumed(Not(a)) l7 = notE(l6, p, false()) l8 = FE(l7, a) l9 = arrowI(l5, l8, Arrow(Not(a), a)) l10 = orE(l1, l4, l9, a) return l10
def DM1(): A = Var("a") B = Var("b") p1 = premise(Or(Not(A), Not(B))) end = Not(And(A, B)) A_B = And(A, B) #I condensed parts of the proofs so I could substitute in things that made sense to me, otherwise I was going nuts 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)