logo

Expression of type ExprTuple

from the theory of proveit.logic.sets.comprehension

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import ExprTuple, Lambda, Q, Qx, S, x
from proveit.logic import Forall, InSet
from proveit.logic.sets import basic_comprehension_y
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([S, Q], Forall(instance_param_or_params = [x], instance_expr = InSet(x, basic_comprehension_y), domain = S, condition = Qx)))
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\left(\left(S, Q\right) \mapsto \left[\forall_{x \in S~|~Q\left(x\right)}~\left(x \in \left\{y~|~Q\left(y\right)\right\}_{y \in S}\right)\right]\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 2
body: 3
2ExprTuple31, 29
3Operationoperator: 4
operand: 6
4Literal
5ExprTuple6
6Lambdaparameter: 20
body: 7
7Conditionalvalue: 8
condition: 9
8Operationoperator: 27
operands: 10
9Operationoperator: 23
operands: 11
10ExprTuple20, 12
11ExprTuple13, 14
12Operationoperator: 15
operand: 19
13Operationoperator: 27
operands: 17
14Operationoperator: 29
operand: 20
15Literal
16ExprTuple19
17ExprTuple20, 31
18ExprTuple20
19Lambdaparameter: 32
body: 21
20Variable
21Conditionalvalue: 32
condition: 22
22Operationoperator: 23
operands: 24
23Literal
24ExprTuple25, 26
25Operationoperator: 27
operands: 28
26Operationoperator: 29
operand: 32
27Literal
28ExprTuple32, 31
29Variable
30ExprTuple32
31Variable
32Variable