logo

Expression of type Conditional

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, a, m
from proveit.core_expr_types import k_1_to_m
from proveit.logic import Equals, Forall, InSet
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 = Conditional(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]), 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\{\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) \textrm{ if } m \in \mathbb{N}^+\right..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 3
operand: 6
2Operationoperator: 31
operands: 5
3Literal
4ExprTuple6
5ExprTuple40, 35
6Lambdaparameters: 7
body: 8
7ExprTuple41, 34
8Conditionalvalue: 9
condition: 10
9Operationoperator: 11
operands: 12
10Operationoperator: 13
operands: 14
11Literal
12ExprTuple15, 16
13Literal
14ExprTuple17, 18
15Operationoperator: 19
operands: 20
16Operationoperator: 36
operands: 21
17Operationoperator: 31
operands: 22
18ExprRangelambda_map: 23
start_index: 39
end_index: 40
19Literal
20ExprTuple24
21ExprTuple41, 25
22ExprTuple41, 26
23Lambdaparameter: 45
body: 27
24ExprRangelambda_map: 28
start_index: 39
end_index: 40
25Operationoperator: 29
operands: 30
26Literal
27Operationoperator: 31
operands: 32
28Lambdaparameter: 45
body: 33
29Literal
30ExprTuple34
31Literal
32ExprTuple42, 35
33Operationoperator: 36
operands: 37
34ExprRangelambda_map: 38
start_index: 39
end_index: 40
35Literal
36Literal
37ExprTuple41, 42
38Lambdaparameter: 45
body: 42
39Literal
40Variable
41Variable
42IndexedVarvariable: 43
index: 45
43Variable
44ExprTuple45
45Variable