logo

Expression of type Conditional

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, 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 = 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\{\left(\sum_{m = 0}^{\infty} x^{m}\right) = \frac{1}{1 - x} \textrm{ if } x \in \mathbb{C} ,  \left|x\right| < 1\right..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 3
operands: 4
2Operationoperator: 5
operands: 6
3Literal
4ExprTuple7, 8
5Literal
6ExprTuple9, 10
7Operationoperator: 11
operand: 18
8Operationoperator: 13
operands: 14
9Operationoperator: 33
operands: 15
10Operationoperator: 16
operands: 17
11Literal
12ExprTuple18
13Literal
14ExprTuple29, 19
15ExprTuple39, 20
16Literal
17ExprTuple21, 29
18Lambdaparameter: 37
body: 23
19Operationoperator: 24
operands: 25
20Literal
21Operationoperator: 26
operand: 39
22ExprTuple37
23Conditionalvalue: 27
condition: 28
24Literal
25ExprTuple29, 30
26Literal
27Operationoperator: 31
operands: 32
28Operationoperator: 33
operands: 34
29Literal
30Operationoperator: 35
operand: 39
31Literal
32ExprTuple39, 37
33Literal
34ExprTuple37, 38
35Literal
36ExprTuple39
37Variable
38Operationoperator: 40
operands: 41
39Variable
40Literal
41ExprTuple42, 43
42Literal
43Literal