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, c, d, f, fj, g, gj, j, 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 = [j]
sub_expr2 = Interval(c, d)
expr = Lambda([f, g], Forall(instance_param_or_params = [x], instance_expr = Forall(instance_param_or_params = [c, d], instance_expr = Equals(Sum(index_or_indices = sub_expr1, summand = Mult(Mult(x, gj), fj), domain = sub_expr2), Mult(x, Sum(index_or_indices = sub_expr1, summand = Mult(gj, fj), 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())
\left(f, g\right) \mapsto \left[\forall_{x \in \mathbb{C}}~\left[\forall_{c, d \in \mathbb{Z}}~\left(\left(\sum_{j = c}^{d} \left(\left(x \cdot g\left(j\right)\right) \cdot f\left(j\right)\right)\right) = \left(x \cdot \left(\sum_{j = c}^{d} \left(g\left(j\right) \cdot f\left(j\right)\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
0Lambdaparameters: 1
body: 2
1ExprTuple52, 51
2Operationoperator: 9
operand: 4
3ExprTuple4
4Lambdaparameter: 47
body: 6
5ExprTuple47
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 12
8Operationoperator: 45
operands: 11
9Literal
10ExprTuple12
11ExprTuple47, 13
12Lambdaparameters: 55
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: 43
operands: 26
23Operationoperator: 45
operands: 27
24Operationoperator: 45
operands: 28
25ExprTuple29
26ExprTuple47, 30
27ExprTuple57, 31
28ExprTuple58, 31
29Lambdaparameter: 56
body: 32
30Operationoperator: 33
operand: 36
31Literal
32Conditionalvalue: 35
condition: 41
33Literal
34ExprTuple36
35Operationoperator: 43
operands: 37
36Lambdaparameter: 56
body: 38
37ExprTuple39, 49
38Conditionalvalue: 40
condition: 41
39Operationoperator: 43
operands: 42
40Operationoperator: 43
operands: 44
41Operationoperator: 45
operands: 46
42ExprTuple47, 48
43Literal
44ExprTuple48, 49
45Literal
46ExprTuple56, 50
47Variable
48Operationoperator: 51
operand: 56
49Operationoperator: 52
operand: 56
50Operationoperator: 54
operands: 55
51Variable
52Variable
53ExprTuple56
54Literal
55ExprTuple57, 58
56Variable
57Variable
58Variable