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 A, Conditional, 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 = Lambda(c, Conditional(Forall(instance_param_or_params = [Hspace, X], instance_expr = Forall(instance_param_or_params = [A], instance_expr = InSet(Qmult(c, A), 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())
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(c \thinspace A\right) \in \mathcal{L}\left(\mathcal{H}, X\right)\right)\right] \textrm{ if } c \in \mathbb{C}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 37
body: 2
1ExprTuple37
2Conditionalvalue: 3
condition: 4
3Operationoperator: 12
operand: 7
4Operationoperator: 27
operands: 6
5ExprTuple7
6ExprTuple37, 8
7Lambdaparameters: 36
body: 9
8Literal
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operand: 16
11Operationoperator: 14
operands: 15
12Literal
13ExprTuple16
14Literal
15ExprTuple17, 18
16Lambdaparameter: 38
body: 19
17Operationoperator: 21
operands: 20
18Operationoperator: 21
operands: 22
19Conditionalvalue: 23
condition: 24
20ExprTuple39, 25
21Literal
22ExprTuple40, 25
23Operationoperator: 27
operands: 26
24Operationoperator: 27
operands: 28
25Literal
26ExprTuple29, 31
27Literal
28ExprTuple30, 31
29Operationoperator: 33
operands: 32
30Operationoperator: 33
operand: 38
31Operationoperator: 35
operands: 36
32ExprTuple37, 38
33Literal
34ExprTuple38
35Literal
36ExprTuple39, 40
37Variable
38Variable
39Variable
40Variable