Exemplo n.º 1
0
from proveit.basiclogic import BOOLEANS, TRUE, FALSE, inBool, Implies, And, deriveStmtEqTrue, Equals
from proveit.common import A, P, PofA
from proveit.basiclogic.common import PofTrue, PofFalse

# hypothesis = [P(TRUE) and P(FALSE)]
hypothesis = And(PofTrue, PofFalse)
# inBool(A=TRUE), inBool(A=FALSE), inBool(P(A) = TRUE)
AeqT = Equals(A, TRUE)
AeqF = Equals(A, FALSE)
PofAeqT = Equals(PofA, TRUE)
for eqExpr in (AeqT, AeqF, PofAeqT):
    eqExpr.deduceInBool()
# P(TRUE), P(FALSE) assuming hypothesis
for case in hypothesis.decompose(): case.proven({hypothesis})
# A=TRUE => P(A)=TRUE assuming hypothesis
Implies(AeqT, deriveStmtEqTrue(AeqT.subLeftSideInto(PofA, A))).proven({hypothesis})
# A=FALSE => P(A)=TRUE assuming hypothesis
Implies(AeqF, deriveStmtEqTrue(AeqF.subLeftSideInto(PofA, A))).proven({hypothesis})
# P(A) assuming hypothesis, (A in BOOLEANS)
inBool(A).unfold().deriveCommonConclusion(PofAeqT).deriveViaBooleanEquality().proven({hypothesis, inBool(A)})
# forall_{P} P(TRUE) and P(FALSE) => forall_{A in BOOLEANS} P(A)
Implies(hypothesis, PofA.generalize(A, domain=BOOLEANS)).generalize(P).qed(__file__)
Exemplo n.º 2
0
from proveit.basiclogic.boolean.theorems import trueInBool
from proveit.basiclogic import TRUE, inBool, Implies, Equals
from proveit.common import A, X

# hypothesis = (A=TRUE)
hypothesis = Equals(A, TRUE)
# inBool(TRUE)
trueInBool.proven()
# inBool(A) assuming hypothesis
conclusion = hypothesis.subLeftSideInto(inBool(X), X).proven({hypothesis})
# forall_{A} A=TRUE => inBool(A)
Implies(hypothesis, conclusion).generalize(A).qed(__file__)
Exemplo n.º 3
0
from proveit.basiclogic.boolean.theorems import notFalse
from proveit.basiclogic import Implies, Not, Equals, FALSE
from proveit.common import A, X

# AeqF := (A=F)
AeqF = Equals(A, FALSE)
# Not(FALSE)
notFalse
# Not(A) assuming A=FALSE because Not(FALSE)
notA = AeqF.subLeftSideInto(Not(X), X).proven({AeqF})
Implies(AeqF, notA).generalize(A).qed(__file__)