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, Conditional, ExprTuple, Lambda, X, c
from proveit.linear_algebra import HilbertSpaces, Hspace, LinMap
from proveit.logic import Forall, InSet
from proveit.numbers import Complex
from proveit.physics.quantum import Qmult
In [2]:
# build up the expression from sub-expressions
sub_expr1 = LinMap(Hspace, X)
expr = ExprTuple(Lambda(c, Conditional(Forall(instance_param_or_params = [Hspace, X], instance_expr = Forall(instance_param_or_params = [A], instance_expr = InSet(Qmult(A, c), sub_expr1), condition = InSet(Qmult(A), sub_expr1)), domain = HilbertSpaces), InSet(c, Complex))))
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(c \mapsto \left\{\forall_{\mathcal{H}, X \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}}~\left[\forall_{A~|~\left[A\right] \in \mathcal{L}\left(\mathcal{H}, X\right)}~\left(\left(A \thinspace c\right) \in \mathcal{L}\left(\mathcal{H}, X\right)\right)\right] \textrm{ if } c \in \mathbb{C}\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: 38
body: 3
2ExprTuple38
3Conditionalvalue: 4
condition: 5
4Operationoperator: 13
operand: 8
5Operationoperator: 28
operands: 7
6ExprTuple8
7ExprTuple38, 9
8Lambdaparameters: 37
body: 10
9Literal
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operand: 17
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17
15Literal
16ExprTuple18, 19
17Lambdaparameter: 39
body: 20
18Operationoperator: 22
operands: 21
19Operationoperator: 22
operands: 23
20Conditionalvalue: 24
condition: 25
21ExprTuple40, 26
22Literal
23ExprTuple41, 26
24Operationoperator: 28
operands: 27
25Operationoperator: 28
operands: 29
26Literal
27ExprTuple30, 32
28Literal
29ExprTuple31, 32
30Operationoperator: 34
operands: 33
31Operationoperator: 34
operand: 39
32Operationoperator: 36
operands: 37
33ExprTuple39, 38
34Literal
35ExprTuple39
36Literal
37ExprTuple40, 41
38Variable
39Variable
40Variable
41Variable