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 And, Forall, Exists, Implies, in_bool, InSet, Equals, Not, NotInSet
from proveit.logic import SetEquiv, SetNotEquiv, SubsetEq, NotSubsetEq, superset_eq
from proveit.logic import ProperSubset, NotProperSubset
from proveit import A, B, C, x, y, P, Px, Py
%begin theorems
# Proven
unfold_subset_eq = Forall((A, B), Forall(x, InSet(x, B), domain=A), conditions=SubsetEq(A, B))
unfold_subset_eq_contrapositive = Forall((A, B), Forall(x, NotInSet(x, A), conditions=NotInSet(x, B)), conditions=SubsetEq(A, B))
# Proven
fold_subset_eq = Forall((A, B), SubsetEq(A, B), condition=Forall(x, InSet(x, B), domain=A))
# Proven
unfold_not_subset_eq = Forall((A, B), Not(SubsetEq(A, B)), conditions=[NotSubsetEq(A, B)])
# Proven
fold_not_subset_eq = Forall((A, B), NotSubsetEq(A, B), conditions=[Not(SubsetEq(A, B))])
refined_nonmembership = Forall((A, B, x), NotInSet(x, A),
conditions=[SubsetEq(A, B),
NotInSet(x, B)])
# Proven
unfold_proper_subset = Forall((A, B), And(SubsetEq(A, B), SetNotEquiv(B, A)), conditions=[ProperSubset(A, B)])
# Proven
fold_proper_subset = Forall((A, B), ProperSubset(A, B), conditions=[And(SubsetEq(A, B), SetNotEquiv(B, A))])
# Proven
unfold_not_proper_subset = Forall((A, B), Not(ProperSubset(A, B)), condition=NotProperSubset(A, B))
# Proven
fold_not_proper_subset = Forall((A, B), NotProperSubset(A, B), condition=Not(ProperSubset(A, B)))
superset_membership_from_proper_subset = Forall((A, B), Forall(x, InSet(x, B), domain=A),
condition=ProperSubset(A, B))
# Proven
subset_eq_reflexive = Forall(A, SubsetEq(A, A))
# Proven
relax_proper_subset = Forall((A, B), SubsetEq(A, B), conditions=[ProperSubset(A, B)])
subset_eq_via_equivalence = Forall((A, B), SubsetEq(A, B), conditions=[SetEquiv(A, B)])
subset_eq_via_equality = Forall((A, B), SubsetEq(A, B), conditions=[Equals(A, B)])
# working
transitivity_subset_subset = Forall((A, B, C), ProperSubset(A, C), conditions=[ProperSubset(A, B), ProperSubset(B, C)])
transitivity_subset_eq_subset = Forall((A, B, C), ProperSubset(A, C), conditions=[SubsetEq(A, B), ProperSubset(B, C)])
transitivity_subset_subset_eq = Forall((A, B, C), ProperSubset(A, C), conditions=[ProperSubset(A, B), SubsetEq(B, C)])
# Proven
transitivity_subset_eq_subset_eq = Forall((A, B, C), SubsetEq(A, C), conditions=[SubsetEq(A, B), SubsetEq(B, C)])
inclusive_universal_quantification = Forall(
(A, B, P), Implies(Forall(x, Px, domain=A),
Forall(y, Py, domain=B)),
condition = superset_eq(A, B))
inclusive_existential_quantification = Forall(
(A, B, P), Implies(Exists(x, Px, domain=A),
Exists(y, Py, domain=B)),
condition = SubsetEq(A, B))
subset_eq_is_bool = Forall((A, B), in_bool(SubsetEq(A, B)))
not_subset_eq_is_bool = Forall((A, B), in_bool(NotSubsetEq(A, B)))
proper_subset_is_bool = Forall((A, B), in_bool(ProperSubset(A, B)))
not_proper_subset_is_bool = Forall((A, B), in_bool(NotProperSubset(A, B)))
%end theorems