logo

Expression of type Forall

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 a, m
from proveit.core_expr_types import k_1_to_m
from proveit.logic import Equals, Forall
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 = Forall(instance_param_or_params = [m], instance_expr = 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]), domain = 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())
\forall_{m \in \mathbb{N}^+}~\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)\right]
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 7
operand: 2
1ExprTuple2
2Lambdaparameter: 44
body: 4
3ExprTuple44
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 35
operands: 9
7Literal
8ExprTuple10
9ExprTuple44, 39
10Lambdaparameters: 11
body: 12
11ExprTuple45, 38
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 23
operands: 24
20Operationoperator: 40
operands: 25
21Operationoperator: 35
operands: 26
22ExprRangelambda_map: 27
start_index: 43
end_index: 44
23Literal
24ExprTuple28
25ExprTuple45, 29
26ExprTuple45, 30
27Lambdaparameter: 49
body: 31
28ExprRangelambda_map: 32
start_index: 43
end_index: 44
29Operationoperator: 33
operands: 34
30Literal
31Operationoperator: 35
operands: 36
32Lambdaparameter: 49
body: 37
33Literal
34ExprTuple38
35Literal
36ExprTuple46, 39
37Operationoperator: 40
operands: 41
38ExprRangelambda_map: 42
start_index: 43
end_index: 44
39Literal
40Literal
41ExprTuple45, 46
42Lambdaparameter: 49
body: 46
43Literal
44Variable
45Variable
46IndexedVarvariable: 47
index: 49
47Variable
48ExprTuple49
49Variable