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 Conditional, ExprTuple, Function, Lambda, P, Px, V, W, x, y
from proveit.linear_algebra import LinMap, VecAdd
from proveit.logic import Equals, Forall, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(P, Conditional(Forall(instance_param_or_params = [x, y], instance_expr = Equals(Function(P, [VecAdd(x, y)]), VecAdd(Px, Function(P, [y]))), domain = V), InSet(P, LinMap(V, W)))))
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 \mapsto \left\{\forall_{x, y \in V}~\left(P\left(x + y\right) = \left(P\left(x\right) + P\left(y\right)\right)\right) \textrm{ if } P \in \mathcal{L}\left(V, W\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
1Lambdaparameter: 37
body: 3
2ExprTuple37
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 28
operands: 8
6Literal
7ExprTuple9
8ExprTuple37, 10
9Lambdaparameters: 35
body: 11
10Operationoperator: 12
operands: 13
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple33, 16
14Operationoperator: 17
operands: 18
15Operationoperator: 19
operands: 20
16Variable
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple23, 24
21Operationoperator: 37
operand: 30
22Operationoperator: 34
operands: 26
23Operationoperator: 28
operands: 27
24Operationoperator: 28
operands: 29
25ExprTuple30
26ExprTuple31, 32
27ExprTuple39, 33
28Literal
29ExprTuple40, 33
30Operationoperator: 34
operands: 35
31Operationoperator: 37
operand: 39
32Operationoperator: 37
operand: 40
33Variable
34Literal
35ExprTuple39, 40
36ExprTuple39
37Variable
38ExprTuple40
39Variable
40Variable