logo

Expression of type ExprTuple

from the theory of proveit.numbers.division

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, Px, d, x, y, z
from proveit.logic import And, Equals, InSet, NotEquals
from proveit.numbers import Complex, Interval, Sum, frac, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
sub_expr2 = Interval(y, z)
expr = ExprTuple(Lambda(d, Conditional(Equals(frac(Sum(index_or_indices = sub_expr1, summand = Px, domain = sub_expr2), d), Sum(index_or_indices = sub_expr1, summand = frac(Px, d), domain = sub_expr2)), And(InSet(d, Complex), NotEquals(d, zero)))))
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(d \mapsto \left\{\frac{\sum_{x = y}^{z} P\left(x\right)}{d} = \left(\sum_{x = y}^{z} \frac{P\left(x\right)}{d}\right) \textrm{ if } d \in \mathbb{C} ,  d \neq 0\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: 33
body: 3
2ExprTuple33
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple12, 13
10Operationoperator: 29
operands: 14
11Operationoperator: 23
operand: 20
12Operationoperator: 34
operands: 16
13Operationoperator: 17
operands: 18
14ExprTuple19, 33
15ExprTuple20
16ExprTuple33, 21
17Literal
18ExprTuple33, 22
19Operationoperator: 23
operand: 26
20Lambdaparameter: 39
body: 25
21Literal
22Literal
23Literal
24ExprTuple26
25Conditionalvalue: 27
condition: 31
26Lambdaparameter: 39
body: 28
27Operationoperator: 29
operands: 30
28Conditionalvalue: 32
condition: 31
29Literal
30ExprTuple32, 33
31Operationoperator: 34
operands: 35
32Operationoperator: 36
operand: 39
33Variable
34Literal
35ExprTuple39, 38
36Variable
37ExprTuple39
38Operationoperator: 40
operands: 41
39Variable
40Literal
41ExprTuple42, 43
42Variable
43Variable