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 ScalarMult, VecAdd
from proveit.logic import Equals, Forall, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = ExprTuple(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))
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(\forall_{x \in V}~\left(P\left(x\right) \in W\right), \forall_{x, y \in V}~\left(P\left(x + y\right) = \left(P\left(x\right) + P\left(y\right)\right)\right), \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)
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, 3
1Operationoperator: 23
operand: 7
2Operationoperator: 23
operand: 8
3Operationoperator: 23
operand: 9
4ExprTuple7
5ExprTuple8
6ExprTuple9
7Lambdaparameter: 60
body: 10
8Lambdaparameters: 41
body: 11
9Lambdaparameter: 59
body: 13
10Conditionalvalue: 14
condition: 39
11Conditionalvalue: 15
condition: 16
12ExprTuple59
13Conditionalvalue: 17
condition: 18
14Operationoperator: 45
operands: 19
15Operationoperator: 43
operands: 20
16Operationoperator: 21
operands: 22
17Operationoperator: 23
operand: 30
18Operationoperator: 45
operands: 25
19ExprTuple54, 26
20ExprTuple27, 28
21Literal
22ExprTuple39, 29
23Literal
24ExprTuple30
25ExprTuple59, 31
26Variable
27Operationoperator: 57
operand: 36
28Operationoperator: 40
operands: 33
29Operationoperator: 45
operands: 34
30Lambdaparameter: 60
body: 35
31Variable
32ExprTuple36
33ExprTuple54, 37
34ExprTuple47, 50
35Conditionalvalue: 38
condition: 39
36Operationoperator: 40
operands: 41
37Operationoperator: 57
operand: 47
38Operationoperator: 43
operands: 44
39Operationoperator: 45
operands: 46
40Literal
41ExprTuple60, 47
42ExprTuple47
43Literal
44ExprTuple48, 49
45Literal
46ExprTuple60, 50
47Variable
48Operationoperator: 57
operand: 53
49Operationoperator: 55
operands: 52
50Variable
51ExprTuple53
52ExprTuple59, 54
53Operationoperator: 55
operands: 56
54Operationoperator: 57
operand: 60
55Literal
56ExprTuple59, 60
57Variable
58ExprTuple60
59Variable
60Variable