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 Lambda, f, fi, i, j, k, x
from proveit.logic import Equals, Forall
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(f, Forall(instance_param_or_params = [x], instance_expr = 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), domain = 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())
f \mapsto \left[\forall_{x \in \mathbb{C}}~\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)\right]\right]
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 43
body: 2
1ExprTuple43
2Operationoperator: 9
operand: 4
3ExprTuple4
4Lambdaparameter: 40
body: 6
5ExprTuple40
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 12
8Operationoperator: 45
operands: 11
9Literal
10ExprTuple12
11ExprTuple40, 13
12Lambdaparameters: 50
body: 14
13Literal
14Conditionalvalue: 15
condition: 16
15Operationoperator: 17
operands: 18
16Operationoperator: 19
operands: 20
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple23, 24
21Operationoperator: 33
operand: 29
22Operationoperator: 37
operands: 26
23Operationoperator: 45
operands: 27
24Operationoperator: 45
operands: 28
25ExprTuple29
26ExprTuple40, 30
27ExprTuple51, 31
28ExprTuple52, 31
29Lambdaparameter: 47
body: 32
30Operationoperator: 33
operand: 36
31Literal
32Conditionalvalue: 35
condition: 42
33Literal
34ExprTuple36
35Operationoperator: 37
operands: 38
36Lambdaparameter: 47
body: 39
37Literal
38ExprTuple40, 41
39Conditionalvalue: 41
condition: 42
40Variable
41Operationoperator: 43
operand: 47
42Operationoperator: 45
operands: 46
43Variable
44ExprTuple47
45Literal
46ExprTuple47, 48
47Variable
48Operationoperator: 49
operands: 50
49Literal
50ExprTuple51, 52
51Variable
52Variable