logo

Expression of type ExprTuple

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

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, ExprTuple, Lambda, a, b, f, fa, fb
from proveit.logic import And, Equals, Forall, Functions, InSet, Injections, NotEquals
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(f, Equals(InSet(f, Injections(A, B)), And(InSet(f, Functions(A, B)), Forall(instance_param_or_params = [a, b], instance_expr = NotEquals(fa, fb), domain = A, condition = NotEquals(a, b)))).with_wrapping_at(2)))
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(f \mapsto \left(\begin{array}{c} \begin{array}{l} \left(f \in \left[A \xrightarrow[]{\text{1-to-1}} B\right]\right) =  \\ \left(\left(f \in \left[A \rightarrow B\right]\right) \land \left[\forall_{a, b \in A~|~a \neq b}~\left(f\left(a\right) \neq f\left(b\right)\right)\right]\right) \end{array} \end{array}\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
1Lambdaparameter: 34
body: 3
2ExprTuple34
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 37
operands: 8
7Operationoperator: 26
operands: 9
8ExprTuple34, 10
9ExprTuple11, 12
10Operationoperator: 13
operands: 20
11Operationoperator: 37
operands: 14
12Operationoperator: 15
operand: 18
13Literal
14ExprTuple34, 17
15Literal
16ExprTuple18
17Operationoperator: 19
operands: 20
18Lambdaparameters: 40
body: 21
19Literal
20ExprTuple41, 22
21Conditionalvalue: 23
condition: 24
22Variable
23Operationoperator: 39
operands: 25
24Operationoperator: 26
operands: 27
25ExprTuple28, 29
26Literal
27ExprTuple30, 31, 32
28Operationoperator: 34
operand: 42
29Operationoperator: 34
operand: 43
30Operationoperator: 37
operands: 36
31Operationoperator: 37
operands: 38
32Operationoperator: 39
operands: 40
33ExprTuple42
34Variable
35ExprTuple43
36ExprTuple42, 41
37Literal
38ExprTuple43, 41
39Literal
40ExprTuple42, 43
41Variable
42Variable
43Variable