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 Equals, Forall, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [V, W], instance_expr = 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)), 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_{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)\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: 31
body: 2
2Operationoperator: 8
operand: 4
3ExprTuple4
4Lambdaparameters: 44
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 11
7Operationoperator: 23
operands: 10
8Literal
9ExprTuple11
10ExprTuple12, 13
11Lambdaparameters: 32
body: 14
12Operationoperator: 16
operands: 15
13Operationoperator: 16
operands: 17
14Conditionalvalue: 18
condition: 19
15ExprTuple47, 20
16Literal
17ExprTuple48, 20
18Operationoperator: 21
operands: 22
19Operationoperator: 23
operands: 24
20Operationoperator: 25
operand: 31
21Literal
22ExprTuple27, 28
23Literal
24ExprTuple29, 30
25Literal
26ExprTuple31
27Operationoperator: 39
operands: 32
28Lambdaparameter: 52
body: 33
29Operationoperator: 41
operands: 34
30Operationoperator: 41
operands: 35
31Variable
32ExprTuple49, 50
33Conditionalvalue: 36
condition: 37
34ExprTuple49, 38
35ExprTuple50, 38
36Operationoperator: 39
operands: 40
37Operationoperator: 41
operands: 42
38Operationoperator: 43
operands: 44
39Literal
40ExprTuple45, 46
41Literal
42ExprTuple52, 47
43Literal
44ExprTuple47, 48
45Operationoperator: 49
operand: 52
46Operationoperator: 50
operand: 52
47Variable
48Variable
49Variable
50Variable
51ExprTuple52
52Variable