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, Conditional, ExprTuple, Lambda, X, Y
from proveit.linear_algebra import HilbertSpaces, Hspace, LinMap
from proveit.logic import Exists, InClass, InSet, Set
from proveit.numbers import Complex
from proveit.physics.quantum import Qmult, QmultCodomain
In [2]:
# build up the expression from sub-expressions
sub_expr1 = LinMap(Hspace, X)
expr = ExprTuple(Lambda([A, B], Conditional(Exists(instance_param_or_params = [Hspace, X, Y], instance_expr = InSet([Qmult(A), Qmult(B)], Set([sub_expr1, Hspace], [X, LinMap(Hspace, Complex)], [LinMap(X, Y), sub_expr1], [Complex, QmultCodomain], [QmultCodomain, Complex])), domain = HilbertSpaces), InClass(Qmult(A, B), QmultCodomain))))
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(A, B\right) \mapsto \left\{\exists_{\mathcal{H}, X, Y \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}}~\left(\left(\left[A\right], \left[B\right]\right) \in \left\{\left(\mathcal{L}\left(\mathcal{H}, X\right), \mathcal{H}\right), \left(X, \mathcal{L}\left(\mathcal{H}, \mathbb{C}\right)\right), \left(\mathcal{L}\left(X, Y\right), \mathcal{L}\left(\mathcal{H}, X\right)\right), \left(\mathbb{C}, \mathcal{Q^*}\right), \left(\mathcal{Q^*}, \mathbb{C}\right)\right\}\right) \textrm{ if } \left(A \thinspace B\right) \underset{{\scriptscriptstyle c}}{\in} \mathcal{Q^*}\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: 12
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 30
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 46
8Lambdaparameters: 10
body: 11
9Operationoperator: 33
operands: 12
10ExprTuple53, 54, 52
11Conditionalvalue: 13
condition: 14
12ExprTuple41, 42
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22, 23
19ExprTuple24, 25
20Operationoperator: 26
operands: 27
21Operationoperator: 30
operands: 28
22Operationoperator: 30
operands: 29
23Operationoperator: 30
operands: 31
24Operationoperator: 33
operand: 41
25Operationoperator: 33
operand: 42
26Literal
27ExprTuple35, 36, 37, 38, 39
28ExprTuple53, 40
29ExprTuple54, 40
30Literal
31ExprTuple52, 40
32ExprTuple41
33Literal
34ExprTuple42
35ExprTuple45, 53
36ExprTuple54, 43
37ExprTuple44, 45
38ExprTuple51, 46
39ExprTuple46, 51
40Literal
41Variable
42Variable
43Operationoperator: 49
operands: 47
44Operationoperator: 49
operands: 48
45Operationoperator: 49
operands: 50
46Literal
47ExprTuple53, 51
48ExprTuple54, 52
49Literal
50ExprTuple53, 54
51Literal
52Variable
53Variable
54Variable