logo

Expression of type Lambda

from the theory of proveit.linear_algebra.inner_products

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, Composition, Conditional, Lambda, U
from proveit.linear_algebra import Adj, Hspace, Identity, LinMap
from proveit.logic import And, Equals, InSet
from proveit.numbers import sqrt
In [2]:
# build up the expression from sub-expressions
expr = Lambda(U, Conditional(Equals(A, Composition(sqrt(Composition(A, Adj(A))), U)), And(InSet(U, LinMap(Hspace, Hspace)), Equals(Composition(Adj(U), U), Identity(Hspace)))))
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())
U \mapsto \left\{A = \left(\sqrt{\left(A \circ A^{\dagger}\right)} \circ U\right) \textrm{ if } U \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\right) ,  \left(U^{\dagger} \circ U\right) = I_{\mathcal{H}}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 38
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 13
operands: 4
3Operationoperator: 5
operands: 6
4ExprTuple41, 7
5Literal
6ExprTuple8, 9
7Operationoperator: 30
operands: 10
8Operationoperator: 11
operands: 12
9Operationoperator: 13
operands: 14
10ExprTuple15, 38
11Literal
12ExprTuple38, 16
13Literal
14ExprTuple17, 18
15Operationoperator: 19
operands: 20
16Operationoperator: 21
operands: 22
17Operationoperator: 30
operands: 23
18Operationoperator: 24
operand: 29
19Literal
20ExprTuple26, 27
21Literal
22ExprTuple29, 29
23ExprTuple28, 38
24Literal
25ExprTuple29
26Operationoperator: 30
operands: 31
27Operationoperator: 32
operands: 33
28Operationoperator: 39
operand: 38
29Variable
30Literal
31ExprTuple41, 35
32Literal
33ExprTuple36, 37
34ExprTuple38
35Operationoperator: 39
operand: 41
36Literal
37Literal
38Variable
39Literal
40ExprTuple41
41Variable