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, Q, V, f
from proveit.core_expr_types import Q__b_1_to_j, b_1_to_j, f__b_1_to_j
from proveit.linear_algebra import VecSpaces
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import Forall, Implies, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([K, f, Q], Forall(instance_param_or_params = [V], instance_expr = Implies(Forall(instance_param_or_params = [b_1_to_j], instance_expr = InSet(f__b_1_to_j, V), condition = Q__b_1_to_j), InSet(vec_summation_b1toj_fQ, V)).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(\left(K, f, Q\right) \mapsto \left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left(\begin{array}{c} \begin{array}{l} \left[\forall_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(f\left(b_{1}, b_{2}, \ldots, b_{j}\right) \in V\right)\right] \Rightarrow  \\ \left(\left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right] \in V\right) \end{array} \end{array}\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: 2
body: 3
2ExprTuple24, 36, 37
3Operationoperator: 17
operand: 5
4ExprTuple5
5Lambdaparameter: 33
body: 7
6ExprTuple33
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operands: 11
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple14, 15
12Literal
13ExprTuple33, 16
14Operationoperator: 17
operand: 22
15Operationoperator: 30
operands: 19
16Operationoperator: 20
operand: 24
17Literal
18ExprTuple22
19ExprTuple23, 33
20Literal
21ExprTuple24
22Lambdaparameters: 38
body: 25
23Operationoperator: 26
operand: 29
24Variable
25Conditionalvalue: 28
condition: 35
26Literal
27ExprTuple29
28Operationoperator: 30
operands: 31
29Lambdaparameters: 38
body: 32
30Literal
31ExprTuple34, 33
32Conditionalvalue: 34
condition: 35
33Variable
34Operationoperator: 36
operands: 38
35Operationoperator: 37
operands: 38
36Variable
37Variable
38ExprTuple39
39ExprRangelambda_map: 40
start_index: 41
end_index: 42
40Lambdaparameter: 46
body: 43
41Literal
42Variable
43IndexedVarvariable: 44
index: 46
44Variable
45ExprTuple46
46Variable