logo

Expression of type Lambda

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, 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 = 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())
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..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 32
body: 2
1ExprTuple32
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple11, 12
9Operationoperator: 28
operands: 13
10Operationoperator: 22
operand: 19
11Operationoperator: 33
operands: 15
12Operationoperator: 16
operands: 17
13ExprTuple18, 32
14ExprTuple19
15ExprTuple32, 20
16Literal
17ExprTuple32, 21
18Operationoperator: 22
operand: 25
19Lambdaparameter: 38
body: 24
20Literal
21Literal
22Literal
23ExprTuple25
24Conditionalvalue: 26
condition: 30
25Lambdaparameter: 38
body: 27
26Operationoperator: 28
operands: 29
27Conditionalvalue: 31
condition: 30
28Literal
29ExprTuple31, 32
30Operationoperator: 33
operands: 34
31Operationoperator: 35
operand: 38
32Variable
33Literal
34ExprTuple38, 37
35Variable
36ExprTuple38
37Operationoperator: 39
operands: 40
38Variable
39Literal
40ExprTuple41, 42
41Variable
42Variable