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 LinDepSets, VecSpaces, VecZero, lin_comb_axn, some_nonzero_a
from proveit.logic import Equals, Exists, Forall, InSet, Set
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(InSet(Set(x_1_to_n), LinDepSets(V)), Exists(instance_param_or_params = [a_1_to_n], instance_expr = Equals(lin_comb_axn, VecZero(V)), domain = K, condition = some_nonzero_a).with_wrapping()).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} \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{LinDepSets}\left(V\right)\right) =  \\ \left[\begin{array}{l}\exists_{a_{1}, a_{2}, \ldots, a_{n} \in K~|~\left(a_{1} \neq 0\right) \lor  \left(a_{2} \neq 0\right) \lor  \ldots \lor  \left(a_{n} \neq 0\right)}~\\
\left(\left(\left(a_{1} \cdot x_{1}\right) +  \left(a_{2} \cdot x_{2}\right) +  \ldots +  \left(a_{n} \cdot x_{n}\right)\right) = \vec{0}\left(V\right)\right)\end{array}\right] \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: 77
body: 1
1Operationoperator: 18
operand: 3
2ExprTuple3
3Lambdaparameter: 67
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 18
operand: 10
6Operationoperator: 8
operands: 9
7ExprTuple10
8Literal
9ExprTuple67, 11
10Lambdaparameter: 75
body: 13
11Operationoperator: 14
operand: 77
12ExprTuple75
13Conditionalvalue: 16
condition: 17
14Literal
15ExprTuple77
16Operationoperator: 18
operand: 21
17Operationoperator: 71
operands: 20
18Literal
19ExprTuple21
20ExprTuple75, 22
21Lambdaparameters: 40
body: 23
22Literal
23Conditionalvalue: 24
condition: 25
24Operationoperator: 51
operands: 26
25Operationoperator: 53
operands: 27
26ExprTuple28, 29
27ExprTuple30
28Operationoperator: 71
operands: 31
29Operationoperator: 32
operand: 37
30ExprRangelambda_map: 34
start_index: 74
end_index: 75
31ExprTuple35, 36
32Literal
33ExprTuple37
34Lambdaparameter: 89
body: 38
35Operationoperator: 39
operands: 40
36Operationoperator: 41
operand: 67
37Lambdaparameters: 42
body: 43
38Operationoperator: 71
operands: 44
39Literal
40ExprTuple45
41Literal
42ExprTuple46
43Conditionalvalue: 47
condition: 48
44ExprTuple83, 67
45ExprRangelambda_map: 49
start_index: 74
end_index: 75
46ExprRangelambda_map: 50
start_index: 74
end_index: 75
47Operationoperator: 51
operands: 52
48Operationoperator: 53
operands: 54
49Lambdaparameter: 89
body: 83
50Lambdaparameter: 89
body: 84
51Literal
52ExprTuple55, 56
53Literal
54ExprTuple57, 58
55Operationoperator: 59
operands: 60
56Operationoperator: 61
operand: 67
57ExprRangelambda_map: 63
start_index: 74
end_index: 75
58Operationoperator: 64
operands: 65
59Literal
60ExprTuple66
61Literal
62ExprTuple67
63Lambdaparameter: 89
body: 68
64Literal
65ExprTuple69
66ExprRangelambda_map: 70
start_index: 74
end_index: 75
67Variable
68Operationoperator: 71
operands: 72
69ExprRangelambda_map: 73
start_index: 74
end_index: 75
70Lambdaparameter: 89
body: 76
71Literal
72ExprTuple84, 77
73Lambdaparameter: 89
body: 78
74Literal
75Variable
76Operationoperator: 79
operands: 80
77Variable
78Operationoperator: 81
operands: 82
79Literal
80ExprTuple84, 83
81Literal
82ExprTuple84, 85
83IndexedVarvariable: 86
index: 89
84IndexedVarvariable: 87
index: 89
85Literal
86Variable
87Variable
88ExprTuple89
89Variable