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, c, d, fj, gj, j, 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 = [j]
sub_expr2 = Interval(c, d)
expr = Lambda(x, Conditional(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), 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_{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) \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: 43
body: 2
1ExprTuple43
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 41
operands: 7
5Literal
6ExprTuple8
7ExprTuple43, 9
8Lambdaparameters: 51
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: 39
operands: 22
19Operationoperator: 41
operands: 23
20Operationoperator: 41
operands: 24
21ExprTuple25
22ExprTuple43, 26
23ExprTuple53, 27
24ExprTuple54, 27
25Lambdaparameter: 52
body: 28
26Operationoperator: 29
operand: 32
27Literal
28Conditionalvalue: 31
condition: 37
29Literal
30ExprTuple32
31Operationoperator: 39
operands: 33
32Lambdaparameter: 52
body: 34
33ExprTuple35, 45
34Conditionalvalue: 36
condition: 37
35Operationoperator: 39
operands: 38
36Operationoperator: 39
operands: 40
37Operationoperator: 41
operands: 42
38ExprTuple43, 44
39Literal
40ExprTuple44, 45
41Literal
42ExprTuple52, 46
43Variable
44Operationoperator: 47
operand: 52
45Operationoperator: 48
operand: 52
46Operationoperator: 50
operands: 51
47Variable
48Variable
49ExprTuple52
50Literal
51ExprTuple53, 54
52Variable
53Variable
54Variable