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 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, 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(K, Forall(instance_param_or_params = [H], instance_expr = 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), domain = 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())
K \mapsto \left[\forall_{H \underset{{\scriptscriptstyle c}}{\in} \textrm{InnerProdSpaces}\left(K\right)}~\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]\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: 18
body: 1
1Operationoperator: 40
operand: 3
2ExprTuple3
3Lambdaparameter: 48
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 40
operand: 10
6Operationoperator: 8
operands: 9
7ExprTuple10
8Literal
9ExprTuple48, 11
10Lambdaparameter: 73
body: 13
11Operationoperator: 14
operand: 18
12ExprTuple73
13Conditionalvalue: 16
condition: 17
14Literal
15ExprTuple18
16Operationoperator: 40
operand: 21
17Operationoperator: 63
operands: 20
18Variable
19ExprTuple21
20ExprTuple73, 22
21Lambdaparameters: 69
body: 23
22Literal
23Conditionalvalue: 24
condition: 25
24Operationoperator: 51
operands: 26
25Operationoperator: 53
operands: 27
26ExprTuple28, 29
27ExprTuple30
28Operationoperator: 63
operands: 31
29Operationoperator: 53
operands: 32
30ExprRangelambda_map: 33
start_index: 72
end_index: 73
31ExprTuple67, 34
32ExprTuple35, 36
33Lambdaparameter: 77
body: 37
34Operationoperator: 38
operand: 48
35Operationoperator: 63
operands: 39
36Operationoperator: 40
operand: 44
37Operationoperator: 63
operands: 42
38Literal
39ExprTuple67, 43
40Literal
41ExprTuple44
42ExprTuple74, 48
43Operationoperator: 45
operand: 48
44Lambdaparameters: 61
body: 47
45Literal
46ExprTuple48
47Conditionalvalue: 49
condition: 50
48Variable
49Operationoperator: 51
operands: 52
50Operationoperator: 53
operands: 54
51Literal
52ExprTuple55, 56
53Literal
54ExprTuple57, 58
55Operationoperator: 59
operands: 61
56Operationoperator: 60
operands: 61
57Operationoperator: 63
operands: 62
58Operationoperator: 63
operands: 64
59Literal
60Literal
61ExprTuple65, 66
62ExprTuple65, 67
63Literal
64ExprTuple66, 67
65Variable
66Variable
67Operationoperator: 68
operands: 69
68Literal
69ExprTuple70
70ExprRangelambda_map: 71
start_index: 72
end_index: 73
71Lambdaparameter: 77
body: 74
72Literal
73Variable
74IndexedVarvariable: 75
index: 77
75Variable
76ExprTuple77
77Variable