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, Q, V, f, j
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
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(j, Conditional(Forall(instance_param_or_params = [K, f, Q], instance_expr = 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))), InSet(j, NaturalPos))))
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(j \mapsto \left\{\forall_{K, f, Q}~\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] \textrm{ if } j \in \mathbb{N}^+\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: 50
body: 3
2ExprTuple50
3Conditionalvalue: 4
condition: 5
4Operationoperator: 25
operand: 8
5Operationoperator: 38
operands: 7
6ExprTuple8
7ExprTuple50, 9
8Lambdaparameters: 10
body: 11
9Literal
10ExprTuple32, 44, 45
11Operationoperator: 25
operand: 13
12ExprTuple13
13Lambdaparameter: 41
body: 15
14ExprTuple41
15Conditionalvalue: 16
condition: 17
16Operationoperator: 18
operands: 19
17Operationoperator: 20
operands: 21
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple41, 24
22Operationoperator: 25
operand: 30
23Operationoperator: 38
operands: 27
24Operationoperator: 28
operand: 32
25Literal
26ExprTuple30
27ExprTuple31, 41
28Literal
29ExprTuple32
30Lambdaparameters: 46
body: 33
31Operationoperator: 34
operand: 37
32Variable
33Conditionalvalue: 36
condition: 43
34Literal
35ExprTuple37
36Operationoperator: 38
operands: 39
37Lambdaparameters: 46
body: 40
38Literal
39ExprTuple42, 41
40Conditionalvalue: 42
condition: 43
41Variable
42Operationoperator: 44
operands: 46
43Operationoperator: 45
operands: 46
44Variable
45Variable
46ExprTuple47
47ExprRangelambda_map: 48
start_index: 49
end_index: 50
48Lambdaparameter: 54
body: 51
49Literal
50Variable
51IndexedVarvariable: 52
index: 54
52Variable
53ExprTuple54
54Variable