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 And, Forall, InClass, InSet
from proveit.physics.quantum import Qmult
In [2]:
# build up the expression from sub-expressions
sub_expr1 = LinMap(Hspace, X)
expr = ExprTuple(Lambda([Hspace, X], Conditional(Forall(instance_param_or_params = [A], instance_expr = InSet(Qmult(A, c), sub_expr1), condition = InSet(Qmult(A), sub_expr1)), 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(\left(A \thinspace c\right) \in \mathcal{L}\left(\mathcal{H}, 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: 29
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 9
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9
7Literal
8ExprTuple10, 11
9Lambdaparameter: 31
body: 12
10Operationoperator: 14
operands: 13
11Operationoperator: 14
operands: 15
12Conditionalvalue: 16
condition: 17
13ExprTuple32, 18
14Literal
15ExprTuple33, 18
16Operationoperator: 20
operands: 19
17Operationoperator: 20
operands: 21
18Literal
19ExprTuple22, 24
20Literal
21ExprTuple23, 24
22Operationoperator: 26
operands: 25
23Operationoperator: 26
operand: 31
24Operationoperator: 28
operands: 29
25ExprTuple31, 30
26Literal
27ExprTuple31
28Literal
29ExprTuple32, 33
30Variable
31Variable
32Variable
33Variable