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