logo

Expression of type Lambda

from the theory of proveit.numbers.number_sets.complex_numbers

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 Lambda, a, b
from proveit.logic import Equals
from proveit.numbers import Add, Conjugate, Mult, i, subtract
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Mult(i, b)
expr = Lambda([a, b], Equals(Conjugate(Add(a, sub_expr1)), subtract(a, sub_expr1)))
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\right) \mapsto \left(\left(\left(a + \left(\mathsf{i} \cdot b\right)\right)^*\right) = \left(a - \left(\mathsf{i} \cdot b\right)\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
1ExprTuple16, 21
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6
5Operationoperator: 7
operand: 10
6Operationoperator: 12
operands: 9
7Literal
8ExprTuple10
9ExprTuple16, 11
10Operationoperator: 12
operands: 13
11Operationoperator: 14
operand: 17
12Literal
13ExprTuple16, 17
14Literal
15ExprTuple17
16Variable
17Operationoperator: 18
operands: 19
18Literal
19ExprTuple20, 21
20Literal
21Variable