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 ExprTuple, Function, K, Lambda, P, Px, Py, V, W, c, x, y
from proveit.linear_algebra import LinMap, ScalarMult, VecAdd, VecSpaces
from proveit.logic import And, Equals, Forall, Iff, 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 = [P], instance_expr = Iff(InSet(P, LinMap(V, W)), And(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(Px, W), domain = V), Forall(instance_param_or_params = [x, y], instance_expr = Equals(Function(P, [VecAdd(x, y)]), VecAdd(Px, Py)), domain = V), Forall(instance_param_or_params = [c], instance_expr = Forall(instance_param_or_params = sub_expr1, instance_expr = Equals(Function(P, [ScalarMult(c, x)]), ScalarMult(c, Px)), domain = V), domain = K)).with_wrapping_at(2,4)).with_wrapping_at(2)), 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_{P}~\left(\begin{array}{c} \begin{array}{l} \left(P \in \mathcal{L}\left(V, W\right)\right) \Leftrightarrow  \\ \left(\begin{array}{c} \left[\forall_{x \in V}~\left(P\left(x\right) \in W\right)\right] \land  \\ \left[\forall_{x, y \in V}~\left(P\left(x + y\right) = \left(P\left(x\right) + P\left(y\right)\right)\right)\right] \land  \\ \left[\forall_{c \in K}~\left[\forall_{x \in V}~\left(P\left(c \cdot x\right) = \left(c \cdot P\left(x\right)\right)\right)\right]\right] \end{array}\right) \end{array} \end{array}\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: 60
body: 2
2Operationoperator: 52
operand: 4
3ExprTuple4
4Lambdaparameters: 32
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 52
operand: 10
7Operationoperator: 50
operands: 9
8ExprTuple10
9ExprTuple11, 12
10Lambdaparameter: 86
body: 14
11Operationoperator: 16
operands: 15
12Operationoperator: 16
operands: 17
13ExprTuple86
14Operationoperator: 18
operands: 19
15ExprTuple79, 20
16Literal
17ExprTuple55, 20
18Literal
19ExprTuple21, 22
20Operationoperator: 23
operand: 60
21Operationoperator: 74
operands: 25
22Operationoperator: 50
operands: 26
23Literal
24ExprTuple60
25ExprTuple86, 27
26ExprTuple28, 29, 30
27Operationoperator: 31
operands: 32
28Operationoperator: 52
operand: 36
29Operationoperator: 52
operand: 37
30Operationoperator: 52
operand: 38
31Literal
32ExprTuple79, 55
33ExprTuple36
34ExprTuple37
35ExprTuple38
36Lambdaparameter: 89
body: 39
37Lambdaparameters: 70
body: 40
38Lambdaparameter: 88
body: 42
39Conditionalvalue: 43
condition: 68
40Conditionalvalue: 44
condition: 45
41ExprTuple88
42Conditionalvalue: 46
condition: 47
43Operationoperator: 74
operands: 48
44Operationoperator: 72
operands: 49
45Operationoperator: 50
operands: 51
46Operationoperator: 52
operand: 59
47Operationoperator: 74
operands: 54
48ExprTuple83, 55
49ExprTuple56, 57
50Literal
51ExprTuple68, 58
52Literal
53ExprTuple59
54ExprTuple88, 60
55Variable
56Operationoperator: 86
operand: 65
57Operationoperator: 69
operands: 62
58Operationoperator: 74
operands: 63
59Lambdaparameter: 89
body: 64
60Variable
61ExprTuple65
62ExprTuple83, 66
63ExprTuple76, 79
64Conditionalvalue: 67
condition: 68
65Operationoperator: 69
operands: 70
66Operationoperator: 86
operand: 76
67Operationoperator: 72
operands: 73
68Operationoperator: 74
operands: 75
69Literal
70ExprTuple89, 76
71ExprTuple76
72Literal
73ExprTuple77, 78
74Literal
75ExprTuple89, 79
76Variable
77Operationoperator: 86
operand: 82
78Operationoperator: 84
operands: 81
79Variable
80ExprTuple82
81ExprTuple88, 83
82Operationoperator: 84
operands: 85
83Operationoperator: 86
operand: 89
84Literal
85ExprTuple88, 89
86Variable
87ExprTuple89
88Variable
89Variable