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, n
from proveit.core_expr_types import a_1_to_n
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Complex, Mult, NaturalPos, one, sqrt
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprTuple(Lambda(n, Conditional(Forall(instance_param_or_params = [a_1_to_n], instance_expr = Equals(sqrt(Mult(a_1_to_n)), Mult(ExprRange(sub_expr1, sqrt(IndexedVar(a, sub_expr1)), one, n))), domain = Complex), 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(n \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{n} \in \mathbb{C}}~\left(\sqrt{\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{n}\right)} = \left(\sqrt{\left(a_{1}\right)} \cdot  \sqrt{\left(a_{2}\right)} \cdot  \ldots \cdot  \sqrt{\left(a_{n}\right)}\right)\right) \textrm{ if } n \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: 36
body: 3
2ExprTuple36
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 30
operands: 8
6Literal
7ExprTuple9
8ExprTuple36, 10
9Lambdaparameters: 28
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18, 19
16Literal
17ExprTuple20
18Operationoperator: 37
operands: 21
19Operationoperator: 27
operands: 22
20ExprRangelambda_map: 23
start_index: 46
end_index: 36
21ExprTuple24, 40
22ExprTuple25
23Lambdaparameter: 45
body: 26
24Operationoperator: 27
operands: 28
25ExprRangelambda_map: 29
start_index: 46
end_index: 36
26Operationoperator: 30
operands: 31
27Literal
28ExprTuple32
29Lambdaparameter: 45
body: 33
30Literal
31ExprTuple39, 34
32ExprRangelambda_map: 35
start_index: 46
end_index: 36
33Operationoperator: 37
operands: 38
34Literal
35Lambdaparameter: 45
body: 39
36Variable
37Literal
38ExprTuple39, 40
39IndexedVarvariable: 41
index: 45
40Operationoperator: 43
operands: 44
41Variable
42ExprTuple45
43Literal
44ExprTuple46, 47
45Variable
46Literal
47Literal