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 LinDepSets, 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(n, Conditional(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(), 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\{\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} \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: 62
body: 2
1ExprTuple62
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 58
operands: 7
5Literal
6ExprTuple8
7ExprTuple62, 9
8Lambdaparameters: 27
body: 10
9Literal
10Conditionalvalue: 11
condition: 12
11Operationoperator: 38
operands: 13
12Operationoperator: 40
operands: 14
13ExprTuple15, 16
14ExprTuple17
15Operationoperator: 58
operands: 18
16Operationoperator: 19
operand: 24
17ExprRangelambda_map: 21
start_index: 61
end_index: 62
18ExprTuple22, 23
19Literal
20ExprTuple24
21Lambdaparameter: 76
body: 25
22Operationoperator: 26
operands: 27
23Operationoperator: 28
operand: 54
24Lambdaparameters: 29
body: 30
25Operationoperator: 58
operands: 31
26Literal
27ExprTuple32
28Literal
29ExprTuple33
30Conditionalvalue: 34
condition: 35
31ExprTuple70, 54
32ExprRangelambda_map: 36
start_index: 61
end_index: 62
33ExprRangelambda_map: 37
start_index: 61
end_index: 62
34Operationoperator: 38
operands: 39
35Operationoperator: 40
operands: 41
36Lambdaparameter: 76
body: 70
37Lambdaparameter: 76
body: 71
38Literal
39ExprTuple42, 43
40Literal
41ExprTuple44, 45
42Operationoperator: 46
operands: 47
43Operationoperator: 48
operand: 54
44ExprRangelambda_map: 50
start_index: 61
end_index: 62
45Operationoperator: 51
operands: 52
46Literal
47ExprTuple53
48Literal
49ExprTuple54
50Lambdaparameter: 76
body: 55
51Literal
52ExprTuple56
53ExprRangelambda_map: 57
start_index: 61
end_index: 62
54Variable
55Operationoperator: 58
operands: 59
56ExprRangelambda_map: 60
start_index: 61
end_index: 62
57Lambdaparameter: 76
body: 63
58Literal
59ExprTuple71, 64
60Lambdaparameter: 76
body: 65
61Literal
62Variable
63Operationoperator: 66
operands: 67
64Variable
65Operationoperator: 68
operands: 69
66Literal
67ExprTuple71, 70
68Literal
69ExprTuple71, 72
70IndexedVarvariable: 73
index: 76
71IndexedVarvariable: 74
index: 76
72Literal
73Variable
74Variable
75ExprTuple76
76Variable