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 Conditional, ExprTuple, 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 = ExprTuple(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(\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..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 2
body: 3
2ExprTuple50, 52, 55
3Conditionalvalue: 4
condition: 5
4Operationoperator: 20
operand: 8
5Operationoperator: 22
operands: 7
6ExprTuple8
7ExprTuple9, 10, 11
8Lambdaparameters: 12
body: 13
9Operationoperator: 35
operands: 14
10Operationoperator: 35
operands: 15
11Operationoperator: 35
operands: 16
12ExprTuple46
13Conditionalvalue: 17
condition: 18
14ExprTuple50, 19
15ExprTuple52, 19
16ExprTuple55, 19
17Operationoperator: 20
operand: 24
18Operationoperator: 22
operands: 23
19Literal
20Literal
21ExprTuple24
22Literal
23ExprTuple25
24Lambdaparameters: 45
body: 26
25ExprRangelambda_map: 27
start_index: 54
end_index: 50
26Conditionalvalue: 28
condition: 29
27Lambdaparameter: 63
body: 30
28Operationoperator: 31
operands: 32
29Operationoperator: 33
operands: 34
30Operationoperator: 35
operands: 36
31Literal
32ExprTuple37, 38
33Literal
34ExprTuple39, 40
35Literal
36ExprTuple56, 41
37Operationoperator: 44
operands: 42
38Operationoperator: 44
operands: 43
39Operationoperator: 44
operands: 45
40Literal
41Literal
42ExprTuple47, 46, 48
43ExprTuple46, 47, 48
44Literal
45ExprTuple47, 48
46ExprRangelambda_map: 49
start_index: 54
end_index: 50
47ExprRangelambda_map: 51
start_index: 54
end_index: 52
48ExprRangelambda_map: 53
start_index: 54
end_index: 55
49Lambdaparameter: 63
body: 56
50Variable
51Lambdaparameter: 63
body: 57
52Variable
53Lambdaparameter: 63
body: 58
54Literal
55Variable
56IndexedVarvariable: 59
index: 63
57IndexedVarvariable: 60
index: 63
58IndexedVarvariable: 61
index: 63
59Variable
60Variable
61Variable
62ExprTuple63
63Variable