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 Conditional, ExprTuple, Lambda, fi, i, j, k, x
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Complex, Integer, Interval, Mult, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [i]
sub_expr2 = Interval(j, k)
expr = ExprTuple(Lambda(x, Conditional(Forall(instance_param_or_params = [j, k], instance_expr = Equals(Sum(index_or_indices = sub_expr1, summand = Mult(x, fi), domain = sub_expr2), Mult(x, Sum(index_or_indices = sub_expr1, summand = fi, domain = sub_expr2))), domain = Integer), InSet(x, Complex))))
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(x \mapsto \left\{\forall_{j, k \in \mathbb{Z}}~\left(\left(\sum_{i = j}^{k} \left(x \cdot f\left(i\right)\right)\right) = \left(x \cdot \left(\sum_{i = j}^{k} f\left(i\right)\right)\right)\right) \textrm{ if } x \in \mathbb{C}\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: 37
body: 3
2ExprTuple37
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 42
operands: 8
6Literal
7ExprTuple9
8ExprTuple37, 10
9Lambdaparameters: 47
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18, 19
16Literal
17ExprTuple20, 21
18Operationoperator: 30
operand: 26
19Operationoperator: 34
operands: 23
20Operationoperator: 42
operands: 24
21Operationoperator: 42
operands: 25
22ExprTuple26
23ExprTuple37, 27
24ExprTuple48, 28
25ExprTuple49, 28
26Lambdaparameter: 44
body: 29
27Operationoperator: 30
operand: 33
28Literal
29Conditionalvalue: 32
condition: 39
30Literal
31ExprTuple33
32Operationoperator: 34
operands: 35
33Lambdaparameter: 44
body: 36
34Literal
35ExprTuple37, 38
36Conditionalvalue: 38
condition: 39
37Variable
38Operationoperator: 40
operand: 44
39Operationoperator: 42
operands: 43
40Variable
41ExprTuple44
42Literal
43ExprTuple44, 45
44Variable
45Operationoperator: 46
operands: 47
46Literal
47ExprTuple48, 49
48Variable
49Variable