logo

Expression of type Lambda

from the theory of proveit.numbers.exponentiation

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, a, m
from proveit.core_expr_types import k_1_to_m
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Add, Complex, Exp, NaturalPos
from proveit.numbers.exponentiation import prod_a_raise_ki__1_to_m
In [2]:
# build up the expression from sub-expressions
expr = Lambda(m, Conditional(Forall(instance_param_or_params = [a, k_1_to_m], instance_expr = Equals(prod_a_raise_ki__1_to_m, Exp(a, Add(k_1_to_m))), domains = [Complex, NaturalPos]), InSet(m, NaturalPos)))
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())
m \mapsto \left\{\forall_{a \in \mathbb{C},\left(k_{1} \in \mathbb{N}^+\right), \left(k_{2} \in \mathbb{N}^+\right), \ldots, \left(k_{m} \in \mathbb{N}^+\right)}~\left(\left(a^{k_{1}} \cdot  a^{k_{2}} \cdot  \ldots \cdot  a^{k_{m}}\right) = a^{k_{1} +  k_{2} +  \ldots +  k_{m}}\right) \textrm{ if } m \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: 42
body: 2
1ExprTuple42
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 33
operands: 7
5Literal
6ExprTuple8
7ExprTuple42, 37
8Lambdaparameters: 9
body: 10
9ExprTuple43, 36
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operands: 14
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17, 18
15Literal
16ExprTuple19, 20
17Operationoperator: 21
operands: 22
18Operationoperator: 38
operands: 23
19Operationoperator: 33
operands: 24
20ExprRangelambda_map: 25
start_index: 41
end_index: 42
21Literal
22ExprTuple26
23ExprTuple43, 27
24ExprTuple43, 28
25Lambdaparameter: 47
body: 29
26ExprRangelambda_map: 30
start_index: 41
end_index: 42
27Operationoperator: 31
operands: 32
28Literal
29Operationoperator: 33
operands: 34
30Lambdaparameter: 47
body: 35
31Literal
32ExprTuple36
33Literal
34ExprTuple44, 37
35Operationoperator: 38
operands: 39
36ExprRangelambda_map: 40
start_index: 41
end_index: 42
37Literal
38Literal
39ExprTuple43, 44
40Lambdaparameter: 47
body: 44
41Literal
42Variable
43Variable
44IndexedVarvariable: 45
index: 47
45Variable
46ExprTuple47
47Variable