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 Conditional, 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, InClass
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(V, Conditional(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), InClass(V, 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(V \mapsto \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] \textrm{ if } V \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
1Lambdaparameter: 70
body: 3
2ExprTuple70
3Conditionalvalue: 4
condition: 5
4Operationoperator: 18
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple70, 10
9Lambdaparameters: 11
body: 12
10Operationoperator: 13
operand: 17
11ExprTuple57, 59, 62
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple17
15Operationoperator: 18
operand: 21
16Operationoperator: 34
operands: 20
17Variable
18Literal
19ExprTuple21
20ExprTuple22, 23, 24
21Lambdaparameters: 42
body: 25
22Operationoperator: 65
operands: 26
23Operationoperator: 65
operands: 27
24Operationoperator: 65
operands: 28
25Conditionalvalue: 29
condition: 30
26ExprTuple57, 31
27ExprTuple59, 31
28ExprTuple62, 31
29Operationoperator: 32
operands: 33
30Operationoperator: 34
operands: 35
31Literal
32Literal
33ExprTuple36, 37
34Literal
35ExprTuple38, 39, 40, 41
36Operationoperator: 43
operands: 42
37Operationoperator: 43
operands: 44
38ExprRangelambda_map: 45
start_index: 61
end_index: 57
39Operationoperator: 65
operands: 46
40ExprRangelambda_map: 47
start_index: 61
end_index: 59
41ExprRangelambda_map: 48
start_index: 61
end_index: 62
42ExprTuple49, 53, 50, 51
43Literal
44ExprTuple49, 50, 53, 51
45Lambdaparameter: 75
body: 52
46ExprTuple53, 70
47Lambdaparameter: 75
body: 54
48Lambdaparameter: 75
body: 55
49ExprRangelambda_map: 56
start_index: 61
end_index: 57
50ExprRangelambda_map: 58
start_index: 61
end_index: 59
51ExprRangelambda_map: 60
start_index: 61
end_index: 62
52Operationoperator: 65
operands: 63
53Variable
54Operationoperator: 65
operands: 64
55Operationoperator: 65
operands: 66
56Lambdaparameter: 75
body: 67
57Variable
58Lambdaparameter: 75
body: 68
59Variable
60Lambdaparameter: 75
body: 69
61Literal
62Variable
63ExprTuple67, 70
64ExprTuple68, 70
65Literal
66ExprTuple69, 70
67IndexedVarvariable: 71
index: 75
68IndexedVarvariable: 72
index: 75
69IndexedVarvariable: 73
index: 75
70Variable
71Variable
72Variable
73Variable
74ExprTuple75
75Variable