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
from proveit.core_expr_types import b_1_to_m
from proveit.logic import Equals, Forall, NotEquals
from proveit.numbers import Add, Complex, Exp, Real, zero
from proveit.numbers.exponentiation import prod_a_raise_bi__1_to_m
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [a, b_1_to_m], instance_expr = Equals(prod_a_raise_bi__1_to_m, Exp(a, Add(b_1_to_m))), domains = [Complex, Real], condition = NotEquals(a, zero))
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_{a \in \mathbb{C},\left(b_{1} \in \mathbb{R}\right), \left(b_{2} \in \mathbb{R}\right), \ldots, \left(b_{m} \in \mathbb{R}\right)~|~a \neq 0}~\left(\left(a^{b_{1}} \cdot  a^{b_{2}} \cdot  \ldots \cdot  a^{b_{m}}\right) = a^{b_{1} +  b_{2} +  \ldots +  b_{m}}\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: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameters: 4
body: 5
4ExprTuple42, 35
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15, 16
12Operationoperator: 17
operands: 18
13Operationoperator: 37
operands: 19
14Operationoperator: 32
operands: 20
15ExprRangelambda_map: 21
start_index: 40
end_index: 41
16Operationoperator: 22
operands: 23
17Literal
18ExprTuple24
19ExprTuple42, 25
20ExprTuple42, 26
21Lambdaparameter: 46
body: 27
22Literal
23ExprTuple42, 28
24ExprRangelambda_map: 29
start_index: 40
end_index: 41
25Operationoperator: 30
operands: 31
26Literal
27Operationoperator: 32
operands: 33
28Literal
29Lambdaparameter: 46
body: 34
30Literal
31ExprTuple35
32Literal
33ExprTuple43, 36
34Operationoperator: 37
operands: 38
35ExprRangelambda_map: 39
start_index: 40
end_index: 41
36Literal
37Literal
38ExprTuple42, 43
39Lambdaparameter: 46
body: 43
40Literal
41Variable
42Variable
43IndexedVarvariable: 44
index: 46
44Variable
45ExprTuple46
46Variable