from proveit.logic import in_bool, Implies, Not, Equals, NotEquals, FALSE, TRUE, NotEquals, Iff, And
from proveit import A, B, C, D
%begin demonstrations
D.prove(assumptions=[A, Implies(A, B), Implies(B, C), Implies(C, D)])
Implies(A, B).contrapose(assumptions=[Implies(A, B), in_bool(A)])
Implies(Not(A), B).contrapose(assumptions=[Implies(Not(A), B), in_bool(A)])
Implies(A, Not(B)).contrapose(assumptions=[Implies(A, Not(B)), in_bool(A)])
Implies(Not(A), Not(B)).contrapose(assumptions=[Implies(Not(A), Not(B)), in_bool(A)])
From tutorial number 3 (implication):
An implication has an antecedent and a consequent. If the antecedent is true, the consequent must also be true. Prove-It has an Implies
operation that may be used to represent an implication, formatted with the $\Rightarrow$ symbol.
Below, it makes sense that True
would imply itself, similar to the fact that $x$ is equal to itself. If we can prove that the Left Hand Side
of the implication
is True
then we can automatically prove that the Right Hand Side
is True
as well.
Implies(TRUE, TRUE).prove()
Based upon the above explanation, we can also prove that this expression is True
.
Equals(Implies(TRUE, TRUE), TRUE).prove()
On the other hand. If we can prove that the Left Hand Side
is False
it doesn't matter what the Right Hand Side
is because the entire expression is false. This is taken to the extreme in the Boolean
case where False
implies both False
(which makes sense) and True
.
Implies(FALSE, FALSE).prove()
Therefore, the expression is True
.
Implies(FALSE, FALSE).evaluation()
While False
$\Rightarrow$ True
may seem contradictory, the Right Hand Side
of the expression doesn't matter because the Left Hand Side
is False
. Therefore, we can automatically conclude that the expression is False
.
Implies(FALSE, TRUE).prove()
Similarly, this expression is True
.
Equals(Implies(FALSE, TRUE), TRUE).prove()
However, the only expression of this type that does not evaluate to True
, is the case where True
implies False
. This case cannot be True
because we automatically conclude the Right Hand Side
to be True
if the Left Hand Side
is True
. In this case, the Right Hand Side
is False
, therefore the expresssion cannot be True
.
Equals(Implies(TRUE, FALSE),FALSE).prove()
Similar to the way that we can prove True
$\Rightarrow$ True
, we can also prove that anything implies itself.
Implies(B,B).prove()
Not(Implies(TRUE, FALSE)).prove()
The following case is another example of the fact that it doesn't matter what the Right Hand Side
is if the Left Hand Side
is False
. This time, we are given $\lnot A$, which we take to be True
. Then, by definition, $A$ must be False
. Therefore, the Right Hand Side
can be anything, in this case $B$.
nA = Not(A)
Implies(A,B).prove(assumptions=[nA])
Implies(A, C).prove(assumptions=[Implies(A,B), Implies(B,C)])
A.prove(assumptions=[Implies(Not(A),FALSE), in_bool(A)])
Implies(Not(A),B).deny_antecedent(assumptions=[Not(B), in_bool(A), Implies(Not(A),B)])
Implies(A,B).deny_antecedent(assumptions=[Not(B), in_bool(A), Implies(A,B)])
Not(A).prove(assumptions=[Implies(A, FALSE),in_bool(A)])
Implies(A,FALSE).derive_via_contradiction(assumptions=[Implies(A, FALSE)])
Implies(B,A).prove(assumptions=[Not(Implies(A,B))])
Iff(A, B).prove(assumptions=[Implies(A,B), Implies(B,A)])
Not(Iff(B,A)).prove(assumptions=[Not(Implies(B,A))])
Not(Iff(B,A)).prove(assumptions=[Not(Implies(A,B))])
Iff(TRUE, TRUE).prove()
Equals(Iff(TRUE, TRUE), TRUE).prove()
Iff(FALSE, FALSE).prove()
Equals(Iff(FALSE, FALSE), TRUE).prove()
Equals(Iff(TRUE, FALSE), FALSE).prove()
Not(Iff(TRUE, FALSE)).prove()
Equals(Iff(FALSE, TRUE), FALSE).prove()
Not(Iff(FALSE, TRUE)).prove()
Implies(A,B).prove(assumptions=[Iff(A,B)])
Implies(A,B).prove(assumptions=[Iff(B,A)])
Iff(A,B).derive_right(assumptions=[A, Iff(A,B)])
Iff(A,B).derive_left(assumptions=[A, Iff(A,B)])
Iff(B,A).prove(assumptions=[Iff(A,B)])
Iff(A,B).apply_transitivity(Iff(B,C), assumptions=[Iff(A,B), Iff(B,C)])
SEE CONTRAPOSITION ABOVE
Implies(A, Not(Not(B))).conclude_via_double_negation(assumptions=[Implies(A,B)])
Equals(A,B).prove(assumptions=[Iff(A,B),in_bool(B), in_bool(A)])
Equals(A,B).prove(assumptions=[Implies(A,B), Implies(B,A), in_bool(B), in_bool(A)])
in_bool(Implies(A,B)).prove(assumptions=[in_bool(B), in_bool(A)])
in_bool(Iff(A,B)).prove(assumptions=[in_bool(B), in_bool(A)])
Iff(A, B).definition()
%end demonstrations