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, K, Lambda, n, v, w
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import Bases, InnerProd, InnerProdSpaces, OrthoNormBases
from proveit.logic import And, Equals, Forall, InClass, InSet, Set
from proveit.numbers import KroneckerDelta, NaturalPos
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Set(x_1_to_n)
expr = Lambda(H, Conditional(Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(InSet(sub_expr1, OrthoNormBases(H)), And(InSet(sub_expr1, Bases(H)), Forall(instance_param_or_params = [v, w], instance_expr = Equals(InnerProd(v, w), KroneckerDelta(v, w)), domain = sub_expr1))).with_wrapping_at(2), domain = H), domain = NaturalPos), InClass(H, InnerProdSpaces(K))))
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())
H \mapsto \left\{\forall_{n \in \mathbb{N}^+}~\left[\forall_{x_{1}, x_{2}, \ldots, x_{n} \in H}~\left(\begin{array}{c} \begin{array}{l} \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{O.N.Bases}\left(H\right)\right) =  \\ \left(\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{Bases}\left(H\right)\right) \land \left[\forall_{v, w \in \left\{x_{1}, x_{2}, \ldots, x_{n}\right\}}~\left(\left \langle v, w\right \rangle = \delta_{v, w}\right)\right]\right) \end{array} \end{array}\right)\right] \textrm{ if } H \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(K\right)\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 45
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 37
operand: 7
3Operationoperator: 5
operands: 6
4ExprTuple7
5Literal
6ExprTuple45, 8
7Lambdaparameter: 70
body: 10
8Operationoperator: 11
operand: 15
9ExprTuple70
10Conditionalvalue: 13
condition: 14
11Literal
12ExprTuple15
13Operationoperator: 37
operand: 18
14Operationoperator: 60
operands: 17
15Variable
16ExprTuple18
17ExprTuple70, 19
18Lambdaparameters: 66
body: 20
19Literal
20Conditionalvalue: 21
condition: 22
21Operationoperator: 48
operands: 23
22Operationoperator: 50
operands: 24
23ExprTuple25, 26
24ExprTuple27
25Operationoperator: 60
operands: 28
26Operationoperator: 50
operands: 29
27ExprRangelambda_map: 30
start_index: 69
end_index: 70
28ExprTuple64, 31
29ExprTuple32, 33
30Lambdaparameter: 74
body: 34
31Operationoperator: 35
operand: 45
32Operationoperator: 60
operands: 36
33Operationoperator: 37
operand: 41
34Operationoperator: 60
operands: 39
35Literal
36ExprTuple64, 40
37Literal
38ExprTuple41
39ExprTuple71, 45
40Operationoperator: 42
operand: 45
41Lambdaparameters: 58
body: 44
42Literal
43ExprTuple45
44Conditionalvalue: 46
condition: 47
45Variable
46Operationoperator: 48
operands: 49
47Operationoperator: 50
operands: 51
48Literal
49ExprTuple52, 53
50Literal
51ExprTuple54, 55
52Operationoperator: 56
operands: 58
53Operationoperator: 57
operands: 58
54Operationoperator: 60
operands: 59
55Operationoperator: 60
operands: 61
56Literal
57Literal
58ExprTuple62, 63
59ExprTuple62, 64
60Literal
61ExprTuple63, 64
62Variable
63Variable
64Operationoperator: 65
operands: 66
65Literal
66ExprTuple67
67ExprRangelambda_map: 68
start_index: 69
end_index: 70
68Lambdaparameter: 74
body: 71
69Literal
70Variable
71IndexedVarvariable: 72
index: 74
72Variable
73ExprTuple74
74Variable