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, Function, Lambda, R, S, a, f, fa, fx, g, gy, n, x, y
from proveit.logic import Card, Equals, Forall, Implies, InSet, SetOfAll
from proveit.numbers import Complex, Natural, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [y]
expr = Lambda(n, Conditional(Forall(instance_param_or_params = [f, g, R, S], instance_expr = Implies(Forall(instance_param_or_params = [a], instance_expr = InSet(fa, Complex), domain = R), Equals(Sum(index_or_indices = [x], summand = fx, domain = R), Sum(index_or_indices = sub_expr1, summand = Function(f, [gy]), domain = S))), conditions = [Equals(SetOfAll(instance_param_or_params = sub_expr1, instance_element = gy, domain = S), R), Equals(Card(S), n), Equals(Card(R), n)]), InSet(n, Natural)))
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())
n \mapsto \left\{\forall_{f, g, R, S~|~\left\{g\left(y\right)\right\}_{y \in S} = R, |S| = n, |R| = n}~\left(\left[\forall_{a \in R}~\left(f\left(a\right) \in \mathbb{C}\right)\right] \Rightarrow \left(\left[\sum_{x \in R}~f\left(x\right)\right] = \left[\sum_{y \in S}~f\left(g\left(y\right)\right)\right]\right)\right) \textrm{ if } n \in \mathbb{N}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 35
body: 2
1ExprTuple35
2Conditionalvalue: 3
condition: 4
3Operationoperator: 22
operand: 7
4Operationoperator: 66
operands: 6
5ExprTuple7
6ExprTuple35, 8
7Lambdaparameters: 9
body: 10
8Literal
9ExprTuple64, 73, 70, 72
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operands: 14
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17, 18
15Literal
16ExprTuple19, 20, 21
17Operationoperator: 22
operand: 29
18Operationoperator: 27
operands: 24
19Operationoperator: 27
operands: 25
20Operationoperator: 27
operands: 26
21Operationoperator: 27
operands: 28
22Literal
23ExprTuple29
24ExprTuple30, 31
25ExprTuple32, 70
26ExprTuple33, 35
27Literal
28ExprTuple34, 35
29Lambdaparameter: 68
body: 36
30Operationoperator: 38
operand: 47
31Operationoperator: 38
operand: 48
32Operationoperator: 40
operand: 49
33Operationoperator: 43
operand: 72
34Operationoperator: 43
operand: 70
35Variable
36Conditionalvalue: 45
condition: 46
37ExprTuple47
38Literal
39ExprTuple48
40Literal
41ExprTuple49
42ExprTuple72
43Literal
44ExprTuple70
45Operationoperator: 66
operands: 50
46Operationoperator: 66
operands: 51
47Lambdaparameter: 69
body: 52
48Lambdaparameter: 75
body: 53
49Lambdaparameter: 75
body: 54
50ExprTuple55, 56
51ExprTuple68, 70
52Conditionalvalue: 57
condition: 58
53Conditionalvalue: 59
condition: 60
54Conditionalvalue: 71
condition: 60
55Operationoperator: 64
operand: 68
56Literal
57Operationoperator: 64
operand: 69
58Operationoperator: 66
operands: 63
59Operationoperator: 64
operand: 71
60Operationoperator: 66
operands: 67
61ExprTuple68
62ExprTuple69
63ExprTuple69, 70
64Variable
65ExprTuple71
66Literal
67ExprTuple75, 72
68Variable
69Variable
70Variable
71Operationoperator: 73
operand: 75
72Variable
73Variable
74ExprTuple75
75Variable