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 Conditional, ExprTuple, Lambda, U, i, j, n
from proveit.core_expr_types import v_1_to_n, v_i, v_j
from proveit.linear_algebra import Adj, OrthoNormBases, Unitary
from proveit.logic import CartExp, Equals, Forall, Implies, InSet, Set
from proveit.numbers import Complex, Interval, KroneckerDelta, one
from proveit.physics.quantum import Bra, Ket, Qmult
from proveit.physics.quantum.algebra import v_1_to_n_kets
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([v_1_to_n], Conditional(Implies(Forall(instance_param_or_params = [i, j], instance_expr = Equals(Qmult(Bra(v_i), Adj(U), U, Ket(v_j)), KroneckerDelta(i, j)), domain = Interval(one, n)), InSet(U, Unitary(n))), InSet(Set(v_1_to_n_kets), OrthoNormBases(CartExp(Complex, 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(\left(v_{1}, v_{2}, \ldots, v_{n}\right) \mapsto \left\{\left[\forall_{i, j \in \{1~\ldotp \ldotp~n\}}~\left(\left(\langle v_{i} \rvert \thinspace U^{\dagger} \thinspace U \thinspace \lvert v_{j} \rangle\right) = \delta_{i, j}\right)\right] \Rightarrow \left(U \in \textrm{U}\left(n\right)\right) \textrm{ if } \left\{\left\{\lvert v_{1} \rangle, \lvert v_{2} \rangle, \ldots, \lvert v_{n} \rangle\right\}\right\} \in \textrm{O.N.Bases}\left(\mathbb{C}^{n}\right)\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
1Lambdaparameters: 2
body: 3
2ExprTuple4
3Conditionalvalue: 5
condition: 6
4ExprRangelambda_map: 7
start_index: 71
end_index: 72
5Operationoperator: 8
operands: 9
6Operationoperator: 51
operands: 10
7Lambdaparameter: 73
body: 58
8Literal
9ExprTuple11, 12
10ExprTuple13, 14
11Operationoperator: 15
operand: 21
12Operationoperator: 51
operands: 17
13Operationoperator: 28
operand: 23
14Operationoperator: 19
operand: 24
15Literal
16ExprTuple21
17ExprTuple69, 22
18ExprTuple23
19Literal
20ExprTuple24
21Lambdaparameters: 49
body: 25
22Operationoperator: 26
operand: 72
23Operationoperator: 28
operands: 29
24Operationoperator: 30
operands: 31
25Conditionalvalue: 32
condition: 33
26Literal
27ExprTuple72
28Literal
29ExprTuple34
30Literal
31ExprTuple35, 72
32Operationoperator: 36
operands: 37
33Operationoperator: 38
operands: 39
34ExprRangelambda_map: 40
start_index: 71
end_index: 72
35Literal
36Literal
37ExprTuple41, 42
38Literal
39ExprTuple43, 44
40Lambdaparameter: 73
body: 45
41Operationoperator: 46
operands: 47
42Operationoperator: 48
operands: 49
43Operationoperator: 51
operands: 50
44Operationoperator: 51
operands: 52
45Operationoperator: 63
operand: 58
46Literal
47ExprTuple54, 55, 69, 56
48Literal
49ExprTuple77, 78
50ExprTuple77, 57
51Literal
52ExprTuple78, 57
53ExprTuple58
54Operationoperator: 59
operand: 68
55Operationoperator: 61
operand: 69
56Operationoperator: 63
operand: 70
57Operationoperator: 65
operands: 66
58IndexedVarvariable: 75
index: 73
59Literal
60ExprTuple68
61Literal
62ExprTuple69
63Literal
64ExprTuple70
65Literal
66ExprTuple71, 72
67ExprTuple73
68IndexedVarvariable: 75
index: 77
69Variable
70IndexedVarvariable: 75
index: 78
71Literal
72Variable
73Variable
74ExprTuple77
75Variable
76ExprTuple78
77Variable
78Variable