logo

Expression of type ExprTuple

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, ExprRange, ExprTuple, IndexedVar, Lambda, Variable, a, b, m
from proveit.core_expr_types import a_1_to_m
from proveit.logic import Equals, Forall, InSet, NotEquals
from proveit.numbers import Complex, Exp, Mult, NaturalPos, Real, one, zero
from proveit.numbers.exponentiation import prod_ai_raise_b__1_to_m
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprTuple(Lambda(m, Conditional(Forall(instance_param_or_params = [a_1_to_m, b], instance_expr = Equals(Exp(Mult(a_1_to_m), b), prod_ai_raise_b__1_to_m), domains = [Complex, Real], condition = ExprRange(sub_expr1, NotEquals(IndexedVar(a, sub_expr1), zero), one, m)), 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())
\left(m \mapsto \left\{\forall_{\left(a_{1} \in \mathbb{C}\right), \left(a_{2} \in \mathbb{C}\right), \ldots, \left(a_{m} \in \mathbb{C}\right), b \in \mathbb{R}~|~\left(a_{1} \neq 0\right), \left(a_{2} \neq 0\right), \ldots, \left(a_{m} \neq 0\right)}~\left(\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{m}\right)^{b} = \left(\left(a_{1}\right)^{b} \cdot  \left(a_{2}\right)^{b} \cdot  \ldots \cdot  \left(a_{m}\right)^{b}\right)\right) \textrm{ if } m \in \mathbb{N}^+\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 47
body: 3
2ExprTuple47
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 37
operands: 8
6Literal
7ExprTuple9
8ExprTuple47, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple41, 51
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22, 23
19Operationoperator: 48
operands: 24
20Operationoperator: 34
operands: 25
21ExprRangelambda_map: 26
start_index: 46
end_index: 47
22Operationoperator: 37
operands: 27
23ExprRangelambda_map: 28
start_index: 46
end_index: 47
24ExprTuple29, 51
25ExprTuple30
26Lambdaparameter: 54
body: 31
27ExprTuple51, 32
28Lambdaparameter: 54
body: 33
29Operationoperator: 34
operands: 35
30ExprRangelambda_map: 36
start_index: 46
end_index: 47
31Operationoperator: 37
operands: 38
32Literal
33Operationoperator: 39
operands: 40
34Literal
35ExprTuple41
36Lambdaparameter: 54
body: 42
37Literal
38ExprTuple50, 43
39Literal
40ExprTuple50, 44
41ExprRangelambda_map: 45
start_index: 46
end_index: 47
42Operationoperator: 48
operands: 49
43Literal
44Literal
45Lambdaparameter: 54
body: 50
46Literal
47Variable
48Literal
49ExprTuple50, 51
50IndexedVarvariable: 52
index: 54
51Variable
52Variable
53ExprTuple54
54Variable