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, n, v, w
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import Bases, InnerProd, 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(n, Conditional(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), InSet(n, NaturalPos)))
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())
n \mapsto \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) \textrm{ if } n \in \mathbb{N}^+\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 59
body: 2
1ExprTuple59
2Conditionalvalue: 3
condition: 4
3Operationoperator: 26
operand: 7
4Operationoperator: 49
operands: 6
5ExprTuple7
6ExprTuple59, 8
7Lambdaparameters: 55
body: 9
8Literal
9Conditionalvalue: 10
condition: 11
10Operationoperator: 37
operands: 12
11Operationoperator: 39
operands: 13
12ExprTuple14, 15
13ExprTuple16
14Operationoperator: 49
operands: 17
15Operationoperator: 39
operands: 18
16ExprRangelambda_map: 19
start_index: 58
end_index: 59
17ExprTuple53, 20
18ExprTuple21, 22
19Lambdaparameter: 63
body: 23
20Operationoperator: 24
operand: 34
21Operationoperator: 49
operands: 25
22Operationoperator: 26
operand: 30
23Operationoperator: 49
operands: 28
24Literal
25ExprTuple53, 29
26Literal
27ExprTuple30
28ExprTuple60, 34
29Operationoperator: 31
operand: 34
30Lambdaparameters: 47
body: 33
31Literal
32ExprTuple34
33Conditionalvalue: 35
condition: 36
34Variable
35Operationoperator: 37
operands: 38
36Operationoperator: 39
operands: 40
37Literal
38ExprTuple41, 42
39Literal
40ExprTuple43, 44
41Operationoperator: 45
operands: 47
42Operationoperator: 46
operands: 47
43Operationoperator: 49
operands: 48
44Operationoperator: 49
operands: 50
45Literal
46Literal
47ExprTuple51, 52
48ExprTuple51, 53
49Literal
50ExprTuple52, 53
51Variable
52Variable
53Operationoperator: 54
operands: 55
54Literal
55ExprTuple56
56ExprRangelambda_map: 57
start_index: 58
end_index: 59
57Lambdaparameter: 63
body: 60
58Literal
59Variable
60IndexedVarvariable: 61
index: 63
61Variable
62ExprTuple63
63Variable