logo

Expression of type ExprTuple

from the theory of proveit.numbers.summation

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 ExprRange, ExprTuple, IndexedVar, Variable, a, c, l
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Add, Complex, Integer, Mult, Sum, one, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = [l]
sub_expr3 = Add(l, one)
sub_expr4 = IndexedVar(c, one)
sub_expr5 = ExprRange(sub_expr1, IndexedVar(a, sub_expr1), one, zero)
expr = ExprTuple(Forall(instance_param_or_params = sub_expr2, instance_expr = InSet(sub_expr3, Complex), domain = Integer), Forall(instance_param_or_params = [sub_expr5, sub_expr4], instance_expr = Equals(Mult(sub_expr5, Sum(index_or_indices = sub_expr2, summand = sub_expr3, domain = Integer), sub_expr4), Sum(index_or_indices = sub_expr2, summand = Mult(sub_expr5, sub_expr3, sub_expr4), domain = Integer)).with_wrapping_at(2), domain = Complex).with_wrapping())
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(\forall_{l \in \mathbb{Z}}~\left(\left(l + 1\right) \in \mathbb{C}\right), \begin{array}{l}\forall_{a_{1}, a_{2}, \ldots, a_{0}, c_{1} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{0} \cdot \left[\sum_{l \in \mathbb{Z}}~\left(l + 1\right)\right] \cdot c_{1}\right) =  \\ \left[\sum_{l \in \mathbb{Z}}~\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{0} \cdot \left(l + 1\right) \cdot c_{1}\right)\right] \end{array} \end{array}\right)\end{array}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 4
operand: 6
2Operationoperator: 4
operand: 7
3ExprTuple6
4Literal
5ExprTuple7
6Lambdaparameter: 55
body: 8
7Lambdaparameters: 9
body: 10
8Conditionalvalue: 11
condition: 41
9ExprTuple42, 44
10Conditionalvalue: 12
condition: 13
11Operationoperator: 45
operands: 14
12Operationoperator: 15
operands: 16
13Operationoperator: 17
operands: 18
14ExprTuple43, 36
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 39
operands: 23
20Operationoperator: 30
operand: 28
21ExprRangelambda_map: 25
start_index: 56
end_index: 48
22Operationoperator: 45
operands: 26
23ExprTuple42, 27, 44
24ExprTuple28
25Lambdaparameter: 59
body: 29
26ExprTuple44, 36
27Operationoperator: 30
operand: 34
28Lambdaparameter: 55
body: 32
29Operationoperator: 45
operands: 33
30Literal
31ExprTuple34
32Conditionalvalue: 35
condition: 41
33ExprTuple54, 36
34Lambdaparameter: 55
body: 38
35Operationoperator: 39
operands: 40
36Literal
37ExprTuple55
38Conditionalvalue: 43
condition: 41
39Literal
40ExprTuple42, 43, 44
41Operationoperator: 45
operands: 46
42ExprRangelambda_map: 47
start_index: 56
end_index: 48
43Operationoperator: 49
operands: 50
44IndexedVarvariable: 51
index: 56
45Literal
46ExprTuple55, 53
47Lambdaparameter: 59
body: 54
48Literal
49Literal
50ExprTuple55, 56
51Variable
52ExprTuple56
53Literal
54IndexedVarvariable: 57
index: 59
55Variable
56Literal
57Variable
58ExprTuple59
59Variable