logo

Expression of type ExprTuple

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, ExprTuple, 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 = ExprTuple(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())
\left(\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..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 46
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 9
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9
7Literal
8ExprTuple46, 10
9Lambdaparameter: 58
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operand: 17
13Operationoperator: 28
operands: 16
14Literal
15ExprTuple17
16ExprTuple58, 33
17Lambdaparameter: 55
body: 18
18Conditionalvalue: 19
condition: 20
19Operationoperator: 30
operands: 21
20Operationoperator: 22
operands: 23
21ExprTuple58, 24
22Literal
23ExprTuple25, 26
24Operationoperator: 47
operands: 27
25Operationoperator: 28
operands: 29
26Operationoperator: 30
operands: 31
27ExprTuple32, 55
28Literal
29ExprTuple55, 33
30Literal
31ExprTuple34, 35
32Operationoperator: 36
operands: 37
33Operationoperator: 38
operands: 39
34Operationoperator: 47
operands: 40
35Operationoperator: 41
operand: 46
36Literal
37ExprTuple43, 44
38Literal
39ExprTuple46, 46
40ExprTuple45, 55
41Literal
42ExprTuple46
43Operationoperator: 47
operands: 48
44Operationoperator: 49
operands: 50
45Operationoperator: 56
operand: 55
46Variable
47Literal
48ExprTuple58, 52
49Literal
50ExprTuple53, 54
51ExprTuple55
52Operationoperator: 56
operand: 58
53Literal
54Literal
55Variable
56Literal
57ExprTuple58
58Variable