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 A, B, Conditional, ExprTuple, Function, K, Lambda, V, W, x
from proveit.linear_algebra import LinMap, VecAdd, VecSpaces
from proveit.logic import And, Equals, Forall, InClass, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
sub_expr2 = VecSpaces(K)
expr = ExprTuple(Lambda([V, W], Conditional(Forall(instance_param_or_params = [A, B], instance_expr = Equals(VecAdd(A, B), Lambda(x, Conditional(VecAdd(Function(A, sub_expr1), Function(B, sub_expr1)), InSet(x, V)))), domain = LinMap(V, W)), And(InClass(V, sub_expr2), InClass(W, sub_expr2)))))
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(\left(V, W\right) \mapsto \left\{\forall_{A, B \in \mathcal{L}\left(V, W\right)}~\left(\left(A + B\right) = \left[x \mapsto \left\{A\left(x\right) + B\left(x\right) \textrm{ if } x \in V\right..\right]\right) \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right) ,  W \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\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
1Lambdaparameters: 41
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 20
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameters: 29
body: 11
9Operationoperator: 13
operands: 12
10Operationoperator: 13
operands: 14
11Conditionalvalue: 15
condition: 16
12ExprTuple44, 17
13Literal
14ExprTuple45, 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Operationoperator: 22
operand: 28
18Literal
19ExprTuple24, 25
20Literal
21ExprTuple26, 27
22Literal
23ExprTuple28
24Operationoperator: 36
operands: 29
25Lambdaparameter: 49
body: 30
26Operationoperator: 38
operands: 31
27Operationoperator: 38
operands: 32
28Variable
29ExprTuple46, 47
30Conditionalvalue: 33
condition: 34
31ExprTuple46, 35
32ExprTuple47, 35
33Operationoperator: 36
operands: 37
34Operationoperator: 38
operands: 39
35Operationoperator: 40
operands: 41
36Literal
37ExprTuple42, 43
38Literal
39ExprTuple49, 44
40Literal
41ExprTuple44, 45
42Operationoperator: 46
operand: 49
43Operationoperator: 47
operand: 49
44Variable
45Variable
46Variable
47Variable
48ExprTuple49
49Variable