logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.linear_maps

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, Function, K, P, Px, Py, V, W, c, x, y
from proveit.linear_algebra import LinMap, ScalarMult, VecAdd
from proveit.logic import And, Equals, Forall, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = ExprTuple(InSet(P, LinMap(V, W)), And(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(Px, W), domain = V), Forall(instance_param_or_params = [x, y], instance_expr = Equals(Function(P, [VecAdd(x, y)]), VecAdd(Px, Py)), domain = V), Forall(instance_param_or_params = [c], instance_expr = Forall(instance_param_or_params = sub_expr1, instance_expr = Equals(Function(P, [ScalarMult(c, x)]), ScalarMult(c, Px)), domain = V), domain = K)).with_wrapping_at(2,4))
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(P \in \mathcal{L}\left(V, W\right), \begin{array}{c} \left[\forall_{x \in V}~\left(P\left(x\right) \in W\right)\right] \land  \\ \left[\forall_{x, y \in V}~\left(P\left(x + y\right) = \left(P\left(x\right) + P\left(y\right)\right)\right)\right] \land  \\ \left[\forall_{c \in K}~\left[\forall_{x \in V}~\left(P\left(c \cdot x\right) = \left(c \cdot P\left(x\right)\right)\right)\right]\right] \end{array}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 52
operands: 3
2Operationoperator: 28
operands: 4
3ExprTuple64, 5
4ExprTuple6, 7, 8
5Operationoperator: 9
operands: 10
6Operationoperator: 30
operand: 14
7Operationoperator: 30
operand: 15
8Operationoperator: 30
operand: 16
9Literal
10ExprTuple57, 33
11ExprTuple14
12ExprTuple15
13ExprTuple16
14Lambdaparameter: 67
body: 17
15Lambdaparameters: 48
body: 18
16Lambdaparameter: 66
body: 20
17Conditionalvalue: 21
condition: 46
18Conditionalvalue: 22
condition: 23
19ExprTuple66
20Conditionalvalue: 24
condition: 25
21Operationoperator: 52
operands: 26
22Operationoperator: 50
operands: 27
23Operationoperator: 28
operands: 29
24Operationoperator: 30
operand: 37
25Operationoperator: 52
operands: 32
26ExprTuple61, 33
27ExprTuple34, 35
28Literal
29ExprTuple46, 36
30Literal
31ExprTuple37
32ExprTuple66, 38
33Variable
34Operationoperator: 64
operand: 43
35Operationoperator: 47
operands: 40
36Operationoperator: 52
operands: 41
37Lambdaparameter: 67
body: 42
38Variable
39ExprTuple43
40ExprTuple61, 44
41ExprTuple54, 57
42Conditionalvalue: 45
condition: 46
43Operationoperator: 47
operands: 48
44Operationoperator: 64
operand: 54
45Operationoperator: 50
operands: 51
46Operationoperator: 52
operands: 53
47Literal
48ExprTuple67, 54
49ExprTuple54
50Literal
51ExprTuple55, 56
52Literal
53ExprTuple67, 57
54Variable
55Operationoperator: 64
operand: 60
56Operationoperator: 62
operands: 59
57Variable
58ExprTuple60
59ExprTuple66, 61
60Operationoperator: 62
operands: 63
61Operationoperator: 64
operand: 67
62Literal
63ExprTuple66, 67
64Variable
65ExprTuple67
66Variable
67Variable