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 ExprTuple, U, i, j, n
from proveit.core_expr_types import v_i, v_j
from proveit.linear_algebra import Adj, Unitary
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Interval, KroneckerDelta, one
from proveit.physics.quantum import Bra, Ket, Qmult
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(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)))
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(\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), U \in \textrm{U}\left(n\right)\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 3
operand: 6
2Operationoperator: 26
operands: 5
3Literal
4ExprTuple6
5ExprTuple41, 7
6Lambdaparameters: 24
body: 8
7Operationoperator: 9
operand: 44
8Conditionalvalue: 11
condition: 12
9Literal
10ExprTuple44
11Operationoperator: 13
operands: 14
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17, 18
15Literal
16ExprTuple19, 20
17Operationoperator: 21
operands: 22
18Operationoperator: 23
operands: 24
19Operationoperator: 26
operands: 25
20Operationoperator: 26
operands: 27
21Literal
22ExprTuple28, 29, 41, 30
23Literal
24ExprTuple48, 49
25ExprTuple48, 31
26Literal
27ExprTuple49, 31
28Operationoperator: 32
operand: 40
29Operationoperator: 34
operand: 41
30Operationoperator: 36
operand: 42
31Operationoperator: 38
operands: 39
32Literal
33ExprTuple40
34Literal
35ExprTuple41
36Literal
37ExprTuple42
38Literal
39ExprTuple43, 44
40IndexedVarvariable: 46
index: 48
41Variable
42IndexedVarvariable: 46
index: 49
43Literal
44Variable
45ExprTuple48
46Variable
47ExprTuple49
48Variable
49Variable