logo

Expression of type ExprTuple

from the theory of proveit.logic.sets.functions.surjections

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 A, B, Conditional, ExprTuple, Lambda, f, fx, x
from proveit.logic import Forall, InSet, Surjections
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Surjections(A, B)
expr = ExprTuple(Lambda([A, B], Forall(instance_param_or_params = [f], instance_expr = InSet(f, sub_expr1), condition = InSet(Lambda(x, Conditional(fx, InSet(x, A))), sub_expr1))))
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(A, B\right) \mapsto \left[\forall_{f~|~\left[x \mapsto \left\{f\left(x\right) \textrm{ if } x \in A\right..\right] \in \left[A \xrightarrow[\text{onto}]{} B\right]}~\left(f \in \left[A \xrightarrow[\text{onto}]{} B\right]\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: 16
body: 2
2Operationoperator: 3
operand: 5
3Literal
4ExprTuple5
5Lambdaparameter: 20
body: 7
6ExprTuple20
7Conditionalvalue: 8
condition: 9
8Operationoperator: 22
operands: 10
9Operationoperator: 22
operands: 11
10ExprTuple20, 13
11ExprTuple12, 13
12Lambdaparameter: 24
body: 14
13Operationoperator: 15
operands: 16
14Conditionalvalue: 17
condition: 18
15Literal
16ExprTuple25, 19
17Operationoperator: 20
operand: 24
18Operationoperator: 22
operands: 23
19Variable
20Variable
21ExprTuple24
22Literal
23ExprTuple24, 25
24Variable
25Variable