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 ExprTuple, Lambda, X, x
from proveit.linear_algebra import HilbertSpaces, Hspace, LinMap
from proveit.logic import Equals, Exists, InClass, InSet, Or
from proveit.physics.quantum import QmultCodomain
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(x, Equals(InClass(x, QmultCodomain), Or(Exists(instance_param_or_params = [Hspace], instance_expr = InSet(x, Hspace), domain = HilbertSpaces), Exists(instance_param_or_params = [Hspace, X], instance_expr = InSet(x, LinMap(Hspace, X)), domain = HilbertSpaces)).with_wrapping_at(2))))
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(x \mapsto \left(\left(x \underset{{\scriptscriptstyle c}}{\in} \mathcal{Q^*}\right) = \left(\begin{array}{c} \left[\exists_{\mathcal{H} \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}}~\left(x \in \mathcal{H}\right)\right] \lor  \\ \left[\exists_{\mathcal{H}, X \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}}~\left(x \in \mathcal{L}\left(\mathcal{H}, X\right)\right)\right] \end{array}\right)\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
1Lambdaparameter: 30
body: 3
2ExprTuple30
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 37
operands: 8
7Operationoperator: 9
operands: 10
8ExprTuple30, 11
9Literal
10ExprTuple12, 13
11Literal
12Operationoperator: 15
operand: 17
13Operationoperator: 15
operand: 18
14ExprTuple17
15Literal
16ExprTuple18
17Lambdaparameter: 39
body: 20
18Lambdaparameters: 35
body: 21
19ExprTuple39
20Conditionalvalue: 22
condition: 32
21Conditionalvalue: 23
condition: 24
22Operationoperator: 26
operands: 25
23Operationoperator: 26
operands: 27
24Operationoperator: 28
operands: 29
25ExprTuple30, 39
26Literal
27ExprTuple30, 31
28Literal
29ExprTuple32, 33
30Variable
31Operationoperator: 34
operands: 35
32Operationoperator: 37
operands: 36
33Operationoperator: 37
operands: 38
34Literal
35ExprTuple39, 40
36ExprTuple39, 41
37Literal
38ExprTuple40, 41
39Variable
40Variable
41Literal