logo

Expression of type Conditional

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, U, i, j, n
from proveit.core_expr_types import 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 = 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[\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..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 3
operands: 4
2Operationoperator: 46
operands: 5
3Literal
4ExprTuple6, 7
5ExprTuple8, 9
6Operationoperator: 10
operand: 16
7Operationoperator: 46
operands: 12
8Operationoperator: 23
operand: 18
9Operationoperator: 14
operand: 19
10Literal
11ExprTuple16
12ExprTuple64, 17
13ExprTuple18
14Literal
15ExprTuple19
16Lambdaparameters: 44
body: 20
17Operationoperator: 21
operand: 67
18Operationoperator: 23
operands: 24
19Operationoperator: 25
operands: 26
20Conditionalvalue: 27
condition: 28
21Literal
22ExprTuple67
23Literal
24ExprTuple29
25Literal
26ExprTuple30, 67
27Operationoperator: 31
operands: 32
28Operationoperator: 33
operands: 34
29ExprRangelambda_map: 35
start_index: 66
end_index: 67
30Literal
31Literal
32ExprTuple36, 37
33Literal
34ExprTuple38, 39
35Lambdaparameter: 68
body: 40
36Operationoperator: 41
operands: 42
37Operationoperator: 43
operands: 44
38Operationoperator: 46
operands: 45
39Operationoperator: 46
operands: 47
40Operationoperator: 58
operand: 53
41Literal
42ExprTuple49, 50, 64, 51
43Literal
44ExprTuple72, 73
45ExprTuple72, 52
46Literal
47ExprTuple73, 52
48ExprTuple53
49Operationoperator: 54
operand: 63
50Operationoperator: 56
operand: 64
51Operationoperator: 58
operand: 65
52Operationoperator: 60
operands: 61
53IndexedVarvariable: 70
index: 68
54Literal
55ExprTuple63
56Literal
57ExprTuple64
58Literal
59ExprTuple65
60Literal
61ExprTuple66, 67
62ExprTuple68
63IndexedVarvariable: 70
index: 72
64Variable
65IndexedVarvariable: 70
index: 73
66Literal
67Variable
68Variable
69ExprTuple72
70Variable
71ExprTuple73
72Variable
73Variable