import proveit
from proveit.logic import Boolean, TRUE, FALSE, in_bool, Implies, Not, And, Or, Forall
from proveit.logic import Equals, NotEquals, InSet
from proveit import A, B, C, P, Q, PofA, QofA, Function
from proveit.logic import PofTrue, PofFalse, QimplPofTrue, QimplPofFalse
%begin demonstrations
Equals(TRUE, TRUE).prove()
Equals(FALSE, FALSE).prove()
NotEquals(TRUE, FALSE).prove()
in_bool(A).fold(assumptions=[Or(Equals(A, TRUE), Equals(A, FALSE))])
InSet(TRUE, Boolean).prove()
InSet(FALSE, Boolean).prove()
in_bool(A).prove(assumptions=[A])
in_bool_if_false
in_bool(A).conclude(assumptions=[Not(A)])
NotEquals(A, FALSE).prove(assumptions=[A])
from_not_false
A.prove(assumptions=[NotEquals(A, FALSE), in_bool(A)])
fold_forall_over_bool
Forall(A, PofA, domain=Boolean).prove(assumptions=[PofTrue, PofFalse])
fold_conditioned_forall_over_bool
Forall(A, PofA, domain=Boolean, conditions=[QofA]).prove(assumptions=[QimplPofTrue, QimplPofFalse])
forall_bool_eval_true
Equals(Forall(A, PofA, domain=Boolean), TRUE).prove(assumptions=[Equals(PofTrue, TRUE), Equals(PofFalse, TRUE)])
unfold_forall_over_bool
Forall(A, PofA, domain=Boolean).unfold(assumptions=[Forall(A, PofA, domain=Boolean)])
ForallBoolEvalFalseViaFF
#Implies(And(Equals(PofTrue, FALSE), Equals(PofFalse, FALSE)), Equals(Forall(A, PofA, domain=Boolean), FALSE)).prove().proof()
ForallBoolEvalFalseViaFT
#Implies(And(Equals(PofTrue, FALSE), Equals(PofFalse, TRUE)), Equals(Forall(A, PofA, domain=Boolean), FALSE)).prove().proof()
ForallBoolEvalFalseViaTF
#Implies(And(Equals(PofTrue, TRUE), Equals(PofFalse, FALSE)), Equals(Forall(A, PofA, domain=Boolean), FALSE)).prove().proof()
Or(A, Not(A)).prove(assumptions=[in_bool(A)])
from_excluded_middle
Forall(A, C, domain=Boolean,conditions=[Implies(A, C),Implies(Not(A), C)]).prove()
example_forall = Forall(A, Forall(B, Function(P, [A, B]), domain=Boolean), domain=Boolean)
example_forall.all_instance_exprs()[-1]
%end demonstrations