logo

Expression of type Implies

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 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, Implies, 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 = 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)))
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)\right] \Rightarrow \left(U \in \textrm{U}\left(n\right)\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()()('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4
3Operationoperator: 5
operand: 8
4Operationoperator: 28
operands: 7
5Literal
6ExprTuple8
7ExprTuple43, 9
8Lambdaparameters: 26
body: 10
9Operationoperator: 11
operand: 46
10Conditionalvalue: 13
condition: 14
11Literal
12ExprTuple46
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 23
operands: 24
20Operationoperator: 25
operands: 26
21Operationoperator: 28
operands: 27
22Operationoperator: 28
operands: 29
23Literal
24ExprTuple30, 31, 43, 32
25Literal
26ExprTuple50, 51
27ExprTuple50, 33
28Literal
29ExprTuple51, 33
30Operationoperator: 34
operand: 42
31Operationoperator: 36
operand: 43
32Operationoperator: 38
operand: 44
33Operationoperator: 40
operands: 41
34Literal
35ExprTuple42
36Literal
37ExprTuple43
38Literal
39ExprTuple44
40Literal
41ExprTuple45, 46
42IndexedVarvariable: 48
index: 50
43Variable
44IndexedVarvariable: 48
index: 51
45Literal
46Variable
47ExprTuple50
48Variable
49ExprTuple51
50Variable
51Variable