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, HilbertSpaces, Hspace, Identity, LinMap
from proveit.logic import Equals, Exists, Forall, InClass
from proveit.numbers import sqrt
In [2]:
# build up the expression from sub-expressions
sub_expr1 = LinMap(Hspace, Hspace)
expr = Lambda(Hspace, Conditional(Forall(instance_param_or_params = [A], instance_expr = 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(), domain = sub_expr1), InClass(Hspace, HilbertSpaces)))
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())
\mathcal{H} \mapsto \left\{\forall_{A \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\right)}~\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}\right] \textrm{ if } \mathcal{H} \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 45
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 4
operand: 8
3Operationoperator: 6
operands: 7
4Literal
5ExprTuple8
6Literal
7ExprTuple45, 9
8Lambdaparameter: 57
body: 10
9Literal
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operand: 16
12Operationoperator: 27
operands: 15
13Literal
14ExprTuple16
15ExprTuple57, 32
16Lambdaparameter: 54
body: 17
17Conditionalvalue: 18
condition: 19
18Operationoperator: 29
operands: 20
19Operationoperator: 21
operands: 22
20ExprTuple57, 23
21Literal
22ExprTuple24, 25
23Operationoperator: 46
operands: 26
24Operationoperator: 27
operands: 28
25Operationoperator: 29
operands: 30
26ExprTuple31, 54
27Literal
28ExprTuple54, 32
29Literal
30ExprTuple33, 34
31Operationoperator: 35
operands: 36
32Operationoperator: 37
operands: 38
33Operationoperator: 46
operands: 39
34Operationoperator: 40
operand: 45
35Literal
36ExprTuple42, 43
37Literal
38ExprTuple45, 45
39ExprTuple44, 54
40Literal
41ExprTuple45
42Operationoperator: 46
operands: 47
43Operationoperator: 48
operands: 49
44Operationoperator: 55
operand: 54
45Variable
46Literal
47ExprTuple57, 51
48Literal
49ExprTuple52, 53
50ExprTuple54
51Operationoperator: 55
operand: 57
52Literal
53Literal
54Variable
55Literal
56ExprTuple57
57Variable