logo

Expression of type Lambda

from the theory of proveit.linear_algebra.inner_products

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 Conditional, Lambda, P, X
from proveit.linear_algebra import Adj, HilbertSpaces, Hspace, OrthoProj
from proveit.logic import Equals, Forall, InClass, SubsetEq
In [2]:
# build up the expression from sub-expressions
expr = Lambda(Hspace, Conditional(Forall(instance_param_or_params = [X], instance_expr = Forall(instance_param_or_params = [P], instance_expr = Equals(Adj(P), P), condition = Equals(P, OrthoProj(Hspace, X))), condition = SubsetEq(X, Hspace)), InClass(Hspace, 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())
\mathcal{H} \mapsto \left\{\forall_{X~|~X \subseteq \mathcal{H}}~\left[\forall_{P~|~P = \textrm{OrthoProj}\left(\mathcal{H}, X\right)}~\left(P^{\dagger} = P\right)\right] \textrm{ if } \mathcal{H} \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 32
body: 2
1ExprTuple32
2Conditionalvalue: 3
condition: 4
3Operationoperator: 14
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple32, 9
8Lambdaparameter: 33
body: 11
9Literal
10ExprTuple33
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operand: 18
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18
16Literal
17ExprTuple33, 32
18Lambdaparameter: 31
body: 19
19Conditionalvalue: 20
condition: 21
20Operationoperator: 23
operands: 22
21Operationoperator: 23
operands: 24
22ExprTuple25, 31
23Literal
24ExprTuple31, 26
25Operationoperator: 27
operand: 31
26Operationoperator: 29
operands: 30
27Literal
28ExprTuple31
29Literal
30ExprTuple32, 33
31Variable
32Variable
33Variable