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, VecSpaces
from proveit.logic import Equals, Forall, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [V, W], instance_expr = Forall(instance_param_or_params = [c], instance_expr = 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)), domain = K), domain = VecSpaces(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(K \mapsto \left[\forall_{V, W \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{c \in K}~\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)\right]\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: 28
body: 2
2Operationoperator: 22
operand: 4
3ExprTuple4
4Lambdaparameters: 42
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 22
operand: 11
7Operationoperator: 9
operands: 10
8ExprTuple11
9Literal
10ExprTuple12, 13
11Lambdaparameter: 50
body: 15
12Operationoperator: 17
operands: 16
13Operationoperator: 17
operands: 18
14ExprTuple50
15Conditionalvalue: 19
condition: 20
16ExprTuple52, 21
17Literal
18ExprTuple45, 21
19Operationoperator: 22
operand: 27
20Operationoperator: 48
operands: 24
21Operationoperator: 25
operand: 28
22Literal
23ExprTuple27
24ExprTuple50, 28
25Literal
26ExprTuple28
27Lambdaparameter: 53
body: 30
28Variable
29ExprTuple53
30Conditionalvalue: 31
condition: 32
31Operationoperator: 33
operands: 34
32Operationoperator: 48
operands: 35
33Literal
34ExprTuple36, 37
35ExprTuple53, 38
36Operationoperator: 46
operands: 39
37Lambdaparameter: 55
body: 40
38Operationoperator: 41
operands: 42
39ExprTuple50, 53
40Conditionalvalue: 43
condition: 44
41Literal
42ExprTuple52, 45
43Operationoperator: 46
operands: 47
44Operationoperator: 48
operands: 49
45Variable
46Literal
47ExprTuple50, 51
48Literal
49ExprTuple55, 52
50Variable
51Operationoperator: 53
operand: 55
52Variable
53Variable
54ExprTuple55
55Variable