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, j, l, n
from proveit.core_expr_types import A_1_to_l, C_1_to_n, b_1_to_j
from proveit.logic import And, Equals, Forall, InClass, InSet
from proveit.numbers import Complex, Natural
from proveit.physics.quantum import Qmult, QmultCodomain
In [2]:
# build up the expression from sub-expressions
expr = Lambda([j, l, n], Conditional(Forall(instance_param_or_params = [b_1_to_j], instance_expr = Forall(instance_param_or_params = [A_1_to_l, C_1_to_n], instance_expr = Equals(Qmult(A_1_to_l, b_1_to_j, C_1_to_n), Qmult(b_1_to_j, A_1_to_l, C_1_to_n)).with_wrapping_at(2), condition = InClass(Qmult(A_1_to_l, C_1_to_n), QmultCodomain)), domain = Complex), And(InSet(j, Natural), InSet(l, Natural), InSet(n, Natural))))
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(j, l, n\right) \mapsto \left\{\forall_{b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{C}}~\left[\forall_{A_{1}, A_{2}, \ldots, A_{l}, C_{1}, C_{2}, \ldots, C_{n}~|~\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \underset{{\scriptscriptstyle c}}{\in} \mathcal{Q^*}}~\left(\begin{array}{c} \begin{array}{l} \left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\thinspace b_{1} \thinspace  b_{2} \thinspace  \ldots \thinspace  b_{j}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) =  \\ \left(b_{1} \thinspace  b_{2} \thinspace  \ldots \thinspace  b_{j}\thinspace A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \end{array} \end{array}\right)\right] \textrm{ if } j \in \mathbb{N} ,  l \in \mathbb{N} ,  n \in \mathbb{N}\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
1ExprTuple49, 51, 54
2Conditionalvalue: 3
condition: 4
3Operationoperator: 19
operand: 7
4Operationoperator: 21
operands: 6
5ExprTuple7
6ExprTuple8, 9, 10
7Lambdaparameters: 11
body: 12
8Operationoperator: 34
operands: 13
9Operationoperator: 34
operands: 14
10Operationoperator: 34
operands: 15
11ExprTuple45
12Conditionalvalue: 16
condition: 17
13ExprTuple49, 18
14ExprTuple51, 18
15ExprTuple54, 18
16Operationoperator: 19
operand: 23
17Operationoperator: 21
operands: 22
18Literal
19Literal
20ExprTuple23
21Literal
22ExprTuple24
23Lambdaparameters: 44
body: 25
24ExprRangelambda_map: 26
start_index: 53
end_index: 49
25Conditionalvalue: 27
condition: 28
26Lambdaparameter: 62
body: 29
27Operationoperator: 30
operands: 31
28Operationoperator: 32
operands: 33
29Operationoperator: 34
operands: 35
30Literal
31ExprTuple36, 37
32Literal
33ExprTuple38, 39
34Literal
35ExprTuple55, 40
36Operationoperator: 43
operands: 41
37Operationoperator: 43
operands: 42
38Operationoperator: 43
operands: 44
39Literal
40Literal
41ExprTuple46, 45, 47
42ExprTuple45, 46, 47
43Literal
44ExprTuple46, 47
45ExprRangelambda_map: 48
start_index: 53
end_index: 49
46ExprRangelambda_map: 50
start_index: 53
end_index: 51
47ExprRangelambda_map: 52
start_index: 53
end_index: 54
48Lambdaparameter: 62
body: 55
49Variable
50Lambdaparameter: 62
body: 56
51Variable
52Lambdaparameter: 62
body: 57
53Literal
54Variable
55IndexedVarvariable: 58
index: 62
56IndexedVarvariable: 59
index: 62
57IndexedVarvariable: 60
index: 62
58Variable
59Variable
60Variable
61ExprTuple62
62Variable