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, Q, Qx, f, fx, x
from proveit.logic import Forall, Implies, InSet
from proveit.numbers import Complex, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x]
expr = Lambda([f, Q], Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(fx, Complex), condition = Qx), InSet(Sum(index_or_indices = sub_expr1, summand = fx, condition = Qx), 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, Q\right) \mapsto \left(\left[\forall_{x~|~Q\left(x\right)}~\left(f\left(x\right) \in \mathbb{C}\right)\right] \Rightarrow \left(\left[\sum_{x~|~Q\left(x\right)}~f\left(x\right)\right] \in \mathbb{C}\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
1ExprTuple23, 24
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6
5Operationoperator: 7
operand: 10
6Operationoperator: 17
operands: 9
7Literal
8ExprTuple10
9ExprTuple11, 20
10Lambdaparameter: 26
body: 12
11Operationoperator: 13
operand: 16
12Conditionalvalue: 15
condition: 22
13Literal
14ExprTuple16
15Operationoperator: 17
operands: 18
16Lambdaparameter: 26
body: 19
17Literal
18ExprTuple21, 20
19Conditionalvalue: 21
condition: 22
20Literal
21Operationoperator: 23
operand: 26
22Operationoperator: 24
operand: 26
23Variable
24Variable
25ExprTuple26
26Variable