logo

Expression of type Lambda

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