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 A, B, C, D, ExprRange, ExprTuple, Function, IndexedVar, Q, Variable, alpha, beta, c, delta, gamma, j, m, n
from proveit.core_expr_types import Q__b_1_to_j, b_1_to_j, f__b_1_to_j
from proveit.linear_algebra import MatrixSpace
from proveit.logic import CartExp, Forall, InSet
from proveit.numbers import Complex, NaturalPos, one
from proveit.physics.quantum import ket_psi, ket_varphi
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = MatrixSpace(field = Complex, rows = n, columns = m)
expr = ExprTuple(InSet(alpha, Complex), InSet(beta, Complex), InSet(gamma, Complex), InSet(delta, Complex), InSet(j, NaturalPos), InSet(m, NaturalPos), InSet(n, NaturalPos), InSet(ket_psi, CartExp(Complex, m)), InSet(A, sub_expr2), InSet(B, sub_expr2), InSet(C, sub_expr2), InSet(D, MatrixSpace(field = Complex, rows = m, columns = n)), InSet(ket_varphi, CartExp(Complex, n)), Forall(instance_param_or_params = [b_1_to_j], instance_expr = InSet(f__b_1_to_j, sub_expr2), condition = Q__b_1_to_j), Function(Q, [ExprRange(sub_expr1, IndexedVar(c, sub_expr1), one, j)]))
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(\alpha \in \mathbb{C}, \beta \in \mathbb{C}, \gamma \in \mathbb{C}, \delta \in \mathbb{C}, j \in \mathbb{N}^+, m \in \mathbb{N}^+, n \in \mathbb{N}^+, \lvert \psi \rangle \in \mathbb{C}^{m}, A \in \mathbb{C}^{n \times m}, B \in \mathbb{C}^{n \times m}, C \in \mathbb{C}^{n \times m}, D \in \mathbb{C}^{m \times n}, \lvert \varphi \rangle \in \mathbb{C}^{n}, \forall_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(f\left(b_{1}, b_{2}, \ldots, b_{j}\right) \in \mathbb{C}^{n \times m}\right), Q\left(c_{1}, c_{2}, \ldots, c_{j}\right)\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
1Operationoperator: 62
operands: 16
2Operationoperator: 62
operands: 17
3Operationoperator: 62
operands: 18
4Operationoperator: 62
operands: 19
5Operationoperator: 62
operands: 20
6Operationoperator: 62
operands: 21
7Operationoperator: 62
operands: 22
8Operationoperator: 62
operands: 23
9Operationoperator: 62
operands: 24
10Operationoperator: 62
operands: 25
11Operationoperator: 62
operands: 26
12Operationoperator: 62
operands: 27
13Operationoperator: 62
operands: 28
14Operationoperator: 29
operand: 46
15Operationoperator: 64
operands: 31
16ExprTuple32, 73
17ExprTuple33, 73
18ExprTuple34, 73
19ExprTuple35, 73
20ExprTuple78, 36
21ExprTuple75, 36
22ExprTuple74, 36
23ExprTuple37, 38
24ExprTuple39, 67
25ExprTuple40, 67
26ExprTuple41, 67
27ExprTuple42, 43
28ExprTuple44, 45
29Literal
30ExprTuple46
31ExprTuple47
32Variable
33Variable
34Variable
35Variable
36Literal
37Operationoperator: 51
operand: 57
38Operationoperator: 53
operands: 49
39Variable
40Variable
41Variable
42Variable
43Operationoperator: 70
operands: 50
44Operationoperator: 51
operand: 58
45Operationoperator: 53
operands: 54
46Lambdaparameters: 69
body: 55
47ExprRangelambda_map: 56
start_index: 77
end_index: 78
48ExprTuple57
49ExprTuple73, 75
50NamedExprsfield: 73
rows: 75
columns: 74
51Literal
52ExprTuple58
53Literal
54ExprTuple73, 74
55Conditionalvalue: 59
condition: 60
56Lambdaparameter: 82
body: 61
57Variable
58Variable
59Operationoperator: 62
operands: 63
60Operationoperator: 64
operands: 69
61IndexedVarvariable: 65
index: 82
62Literal
63ExprTuple66, 67
64Variable
65Variable
66Operationoperator: 68
operands: 69
67Operationoperator: 70
operands: 71
68Variable
69ExprTuple72
70Literal
71NamedExprsfield: 73
rows: 74
columns: 75
72ExprRangelambda_map: 76
start_index: 77
end_index: 78
73Literal
74Variable
75Variable
76Lambdaparameter: 82
body: 79
77Literal
78Variable
79IndexedVarvariable: 80
index: 82
80Variable
81ExprTuple82
82Variable