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 Equals, Exists, InSet
from proveit.numbers import sqrt
In [2]:
# build up the expression from sub-expressions
sub_expr1 = LinMap(Hspace, Hspace)
expr = Lambda(A, Conditional(Exists(instance_param_or_params = [U], instance_expr = Equals(A, Composition(sqrt(Composition(A, Adj(A))), U)), domain = sub_expr1, condition = Equals(Composition(Adj(U), U), Identity(Hspace))).with_wrapping(), InSet(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())
A \mapsto \left\{\begin{array}{l}\exists_{U \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\right)~|~\left(U^{\dagger} \circ U\right) = I_{\mathcal{H}}}~\\
\left(A = \left(\sqrt{\left(A \circ A^{\dagger}\right)} \circ U\right)\right)\end{array} \textrm{ if } A \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\right)\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 48
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 4
operand: 7
3Operationoperator: 18
operands: 6
4Literal
5ExprTuple7
6ExprTuple48, 23
7Lambdaparameter: 45
body: 8
8Conditionalvalue: 9
condition: 10
9Operationoperator: 20
operands: 11
10Operationoperator: 12
operands: 13
11ExprTuple48, 14
12Literal
13ExprTuple15, 16
14Operationoperator: 37
operands: 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17ExprTuple22, 45
18Literal
19ExprTuple45, 23
20Literal
21ExprTuple24, 25
22Operationoperator: 26
operands: 27
23Operationoperator: 28
operands: 29
24Operationoperator: 37
operands: 30
25Operationoperator: 31
operand: 36
26Literal
27ExprTuple33, 34
28Literal
29ExprTuple36, 36
30ExprTuple35, 45
31Literal
32ExprTuple36
33Operationoperator: 37
operands: 38
34Operationoperator: 39
operands: 40
35Operationoperator: 46
operand: 45
36Variable
37Literal
38ExprTuple48, 42
39Literal
40ExprTuple43, 44
41ExprTuple45
42Operationoperator: 46
operand: 48
43Literal
44Literal
45Variable
46Literal
47ExprTuple48
48Variable