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 Conditional, 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, InClass, Set, SetOfAll
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Lambda(V, Conditional(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), InClass(V, 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())
V \mapsto \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] \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\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: 47
body: 2
1ExprTuple47
2Conditionalvalue: 3
condition: 4
3Operationoperator: 16
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple47, 9
8Lambdaparameter: 59
body: 11
9Operationoperator: 12
operand: 68
10ExprTuple59
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple68
14Operationoperator: 16
operand: 19
15Operationoperator: 64
operands: 18
16Literal
17ExprTuple19
18ExprTuple59, 20
19Lambdaparameters: 39
body: 21
20Literal
21Conditionalvalue: 22
condition: 23
22Operationoperator: 24
operands: 25
23Operationoperator: 52
operands: 26
24Literal
25ExprTuple27, 28
26ExprTuple29
27Operationoperator: 30
operand: 35
28Operationoperator: 32
operand: 36
29ExprRangelambda_map: 34
start_index: 58
end_index: 59
30Literal
31ExprTuple35
32Literal
33ExprTuple36
34Lambdaparameter: 72
body: 37
35Operationoperator: 38
operands: 39
36Lambdaparameters: 40
body: 41
37Operationoperator: 64
operands: 42
38Literal
39ExprTuple43
40ExprTuple44
41Conditionalvalue: 45
condition: 46
42ExprTuple66, 47
43ExprRangelambda_map: 48
start_index: 58
end_index: 59
44ExprRangelambda_map: 49
start_index: 58
end_index: 59
45Operationoperator: 50
operands: 51
46Operationoperator: 52
operands: 53
47Variable
48Lambdaparameter: 72
body: 66
49Lambdaparameter: 72
body: 67
50Literal
51ExprTuple54
52Literal
53ExprTuple55
54ExprRangelambda_map: 56
start_index: 58
end_index: 59
55ExprRangelambda_map: 57
start_index: 58
end_index: 59
56Lambdaparameter: 72
body: 60
57Lambdaparameter: 72
body: 61
58Literal
59Variable
60Operationoperator: 62
operands: 63
61Operationoperator: 64
operands: 65
62Literal
63ExprTuple67, 66
64Literal
65ExprTuple67, 68
66IndexedVarvariable: 69
index: 72
67IndexedVarvariable: 70
index: 72
68Variable
69Variable
70Variable
71ExprTuple72
72Variable