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, Lambda, i
from proveit.core_expr_types import a_1_to_i
from proveit.linear_algebra import VecAdd
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Add, Complex, NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(i, Conditional(Forall(instance_param_or_params = [a_1_to_i], instance_expr = Equals(VecAdd(a_1_to_i), Add(a_1_to_i)), domain = Complex), InSet(i, 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(i \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{i} \in \mathbb{C}}~\left(\left(a_{1} +  a_{2} +  \ldots +  a_{i}\right) = \left(a_{1} +  a_{2} +  \ldots +  a_{i}\right)\right) \textrm{ if } i \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: 29
body: 3
2ExprTuple29
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 30
operands: 8
6Literal
7ExprTuple9
8ExprTuple29, 10
9Lambdaparameters: 23
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18, 19
16Literal
17ExprTuple20
18Operationoperator: 21
operands: 23
19Operationoperator: 22
operands: 23
20ExprRangelambda_map: 24
start_index: 28
end_index: 29
21Literal
22Literal
23ExprTuple25
24Lambdaparameter: 36
body: 26
25ExprRangelambda_map: 27
start_index: 28
end_index: 29
26Operationoperator: 30
operands: 31
27Lambdaparameter: 36
body: 32
28Literal
29Variable
30Literal
31ExprTuple32, 33
32IndexedVarvariable: 34
index: 36
33Literal
34Variable
35ExprTuple36
36Variable