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, H, Lambda, v
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import OrthoNormBases
from proveit.logic import And, Exists, InSet, Set
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Set(x_1_to_n)
expr = Lambda(v, Conditional(Exists(instance_param_or_params = [x_1_to_n], instance_expr = And(InSet(v, sub_expr1), InSet(sub_expr1, OrthoNormBases(H))).with_wrapping_at(2)), InSet(v, H)))
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())
v \mapsto \left\{\exists_{x_{1}, x_{2}, \ldots, x_{n}}~\left(\begin{array}{c} \left(v \in \left\{x_{1}, x_{2}, \ldots, x_{n}\right\}\right) \land  \\ \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{O.N.Bases}\left(H\right)\right) \end{array}\right) \textrm{ if } v \in 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: 17
body: 2
1ExprTuple17
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 15
operands: 7
5Literal
6ExprTuple8
7ExprTuple17, 25
8Lambdaparameters: 21
body: 9
9Operationoperator: 10
operands: 11
10Literal
11ExprTuple12, 13
12Operationoperator: 15
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple17, 18
15Literal
16ExprTuple18, 19
17Variable
18Operationoperator: 20
operands: 21
19Operationoperator: 22
operand: 25
20Literal
21ExprTuple24
22Literal
23ExprTuple25
24ExprRangelambda_map: 26
start_index: 27
end_index: 28
25Variable
26Lambdaparameter: 32
body: 29
27Literal
28Variable
29IndexedVarvariable: 30
index: 32
30Variable
31ExprTuple32
32Variable