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, Py, X, x, y
from proveit.linear_algebra import Hspace, InnerProd, VecZero
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import zero
In [2]:
# build up the expression from sub-expressions
expr = Lambda(y, Conditional(Implies(Forall(instance_param_or_params = [x], instance_expr = Equals(InnerProd(x, y), zero), domain = X), Equals(Py, VecZero(Hspace))), InSet(y, Hspace)))
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())
y \mapsto \left\{\left[\forall_{x \in X}~\left(\left \langle x, y\right \rangle = 0\right)\right] \Rightarrow \left(P\left(y\right) = \vec{0}\left(\mathcal{H}\right)\right) \textrm{ if } y \in \mathcal{H}\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: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 4
operands: 5
3Operationoperator: 26
operands: 6
4Literal
5ExprTuple7, 8
6ExprTuple34, 23
7Operationoperator: 9
operand: 12
8Operationoperator: 24
operands: 11
9Literal
10ExprTuple12
11ExprTuple13, 14
12Lambdaparameter: 33
body: 16
13Operationoperator: 17
operand: 34
14Operationoperator: 19
operand: 23
15ExprTuple33
16Conditionalvalue: 21
condition: 22
17Variable
18ExprTuple34
19Literal
20ExprTuple23
21Operationoperator: 24
operands: 25
22Operationoperator: 26
operands: 27
23Variable
24Literal
25ExprTuple28, 29
26Literal
27ExprTuple33, 30
28Operationoperator: 31
operands: 32
29Literal
30Variable
31Literal
32ExprTuple33, 34
33Variable
34Variable