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, b, l, n
from proveit.core_expr_types import A_1_to_l, C_1_to_n
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([l, n], Conditional(Forall(instance_param_or_params = [b], instance_expr = Forall(instance_param_or_params = [A_1_to_l, C_1_to_n], instance_expr = Equals(Qmult(A_1_to_l, b, C_1_to_n), Qmult(b, 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(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(l, n\right) \mapsto \left\{\forall_{b \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\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) =  \\ \left(b\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 } 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
2ExprTuple44, 47
3Conditionalvalue: 4
condition: 5
4Operationoperator: 19
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple10, 11
9Lambdaparameter: 40
body: 13
10Operationoperator: 21
operands: 14
11Operationoperator: 21
operands: 15
12ExprTuple40
13Conditionalvalue: 16
condition: 17
14ExprTuple44, 18
15ExprTuple47, 18
16Operationoperator: 19
operand: 23
17Operationoperator: 21
operands: 22
18Literal
19Literal
20ExprTuple23
21Literal
22ExprTuple40, 24
23Lambdaparameters: 39
body: 25
24Literal
25Conditionalvalue: 26
condition: 27
26Operationoperator: 28
operands: 29
27Operationoperator: 30
operands: 31
28Literal
29ExprTuple32, 33
30Literal
31ExprTuple34, 35
32Operationoperator: 38
operands: 36
33Operationoperator: 38
operands: 37
34Operationoperator: 38
operands: 39
35Literal
36ExprTuple41, 40, 42
37ExprTuple40, 41, 42
38Literal
39ExprTuple41, 42
40Variable
41ExprRangelambda_map: 43
start_index: 46
end_index: 44
42ExprRangelambda_map: 45
start_index: 46
end_index: 47
43Lambdaparameter: 53
body: 48
44Variable
45Lambdaparameter: 53
body: 49
46Literal
47Variable
48IndexedVarvariable: 50
index: 53
49IndexedVarvariable: 51
index: 53
50Variable
51Variable
52ExprTuple53
53Variable