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, 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 = ExprTuple(Lambda(U, Conditional(Equals(A, Composition(U, sqrt(Composition(Adj(A), A)))), 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())
\left(U \mapsto \left\{A = \left(U \circ \sqrt{\left(A^{\dagger} \circ A\right)}\right) \textrm{ if } U \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\right) ,  \left(U^{\dagger} \circ U\right) = I_{\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
0ExprTuple1
1Lambdaparameter: 39
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 14
operands: 5
4Operationoperator: 6
operands: 7
5ExprTuple42, 8
6Literal
7ExprTuple9, 10
8Operationoperator: 31
operands: 11
9Operationoperator: 12
operands: 13
10Operationoperator: 14
operands: 15
11ExprTuple39, 16
12Literal
13ExprTuple39, 17
14Literal
15ExprTuple18, 19
16Operationoperator: 20
operands: 21
17Operationoperator: 22
operands: 23
18Operationoperator: 31
operands: 24
19Operationoperator: 25
operand: 30
20Literal
21ExprTuple27, 28
22Literal
23ExprTuple30, 30
24ExprTuple29, 39
25Literal
26ExprTuple30
27Operationoperator: 31
operands: 32
28Operationoperator: 33
operands: 34
29Operationoperator: 40
operand: 39
30Variable
31Literal
32ExprTuple36, 42
33Literal
34ExprTuple37, 38
35ExprTuple39
36Operationoperator: 40
operand: 42
37Literal
38Literal
39Variable
40Literal
41ExprTuple42
42Variable