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 HilbertSpaces, Hspace, OrthoProj
from proveit.logic import Equals, Forall, InClass, SubsetEq
from proveit.numbers import Exp, two
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(Exp(P, two), 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^{2} = 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: 34
body: 2
1ExprTuple34
2Conditionalvalue: 3
condition: 4
3Operationoperator: 14
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple34, 9
8Lambdaparameter: 35
body: 11
9Literal
10ExprTuple35
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operand: 18
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18
16Literal
17ExprTuple35, 34
18Lambdaparameter: 32
body: 20
19ExprTuple32
20Conditionalvalue: 21
condition: 22
21Operationoperator: 24
operands: 23
22Operationoperator: 24
operands: 25
23ExprTuple26, 32
24Literal
25ExprTuple32, 27
26Operationoperator: 28
operands: 29
27Operationoperator: 30
operands: 31
28Literal
29ExprTuple32, 33
30Literal
31ExprTuple34, 35
32Variable
33Literal
34Variable
35Variable