logo

Expression of type ExprTuple

from the theory of proveit.numbers.multiplication

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, ExprRange, ExprTuple, IndexedVar, Lambda, Variable, b, i, j, k
from proveit.core_expr_types import a_1_to_i, b_1_to_j, c_1_to_k
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Abs, Add, Complex, Mult, Natural, RealNonNeg, one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_b", latex_format = r"{_{-}b}")
expr = ExprTuple(Lambda([i, j, k], Conditional(Forall(instance_param_or_params = [a_1_to_i, c_1_to_k], instance_expr = Forall(instance_param_or_params = [b_1_to_j], instance_expr = Equals(Mult(a_1_to_i, Abs(Add(b_1_to_j)), c_1_to_k), Abs(Add(ExprRange(sub_expr1, Mult(a_1_to_i, IndexedVar(b, sub_expr1), c_1_to_k), one, j)))).with_wrapping_at(2), domain = Complex).with_wrapping(), domain = RealNonNeg).with_wrapping(), And(InSet(i, Natural), InSet(j, Natural), InSet(k, Natural)))))
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(i, j, k\right) \mapsto \left\{\begin{array}{l}\forall_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{k} \in \mathbb{R}^{\ge 0}}~\\
\left[\begin{array}{l}\forall_{b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \left|b_{1} +  b_{2} +  \ldots +  b_{j}\right|\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) =  \\ \left|\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot b_{1}\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) +  \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot b_{2}\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) +  \ldots +  \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot b_{j}\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right)\right| \end{array} \end{array}\right)\end{array}\right]\end{array} \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N} ,  k \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
1Lambdaparameters: 2
body: 3
2ExprTuple71, 63, 76
3Conditionalvalue: 4
condition: 5
4Operationoperator: 20
operand: 8
5Operationoperator: 35
operands: 7
6ExprTuple8
7ExprTuple9, 10, 11
8Lambdaparameters: 12
body: 13
9Operationoperator: 52
operands: 14
10Operationoperator: 52
operands: 15
11Operationoperator: 52
operands: 16
12ExprTuple67, 69
13Conditionalvalue: 17
condition: 18
14ExprTuple71, 19
15ExprTuple63, 19
16ExprTuple76, 19
17Operationoperator: 20
operand: 23
18Operationoperator: 35
operands: 22
19Literal
20Literal
21ExprTuple23
22ExprTuple24, 25
23Lambdaparameters: 58
body: 26
24ExprRangelambda_map: 27
start_index: 75
end_index: 71
25ExprRangelambda_map: 28
start_index: 75
end_index: 76
26Conditionalvalue: 29
condition: 30
27Lambdaparameter: 83
body: 31
28Lambdaparameter: 83
body: 32
29Operationoperator: 33
operands: 34
30Operationoperator: 35
operands: 36
31Operationoperator: 52
operands: 37
32Operationoperator: 52
operands: 38
33Literal
34ExprTuple39, 40
35Literal
36ExprTuple41
37ExprTuple77, 42
38ExprTuple79, 42
39Operationoperator: 64
operands: 43
40Operationoperator: 49
operand: 47
41ExprRangelambda_map: 45
start_index: 75
end_index: 63
42Literal
43ExprTuple67, 46, 69
44ExprTuple47
45Lambdaparameter: 83
body: 48
46Operationoperator: 49
operand: 54
47Operationoperator: 57
operands: 51
48Operationoperator: 52
operands: 53
49Literal
50ExprTuple54
51ExprTuple55
52Literal
53ExprTuple66, 56
54Operationoperator: 57
operands: 58
55ExprRangelambda_map: 59
start_index: 75
end_index: 63
56Literal
57Literal
58ExprTuple60
59Lambdaparameter: 78
body: 61
60ExprRangelambda_map: 62
start_index: 75
end_index: 63
61Operationoperator: 64
operands: 65
62Lambdaparameter: 83
body: 66
63Variable
64Literal
65ExprTuple67, 68, 69
66IndexedVarvariable: 72
index: 83
67ExprRangelambda_map: 70
start_index: 75
end_index: 71
68IndexedVarvariable: 72
index: 78
69ExprRangelambda_map: 74
start_index: 75
end_index: 76
70Lambdaparameter: 83
body: 77
71Variable
72Variable
73ExprTuple78
74Lambdaparameter: 83
body: 79
75Literal
76Variable
77IndexedVarvariable: 80
index: 83
78Variable
79IndexedVarvariable: 81
index: 83
80Variable
81Variable
82ExprTuple83
83Variable