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