logo

Expression of type Lambda

from the theory of proveit.linear_algebra.vector_sets

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 K, Lambda, V, n
from proveit.core_expr_types import a_1_to_n, x_1_to_n
from proveit.linear_algebra import Span, VecSpaces, lin_comb_axn
from proveit.logic import Equals, Forall, Set, SetOfAll
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Lambda(K, Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(Span(Set(x_1_to_n)), SetOfAll(instance_param_or_params = [a_1_to_n], instance_element = lin_comb_axn, domain = K)).with_wrapping_at(2), domain = V).with_wrapping(), domain = NaturalPos), domain = VecSpaces(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_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{n \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{x_{1}, x_{2}, \ldots, x_{n} \in V}~\\
\left(\begin{array}{c} \begin{array}{l} \textrm{Span}\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\}\right) =  \\ \left\{\left(a_{1} \cdot x_{1}\right) +  \left(a_{2} \cdot x_{2}\right) +  \ldots +  \left(a_{n} \cdot x_{n}\right)\right\}_{a_{1}, a_{2}, \ldots, a_{n} \in K} \end{array} \end{array}\right)\end{array}\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: 71
body: 1
1Operationoperator: 19
operand: 3
2ExprTuple3
3Lambdaparameter: 50
body: 5
4ExprTuple50
5Conditionalvalue: 6
condition: 7
6Operationoperator: 19
operand: 11
7Operationoperator: 9
operands: 10
8ExprTuple11
9Literal
10ExprTuple50, 12
11Lambdaparameter: 62
body: 14
12Operationoperator: 15
operand: 71
13ExprTuple62
14Conditionalvalue: 17
condition: 18
15Literal
16ExprTuple71
17Operationoperator: 19
operand: 22
18Operationoperator: 67
operands: 21
19Literal
20ExprTuple22
21ExprTuple62, 23
22Lambdaparameters: 42
body: 24
23Literal
24Conditionalvalue: 25
condition: 26
25Operationoperator: 27
operands: 28
26Operationoperator: 55
operands: 29
27Literal
28ExprTuple30, 31
29ExprTuple32
30Operationoperator: 33
operand: 38
31Operationoperator: 35
operand: 39
32ExprRangelambda_map: 37
start_index: 61
end_index: 62
33Literal
34ExprTuple38
35Literal
36ExprTuple39
37Lambdaparameter: 75
body: 40
38Operationoperator: 41
operands: 42
39Lambdaparameters: 43
body: 44
40Operationoperator: 67
operands: 45
41Literal
42ExprTuple46
43ExprTuple47
44Conditionalvalue: 48
condition: 49
45ExprTuple69, 50
46ExprRangelambda_map: 51
start_index: 61
end_index: 62
47ExprRangelambda_map: 52
start_index: 61
end_index: 62
48Operationoperator: 53
operands: 54
49Operationoperator: 55
operands: 56
50Variable
51Lambdaparameter: 75
body: 69
52Lambdaparameter: 75
body: 70
53Literal
54ExprTuple57
55Literal
56ExprTuple58
57ExprRangelambda_map: 59
start_index: 61
end_index: 62
58ExprRangelambda_map: 60
start_index: 61
end_index: 62
59Lambdaparameter: 75
body: 63
60Lambdaparameter: 75
body: 64
61Literal
62Variable
63Operationoperator: 65
operands: 66
64Operationoperator: 67
operands: 68
65Literal
66ExprTuple70, 69
67Literal
68ExprTuple70, 71
69IndexedVarvariable: 72
index: 75
70IndexedVarvariable: 73
index: 75
71Variable
72Variable
73Variable
74ExprTuple75
75Variable