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, b, c, d
from proveit.logic import And, Equals, InSet, NotEquals
from proveit.numbers import Add, Exp, Integer, Mult, Real, zero
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Equals(Exp(a, b), Mult(Exp(a, c), Exp(a, d))), And(InSet(a, Real), InSet(b, Integer), InSet(c, Integer), InSet(d, Integer), NotEquals(a, zero), Equals(b, Add(c, d))))
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\{a^{b} = \left(a^{c} \cdot a^{d}\right) \textrm{ if } a \in \mathbb{R} ,  b \in \mathbb{Z} ,  c \in \mathbb{Z} ,  d \in \mathbb{Z} ,  a \neq 0 ,  b = \left(c + d\right)\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: 24
operands: 3
2Operationoperator: 4
operands: 5
3ExprTuple6, 7
4Literal
5ExprTuple8, 9, 10, 11, 12, 13
6Operationoperator: 34
operands: 14
7Operationoperator: 15
operands: 16
8Operationoperator: 20
operands: 17
9Operationoperator: 20
operands: 18
10Operationoperator: 20
operands: 19
11Operationoperator: 20
operands: 21
12Operationoperator: 22
operands: 23
13Operationoperator: 24
operands: 25
14ExprTuple38, 31
15Literal
16ExprTuple26, 27
17ExprTuple38, 28
18ExprTuple31, 29
19ExprTuple39, 29
20Literal
21ExprTuple40, 29
22Literal
23ExprTuple38, 30
24Literal
25ExprTuple31, 32
26Operationoperator: 34
operands: 33
27Operationoperator: 34
operands: 35
28Literal
29Literal
30Literal
31Variable
32Operationoperator: 36
operands: 37
33ExprTuple38, 39
34Literal
35ExprTuple38, 40
36Literal
37ExprTuple39, 40
38Variable
39Variable
40Variable