logo

Common expressions for the theory of proveit.logic.sets

In [1]:
import proveit
# Prepare this notebook for defining the common expressions of a theory:
%common_expressions_notebook # Keep this at the top following 'import proveit'.
from proveit import Lambda, ExprRange, IndexedVar
from proveit import i, l, m, n, x, y, A, S, fy, Qy
from proveit.core_expr_types import y_1_to_n, f__y_1_to_n, Q__y_1_to_n, S_1_to_n, R__y_1_to_n
from proveit.logic import (And, Or, Equals, NotEquals, Set, InSet, NotInSet, SubsetEq,
                           SetOfAll, UnionAll, IntersectAll)
from proveit.numbers import one
from proveit.logic.sets.empty_set import EmptySetLiteral
%begin common
Defining common sub-expressions for theory 'proveit.logic.sets'
Subsequent end-of-cell assignments will define common sub-expressions
%end_common will finalize the definitions
In [2]:
EmptySet = EmptySetLiteral()
EmptySet:
In [3]:
each_x_in_S = ExprRange(i, InSet(IndexedVar(x, i), S), one, n)
each_x_in_S:
In [4]:
x_equals_any_y = Or(ExprRange(i, Equals(x, IndexedVar(y, i)), one, n))
x_equals_any_y:
In [5]:
x_notequals_all_y = And(ExprRange(i, NotEquals(x, IndexedVar(y, i)), one, n))
x_notequals_all_y:
In [6]:
x_in_any_A = Or(ExprRange(i, InSet(x, IndexedVar(A, i)), one, m))
x_in_any_A:
In [7]:
x_notin_all_A = And(ExprRange(i, NotInSet(x, IndexedVar(A, i)), one, m))
x_notin_all_A:
In [8]:
x_in_every_A = And(ExprRange(i, InSet(x, IndexedVar(A, i)), one, m))
x_in_every_A:
In [9]:
x_notin_some_A = Or(ExprRange(i, NotInSet(x, IndexedVar(A, i)), one, m))
x_notin_some_A:
In [10]:
x_singletons_range = ExprRange(i, Set(IndexedVar(x, i)), one, n)
x_singletons_range:
In [11]:
each_A_in_S = And(ExprRange(i, SubsetEq(IndexedVar(A, i), S), one, m))
each_A_in_S:
In [12]:
general_comprehension_fy = SetOfAll(y, fy, S, conditions=[Qy])
general_comprehension_fy:
In [13]:
general_comprehension_fyn = SetOfAll(y_1_to_n, f__y_1_to_n, domains=[S_1_to_n], 
                                     conditions=[Q__y_1_to_n])
general_comprehension_fyn:
In [14]:
basic_comprehension_y = SetOfAll(y, y, S, conditions=[Qy])
basic_comprehension_y:
In [15]:
general_unionall_Ryn = UnionAll(y_1_to_n, R__y_1_to_n, domains=[S_1_to_n], 
                                conditions=[Q__y_1_to_n])
general_unionall_Ryn:
In [16]:
general_intersectall_Ryn = IntersectAll(y_1_to_n, R__y_1_to_n, domains=[S_1_to_n], 
                                        conditions=[Q__y_1_to_n])
general_intersectall_Ryn:
In [17]:
%end common
These common expressions may now be imported from the theory package: proveit.logic.sets