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 Function, Lambda, a, b, f, fx, x
from proveit.logic import Equals, Forall
from proveit.numbers import Integer, Interval, Neg, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = Lambda(f, Forall(instance_param_or_params = [a, b], instance_expr = Equals(Sum(index_or_indices = sub_expr1, summand = fx, domain = Interval(a, b)), Sum(index_or_indices = sub_expr1, summand = Function(f, [Neg(x)]), domain = Interval(Neg(b), Neg(a)))), domain = Integer))
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_{a, b \in \mathbb{Z}}~\left(\left(\sum_{x = a}^{b} f\left(x\right)\right) = \left(\sum_{x = -b}^{-a} f\left(-x\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: 32
body: 2
1ExprTuple32
2Operationoperator: 3
operand: 5
3Literal
4ExprTuple5
5Lambdaparameters: 39
body: 6
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operands: 10
8Operationoperator: 11
operands: 12
9Literal
10ExprTuple13, 14
11Literal
12ExprTuple15, 16
13Operationoperator: 18
operand: 22
14Operationoperator: 18
operand: 23
15Operationoperator: 34
operands: 20
16Operationoperator: 34
operands: 21
17ExprTuple22
18Literal
19ExprTuple23
20ExprTuple50, 24
21ExprTuple49, 24
22Lambdaparameter: 43
body: 25
23Lambdaparameter: 43
body: 26
24Literal
25Conditionalvalue: 27
condition: 28
26Conditionalvalue: 29
condition: 30
27Operationoperator: 32
operand: 43
28Operationoperator: 34
operands: 31
29Operationoperator: 32
operand: 37
30Operationoperator: 34
operands: 35
31ExprTuple43, 36
32Variable
33ExprTuple37
34Literal
35ExprTuple43, 38
36Operationoperator: 41
operands: 39
37Operationoperator: 47
operand: 43
38Operationoperator: 41
operands: 42
39ExprTuple50, 49
40ExprTuple43
41Literal
42ExprTuple44, 45
43Variable
44Operationoperator: 47
operand: 49
45Operationoperator: 47
operand: 50
46ExprTuple49
47Literal
48ExprTuple50
49Variable
50Variable