import proveit
# Prepare this notebook for defining the theorems of a theory:
%theorems_notebook # Keep this at the top following 'import proveit'.
from proveit.logic import Equals, NotEquals,Implies, TRUE, FALSE, Iff, Forall, And, Not, in_bool, Boolean
from proveit import A, B, C
%begin theorems
self_implication = Forall(A, Implies(A, A))
true_implies_true = Implies(TRUE, TRUE)
false_implies_false = Implies(FALSE, FALSE)
false_implies_true = Implies(FALSE, TRUE)
implies_t_t = Equals(Implies(TRUE, TRUE), TRUE)
implies_f_f = Equals(Implies(FALSE, FALSE), TRUE)
implies_f_t = Equals(Implies(FALSE, TRUE), TRUE)
true_implies_false_negated = Not(Implies(TRUE, FALSE))
false_antecedent_implication = Forall(A, Implies(FALSE, A), domain=Boolean)
falsified_antecedent_implication = Forall((A, B), Implies(A, B), condition=Not(A))
untrue_antecedent_implication = Forall((A, B), Implies(A, B), condition=NotEquals(A, TRUE))
invalid_implication = Forall((A, B), Not(Implies(A, B)), conditions=[A, Not(B)])
not_true_via_contradiction = Forall(A, NotEquals(A,TRUE), conditions=Implies(A,FALSE))
implication_transitivity = Forall((A, B, C), Implies(A, C), conditions=[Implies(A, B), Implies(B, C)])
modus_tollens_affirmation = Forall(A, Forall(B, A, conditions=[Implies(Not(A), B), Not(B)]), domain=Boolean)
modus_tollens_denial = Forall(A, Forall(B, Not(A), conditions=[Implies(A, B), Not(B)]), domain=Boolean)
negated_reflex = Forall((A,B), Implies(B,A), condition=Not(Implies(A,B)))
iff_intro = Forall((A, B), Iff(A, B), conditions=[Implies(A, B), Implies(B, A)])
iff_via_both_true = Forall((A, B), Iff(A, B), conditions=[A, B])
iff_via_both_false = Forall((A, B), Iff(A, B),
conditions=[Not(A), Not(B)])
not_iff_via_not_right_impl = Forall((A, B), Not(Iff(A, B)), condition=Not(Implies(A, B)))
not_iff_via_not_left_impl = Forall((A, B), Not(Iff(A, B)), condition=Not(Implies(B, A)))
not_iff_via_not_right = Forall((A, B), Not(Iff(A, B)), conditions=[A, Not(B)])
not_iff_via_not_left = Forall((A, B), Not(Iff(A, B)), conditions=[Not(A), B])
true_iff_true = Iff(TRUE, TRUE)
iff_t_t = Equals(Iff(TRUE, TRUE), TRUE)
false_iff_false = Iff(FALSE, FALSE)
iff_f_f = Equals(Iff(FALSE, FALSE), TRUE)
iff_t_f = Equals(Iff(TRUE, FALSE), FALSE)
true_iff_false_negated = Not(Iff(TRUE, FALSE))
iff_f_t = Equals(Iff(FALSE, TRUE), FALSE)
false_iff_true_negated = Not(Iff(FALSE, TRUE))
iff_implies_right = Forall((A, B), Implies(A, B), conditions=[Iff(A, B)])
iff_implies_left = Forall((A, B), Implies(B, A), conditions=[Iff(A, B)])
right_from_iff = Forall((A, B), B, conditions=[A, Iff(A, B)])
left_from_iff = Forall((A, B), A, conditions=[Iff(A, B), B])
iff_symmetry = Forall((A, B), Iff(B, A), conditions=[Iff(A, B)])
iff_transitivity = Forall((A, B, C), Iff(A, C), conditions=[Iff(A, B), Iff(B, C)])
from_contraposition = Forall((A, B), Implies(A, B), conditions=[Implies(Not(B), Not(A)), in_bool(B)])
to_contraposition = Forall((A, B), Implies(Not(B), Not(A)), conditions=[Implies(A, B), in_bool(A)])
contrapose_neg_antecedent = Forall((A, B), Implies(Not(B), A), conditions=[Implies(Not(A), B), in_bool(A)])
contrapose_neg_consequent = Forall((A, B), Implies(B, Not(A)), conditions=[Implies(A, Not(B)), in_bool(A)])
double_negate_consequent = Forall((A, B), Implies(A, Not(Not(B))), conditions=[Implies(A, B)])
eq_from_iff = Forall((A, B), Equals(A, B), conditions=[Iff(A, B)], domain=Boolean)
eq_from_mutual_impl = Forall((A, B), Equals(A, B), conditions=[Implies(A, B), Implies(B, A)], domain=Boolean)
implication_closure = Forall((A, B), in_bool(Implies(A, B)), domain=Boolean)
iff_closure = Forall((A, B), in_bool(Iff(A, B)), domain=Boolean)
%end theorems