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, m, x
from proveit.logic import And, Equals, InSet
from proveit.numbers import Abs, Complex, Exp, Interval, Less, Sum, frac, infinity, one, subtract, zero
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(x, Conditional(Equals(Sum(index_or_indices = [m], summand = Exp(x, m), domain = Interval(zero, infinity)), frac(one, subtract(one, x))), And(InSet(x, Complex), Less(Abs(x), one)))))
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\{\left(\sum_{m = 0}^{\infty} x^{m}\right) = \frac{1}{1 - x} \textrm{ if } x \in \mathbb{C} ,  \left|x\right| < 1\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: 41
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple11, 12
9Operationoperator: 13
operand: 20
10Operationoperator: 15
operands: 16
11Operationoperator: 35
operands: 17
12Operationoperator: 18
operands: 19
13Literal
14ExprTuple20
15Literal
16ExprTuple31, 21
17ExprTuple41, 22
18Literal
19ExprTuple23, 31
20Lambdaparameter: 39
body: 25
21Operationoperator: 26
operands: 27
22Literal
23Operationoperator: 28
operand: 41
24ExprTuple39
25Conditionalvalue: 29
condition: 30
26Literal
27ExprTuple31, 32
28Literal
29Operationoperator: 33
operands: 34
30Operationoperator: 35
operands: 36
31Literal
32Operationoperator: 37
operand: 41
33Literal
34ExprTuple41, 39
35Literal
36ExprTuple39, 40
37Literal
38ExprTuple41
39Variable
40Operationoperator: 42
operands: 43
41Variable
42Literal
43ExprTuple44, 45
44Literal
45Literal