logo

Expression of type ExprTuple

from the theory of proveit.physics.quantum.algebra

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, Conditional, D, ExprTuple, Lambda, U, V, n
from proveit.linear_algebra import Diagonal, MatrixSpace, Unitary
from proveit.logic import Equals, Exists, InSet
from proveit.numbers import Complex
from proveit.physics.quantum import Qmult
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(A, Conditional(Exists(instance_param_or_params = [D], instance_expr = Exists(instance_param_or_params = [U, V], instance_expr = Equals(A, Qmult(U, D, V)), domain = Unitary(n)), domain = Diagonal(n)), InSet(A, MatrixSpace(field = Complex, rows = n, columns = n)))))
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(A \mapsto \left\{\exists_{D \in \textrm{D}\left(n\right)}~\left[\exists_{U, V \in \textrm{U}\left(n\right)}~\left(A = \left(U \thinspace D \thinspace V\right)\right)\right] \textrm{ if } A \in \mathbb{C}^{n \times n}\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: 31
body: 3
2ExprTuple31
3Conditionalvalue: 4
condition: 5
4Operationoperator: 17
operand: 8
5Operationoperator: 38
operands: 7
6ExprTuple8
7ExprTuple31, 9
8Lambdaparameter: 40
body: 11
9Operationoperator: 12
operands: 13
10ExprTuple40
11Conditionalvalue: 14
condition: 15
12Literal
13NamedExprsfield: 16
rows: 46
columns: 46
14Operationoperator: 17
operand: 20
15Operationoperator: 38
operands: 19
16Literal
17Literal
18ExprTuple20
19ExprTuple40, 21
20Lambdaparameters: 22
body: 23
21Operationoperator: 24
operand: 46
22ExprTuple41, 42
23Conditionalvalue: 25
condition: 26
24Literal
25Operationoperator: 27
operands: 28
26Operationoperator: 29
operands: 30
27Literal
28ExprTuple31, 32
29Literal
30ExprTuple33, 34
31Variable
32Operationoperator: 35
operands: 36
33Operationoperator: 38
operands: 37
34Operationoperator: 38
operands: 39
35Literal
36ExprTuple41, 40, 42
37ExprTuple41, 43
38Literal
39ExprTuple42, 43
40Variable
41Variable
42Variable
43Operationoperator: 44
operand: 46
44Literal
45ExprTuple46
46Variable