logo

Expression of type Lambda

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 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 = 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())
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)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 29
body: 2
1ExprTuple29
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6
5Operationoperator: 36
operands: 7
6Operationoperator: 8
operands: 9
7ExprTuple29, 10
8Literal
9ExprTuple11, 12
10Literal
11Operationoperator: 14
operand: 16
12Operationoperator: 14
operand: 17
13ExprTuple16
14Literal
15ExprTuple17
16Lambdaparameter: 38
body: 19
17Lambdaparameters: 34
body: 20
18ExprTuple38
19Conditionalvalue: 21
condition: 31
20Conditionalvalue: 22
condition: 23
21Operationoperator: 25
operands: 24
22Operationoperator: 25
operands: 26
23Operationoperator: 27
operands: 28
24ExprTuple29, 38
25Literal
26ExprTuple29, 30
27Literal
28ExprTuple31, 32
29Variable
30Operationoperator: 33
operands: 34
31Operationoperator: 36
operands: 35
32Operationoperator: 36
operands: 37
33Literal
34ExprTuple38, 39
35ExprTuple38, 40
36Literal
37ExprTuple39, 40
38Variable
39Variable
40Literal