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