from proveit.basiclogic import Implies, derive_stmt_eq_true from proveit.common import A Implies(A, derive_stmt_eq_true(A).conclude_boolean_equality().derive_reversed() ).generalize(A).qed(__file__)
from proveit.basiclogic.booleans.axioms import not_t from proveit.basiclogic.booleans.theorems import not_from_eq_false from proveit.basiclogic import Implies, Not, derive_stmt_eq_true from proveit.common import A, X # A=TRUE assuming A AeqT = derive_stmt_eq_true(A) # [Not(A)=FALSE] assuming A=TRUE AeqT.substitution(Not(A)).apply_transitivity(not_t).proven({AeqT}) # [Not(A)=FALSE] => Not(Not(A)) not_from_eq_false.instantiate({A: Not(A)}).proven() # forall_{A} A => Not(Not(A)) Implies(A, Not(Not(A))).generalize(A).qed(__file__)
from proveit.basiclogic.booleans.theorems import fold_forall_over_bool from proveit.basiclogic import Implies, derive_stmt_eq_true from proveit.common import P # P(TRUE) and P(FALSE) => forall_{A in BOOLEANS} P(A) folding = fold_forall_over_bool.instantiate() # forall_{P} [P(TRUE) and P(FALSE)] => {[forall_{A in BOOLEANS} P(A)] = TRUE} Implies(folding.hypothesis, derive_stmt_eq_true( folding.derive_conclusion())).generalize(P).qed(__file__)
from proveit.basiclogic.booleans.axioms import or_t_f from proveit.basiclogic.booleans.theorems import true_not_false, true_eq_true from proveit.basiclogic import TRUE, FALSE, in_bool, Or, Equals, derive_stmt_eq_true from proveit.common import X # [TRUE or FALSE] or_t_f.derive_via_boolean_equality().proven() # [TRUE or TRUE=FALSE] via [TRUE or FALSE] and TRUE != FALSE true_not_false.unfold().equate_negated_to_false().sub_left_side_into( Or(TRUE, X), X).proven() # [TRUE=TRUE or TRUE=FALSE] via [TRUE or TRUE=FALSE] and TRUE=TRUE derive_stmt_eq_true(true_eq_true).sub_left_side_into( Or(X, Equals(TRUE, FALSE)), X).proven() # in_bool(TRUE) via [TRUE=TRUE or TRUE=FALSE] in_bool(TRUE).conclude_as_folded().qed(__file__)
from proveit.basiclogic.booleans.axioms import exists_def from proveit.basiclogic import Forall, NotEquals, Implies, TRUE, FALSE, derive_stmt_eq_true, In from proveit.common import X, P, S, x_etc, y_etc, Px_etc, Py_etc, Qetc, etc_Qx_etc, etc_Qy_etc in_domain = In(x_etc, S) # ..x.. in S # never_py = [forall_{..y.. in S | ..Q(..y..)..} (P(..y..) != TRUE)] never_py = Forall(y_etc, NotEquals(Py_etc, TRUE), S, etc_Qy_etc) # (P(..x..) != TRUE) assuming ..Q(..x..).., never_py never_py.instantiate({y_etc: x_etc}).proven({etc_Qx_etc, never_py, in_domain}) # (TRUE != TRUE) assuming ..Q(..x..).., P(..x..), never_py true_not_eq_true = derive_stmt_eq_true(Px_etc).sub_right_side_into( NotEquals(X, TRUE), X).proven({etc_Qx_etc, Px_etc, never_py, in_domain}) # FALSE assuming ..Q(..x..).., P(..x..), never_py true_not_eq_true.evaluation().derive_contradiction().derive_conclusion( ).proven({etc_Qx_etc, Px_etc, never_py, in_domain}) # [forall_{..y.. in S | ..Q(..y..)..} (P(..y..) != TRUE)] in BOOLEANS never_py.deduce_in_bool().proven() # Not(forall_{..y.. in S | ..Q(..y..)..} (P(..y..) != TRUE) assuming # ..Q(..x..).., P(..x..) Implies(never_py, FALSE).derive_via_contradiction().proven( {etc_Qx_etc, Px_etc, in_domain}) # exists_{..y.. in S | ..Q(..y..)..} P(..y..) assuming Q(..x..), P(..x..) existence = exists_def.instantiate({ x_etc: y_etc }).derive_left_via_equality().proven({etc_Qx_etc, Px_etc, in_domain}) # forall_{P, ..Q.., S} forall_{..x.. in S | ..Q(..x..)..} [P(..x..) => # exists_{..y.. in S | ..Q(..y..)..} P(..y..)] Implies(Px_etc, existence).generalize(x_etc, S, etc_Qx_etc).generalize( (P, Qetc, S)).qed(__file__)
from proveit.basiclogic.booleans.axioms import iff_def from proveit.basiclogic.booleans.theorems import implies_t_t from proveit.basiclogic import compose, TRUE, derive_stmt_eq_true from proveit.common import A, B # TRUE => TRUE TimplT = implies_t_t.derive_via_boolean_equality() # (TRUE => TRUE) and (TRUE => TRUE) = TRUE TimplTandTimplT_eq_T = derive_stmt_eq_true(compose(TimplT, TimplT)) # (TRUE <=> TRUE) = TRUE iff_def.instantiate({ A: TRUE, B: TRUE }).apply_transitivity(TimplTandTimplT_eq_T).qed(__file__)
from proveit.basiclogic import BOOLEANS, TRUE, FALSE, in_bool, Implies, And, derive_stmt_eq_true, 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) # in_bool(A=TRUE), in_bool(A=FALSE), in_bool(P(A) = TRUE) AeqT = Equals(A, TRUE) AeqF = Equals(A, FALSE) PofAeqT = Equals(PofA, TRUE) for eq_expr in (AeqT, AeqF, PofAeqT): eq_expr.deduce_in_bool() # P(TRUE), P(FALSE) assuming hypothesis for case in hypothesis.decompose(): case.proven({hypothesis}) # A=TRUE => P(A)=TRUE assuming hypothesis Implies(AeqT, derive_stmt_eq_true(AeqT.sub_left_side_into(PofA, A))).proven({hypothesis}) # A=FALSE => P(A)=TRUE assuming hypothesis Implies(AeqF, derive_stmt_eq_true(AeqF.sub_left_side_into(PofA, A))).proven({hypothesis}) # P(A) assuming hypothesis, (A in BOOLEANS) in_bool(A).unfold().derive_common_conclusion( PofAeqT).derive_via_boolean_equality().proven({hypothesis, in_bool(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__)
from proveit.basiclogic.booleans.theorems import true_conclusion from proveit.basiclogic import derive_stmt_eq_true, FALSE from proveit.common import A derive_stmt_eq_true(true_conclusion.instantiate({A: FALSE})).qed(__file__)
from proveit.basiclogic.booleans.theorems import true_and_true from proveit.basiclogic import derive_stmt_eq_true, And, TRUE from proveit.common import A, B, X # A=TRUE assuming A AeqT = derive_stmt_eq_true(A).proven({A}) # B=TRUE assuming B BeqT = derive_stmt_eq_true(B).proven({B}) # TRUE AND TRUE true_and_true # (TRUE and B) assuming B via (TRUE and TRUE) BeqT.sub_left_side_into(And(TRUE, X), X).proven({B}) # (A and B) assuming A, B via (TRUE and TRUE) AeqT.sub_left_side_into(And(X, B), X).proven({A, B}) # forall_{A | A, B | B} (A and B) And(A, B).generalize((A, B), conditions=(A, B)).qed(__file__)
from proveit.basiclogic.booleans.theorems import self_implication from proveit.basiclogic import derive_stmt_eq_true, FALSE from proveit.common import A derive_stmt_eq_true(self_implication.instantiate({A: FALSE})).qed(__file__)
from proveit.basiclogic import BOOLEANS, FALSE, in_bool, Implies, And, Or, Not, derive_stmt_eq_true from proveit.common import A, B, C, X AorB = Or(A, B) hypothesis = And(Implies(A, C), Implies(B, C)) ABCareBool = {in_bool(A), in_bool(B), in_bool(C)} # A=>C, B=>C assuming (A=>C and B=>C) AimplC, _ = hypothesis.decompose() # Not(A) assuming in_bool(A), in_bool(B), (A=>C and B=>C), Not(C) AimplC.transpose().derive_conclusion().proven( {in_bool(A), in_bool(C), hypothesis, Not(C)}) # B assuming in_bool(A, B, C), (A=>C and B=>C), (A or B), Not(C) AorB.derive_right_if_not_left().proven(ABCareBool | {hypothesis, AorB, Not(C)}) # Not(TRUE) assuming in_bool(A, B, C), (A=>C and B=>C), (A or B), Not(C) derive_stmt_eq_true(C).sub_right_side_into( Not(X), X).proven( ABCareBool | { hypothesis, AorB, Not(C)}) # FALSE assuming in_bool(A, B, C), (A=>C and B=>C), (A or B), Not(C) not_t.derive_right_via_equality().proven( ABCareBool | {hypothesis, AorB, Not(C)}) # Contradiction proof of C assuming (A=>C and B=>C), (A or B), in_bool(A), # and in_bool(B) Implies( Not(C), FALSE).derive_via_contradiction().proven( ABCareBool | { hypothesis, AorB}) # forall_{A, B, C in BOOLEANS} (A=>C and B=>C) => ((A or B) => C) Implies(hypothesis, Implies(AorB, C)).generalize( (A, B, C), domain=BOOLEANS).qed(__file__)
from proveit.basiclogic.booleans.axioms import or_f_t, false_not_true from proveit.basiclogic.booleans.theorems import false_eq_false from proveit.basiclogic import FALSE, in_bool, Or, Equals, derive_stmt_eq_true from proveit.common import X # [FALSE or TRUE] or_f_t.derive_via_boolean_equality().proven() # [FALSE or FALSE=FALSE] via [FALSE or TRUE] and FALSE=FALSE derive_stmt_eq_true(false_eq_false).sub_left_side_into(Or(FALSE, X), X).proven() # [FALSE=TRUE or FALSE=FALSE] via [FALSE or FALSE=FALSE] and Not(FALSE=TRUE) false_not_true.unfold().equate_negated_to_false().sub_left_side_into( Or(X, Equals(FALSE, FALSE)), X).proven() # in_bool(FALSE) via [FALSE=TRUE or FALSE=FALSE] in_bool(FALSE).conclude_as_folded().qed(__file__)
from proveit.basiclogic.booleans.axioms import iff_def from proveit.basiclogic.booleans.theorems import implies_f_f from proveit.basiclogic import compose, FALSE, derive_stmt_eq_true from proveit.common import A, B # FALSE => FALSE FimplF = implies_f_f.derive_via_boolean_equality() # (FALSE => FALSE) and (FALSE => FALSE) = TRUE FimplFandFimplF_eq_T = derive_stmt_eq_true(compose(FimplF, FimplF)) # (FALSE <=> FALSE) = TRUE iff_def.instantiate({ A: FALSE, B: FALSE }).apply_transitivity(FimplFandFimplF_eq_T).qed(__file__)