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