logo

Expression of type Lambda

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, 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 = 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(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..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 1
body: 2
1ExprTuple3
2Conditionalvalue: 4
condition: 5
3ExprRangelambda_map: 6
start_index: 70
end_index: 71
4Operationoperator: 7
operands: 8
5Operationoperator: 50
operands: 9
6Lambdaparameter: 72
body: 57
7Literal
8ExprTuple10, 11
9ExprTuple12, 13
10Operationoperator: 14
operand: 20
11Operationoperator: 50
operands: 16
12Operationoperator: 27
operand: 22
13Operationoperator: 18
operand: 23
14Literal
15ExprTuple20
16ExprTuple68, 21
17ExprTuple22
18Literal
19ExprTuple23
20Lambdaparameters: 48
body: 24
21Operationoperator: 25
operand: 71
22Operationoperator: 27
operands: 28
23Operationoperator: 29
operands: 30
24Conditionalvalue: 31
condition: 32
25Literal
26ExprTuple71
27Literal
28ExprTuple33
29Literal
30ExprTuple34, 71
31Operationoperator: 35
operands: 36
32Operationoperator: 37
operands: 38
33ExprRangelambda_map: 39
start_index: 70
end_index: 71
34Literal
35Literal
36ExprTuple40, 41
37Literal
38ExprTuple42, 43
39Lambdaparameter: 72
body: 44
40Operationoperator: 45
operands: 46
41Operationoperator: 47
operands: 48
42Operationoperator: 50
operands: 49
43Operationoperator: 50
operands: 51
44Operationoperator: 62
operand: 57
45Literal
46ExprTuple53, 54, 68, 55
47Literal
48ExprTuple76, 77
49ExprTuple76, 56
50Literal
51ExprTuple77, 56
52ExprTuple57
53Operationoperator: 58
operand: 67
54Operationoperator: 60
operand: 68
55Operationoperator: 62
operand: 69
56Operationoperator: 64
operands: 65
57IndexedVarvariable: 74
index: 72
58Literal
59ExprTuple67
60Literal
61ExprTuple68
62Literal
63ExprTuple69
64Literal
65ExprTuple70, 71
66ExprTuple72
67IndexedVarvariable: 74
index: 76
68Variable
69IndexedVarvariable: 74
index: 77
70Literal
71Variable
72Variable
73ExprTuple76
74Variable
75ExprTuple77
76Variable
77Variable