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, ExprTuple, Lambda, U, n
from proveit.linear_algebra import Adj, MatrixSpace, Unitary
from proveit.logic import Equals, Exists, InSet
from proveit.numbers import Complex, sqrt
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 = [U], instance_expr = Equals(A, Qmult(U, sqrt(Qmult(Adj(A), A)))), domain = Unitary(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_{U \in \textrm{U}\left(n\right)}~\left(A = \left(U \thinspace \sqrt{\left(A^{\dagger} \thinspace A\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: 42
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 19
operands: 7
5Literal
6ExprTuple8
7ExprTuple42, 9
8Lambdaparameter: 26
body: 11
9Operationoperator: 12
operands: 13
10ExprTuple26
11Conditionalvalue: 14
condition: 15
12Literal
13NamedExprsfield: 16
rows: 28
columns: 28
14Operationoperator: 17
operands: 18
15Operationoperator: 19
operands: 20
16Literal
17Literal
18ExprTuple42, 21
19Literal
20ExprTuple26, 22
21Operationoperator: 33
operands: 23
22Operationoperator: 24
operand: 28
23ExprTuple26, 27
24Literal
25ExprTuple28
26Variable
27Operationoperator: 29
operands: 30
28Variable
29Literal
30ExprTuple31, 32
31Operationoperator: 33
operands: 34
32Operationoperator: 35
operands: 36
33Literal
34ExprTuple37, 42
35Literal
36ExprTuple38, 39
37Operationoperator: 40
operand: 42
38Literal
39Literal
40Literal
41ExprTuple42
42Variable