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