logo

Expression of type Lambda

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, Lambda, 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 = Lambda([a, b, c, d], 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, c, d\right) \mapsto \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()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 1
body: 2
1ExprTuple40, 33, 41, 42
2Conditionalvalue: 3
condition: 4
3Operationoperator: 26
operands: 5
4Operationoperator: 6
operands: 7
5ExprTuple8, 9
6Literal
7ExprTuple10, 11, 12, 13, 14, 15
8Operationoperator: 36
operands: 16
9Operationoperator: 17
operands: 18
10Operationoperator: 22
operands: 19
11Operationoperator: 22
operands: 20
12Operationoperator: 22
operands: 21
13Operationoperator: 22
operands: 23
14Operationoperator: 24
operands: 25
15Operationoperator: 26
operands: 27
16ExprTuple40, 33
17Literal
18ExprTuple28, 29
19ExprTuple40, 30
20ExprTuple33, 31
21ExprTuple41, 31
22Literal
23ExprTuple42, 31
24Literal
25ExprTuple40, 32
26Literal
27ExprTuple33, 34
28Operationoperator: 36
operands: 35
29Operationoperator: 36
operands: 37
30Literal
31Literal
32Literal
33Variable
34Operationoperator: 38
operands: 39
35ExprTuple40, 41
36Literal
37ExprTuple40, 42
38Literal
39ExprTuple41, 42
40Variable
41Variable
42Variable