logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.addition

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, K, Lambda, V, b, i, j, k
from proveit.core_expr_types import a_1_to_i, c_1_to_j, d_1_to_k
from proveit.linear_algebra import VecAdd, VecSpaces
from proveit.logic import Equals, Forall
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [i, j, k], instance_expr = Forall(instance_param_or_params = [a_1_to_i, b, c_1_to_j, d_1_to_k], instance_expr = Equals(VecAdd(a_1_to_i, b, c_1_to_j, d_1_to_k), VecAdd(a_1_to_i, c_1_to_j, b, d_1_to_k)).with_wrapping_at(2), domain = V), domain = Natural), 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 \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{i, j, k \in \mathbb{N}}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{i}, b, c_{1}, c_{2}, \ldots, c_{j}, d_{1}, d_{2}, \ldots, d_{k} \in V}~\left(\begin{array}{c} \begin{array}{l} \left(a_{1} +  a_{2} +  \ldots +  a_{i} + b+ c_{1} +  c_{2} +  \ldots +  c_{j}+ d_{1} +  d_{2} +  \ldots +  d_{k}\right) =  \\ \left(a_{1} +  a_{2} +  \ldots +  a_{i}+ c_{1} +  c_{2} +  \ldots +  c_{j} + b+ d_{1} +  d_{2} +  \ldots +  d_{k}\right) \end{array} \end{array}\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: 20
body: 2
2Operationoperator: 21
operand: 4
3ExprTuple4
4Lambdaparameter: 73
body: 6
5ExprTuple73
6Conditionalvalue: 7
condition: 8
7Operationoperator: 21
operand: 12
8Operationoperator: 10
operands: 11
9ExprTuple12
10Literal
11ExprTuple73, 13
12Lambdaparameters: 14
body: 15
13Operationoperator: 16
operand: 20
14ExprTuple60, 62, 65
15Conditionalvalue: 18
condition: 19
16Literal
17ExprTuple20
18Operationoperator: 21
operand: 24
19Operationoperator: 37
operands: 23
20Variable
21Literal
22ExprTuple24
23ExprTuple25, 26, 27
24Lambdaparameters: 45
body: 28
25Operationoperator: 68
operands: 29
26Operationoperator: 68
operands: 30
27Operationoperator: 68
operands: 31
28Conditionalvalue: 32
condition: 33
29ExprTuple60, 34
30ExprTuple62, 34
31ExprTuple65, 34
32Operationoperator: 35
operands: 36
33Operationoperator: 37
operands: 38
34Literal
35Literal
36ExprTuple39, 40
37Literal
38ExprTuple41, 42, 43, 44
39Operationoperator: 46
operands: 45
40Operationoperator: 46
operands: 47
41ExprRangelambda_map: 48
start_index: 64
end_index: 60
42Operationoperator: 68
operands: 49
43ExprRangelambda_map: 50
start_index: 64
end_index: 62
44ExprRangelambda_map: 51
start_index: 64
end_index: 65
45ExprTuple52, 56, 53, 54
46Literal
47ExprTuple52, 53, 56, 54
48Lambdaparameter: 78
body: 55
49ExprTuple56, 73
50Lambdaparameter: 78
body: 57
51Lambdaparameter: 78
body: 58
52ExprRangelambda_map: 59
start_index: 64
end_index: 60
53ExprRangelambda_map: 61
start_index: 64
end_index: 62
54ExprRangelambda_map: 63
start_index: 64
end_index: 65
55Operationoperator: 68
operands: 66
56Variable
57Operationoperator: 68
operands: 67
58Operationoperator: 68
operands: 69
59Lambdaparameter: 78
body: 70
60Variable
61Lambdaparameter: 78
body: 71
62Variable
63Lambdaparameter: 78
body: 72
64Literal
65Variable
66ExprTuple70, 73
67ExprTuple71, 73
68Literal
69ExprTuple72, 73
70IndexedVarvariable: 74
index: 78
71IndexedVarvariable: 75
index: 78
72IndexedVarvariable: 76
index: 78
73Variable
74Variable
75Variable
76Variable
77ExprTuple78
78Variable