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, VecSpaces, VecZero, lin_comb_axn, some_nonzero_a
from proveit.logic import Equals, Exists, Forall, InClass, InSet, Set
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(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), 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} \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] \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: 64
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 15
operand: 7
3Operationoperator: 5
operands: 6
4ExprTuple7
5Literal
6ExprTuple64, 8
7Lambdaparameter: 72
body: 10
8Operationoperator: 11
operand: 74
9ExprTuple72
10Conditionalvalue: 13
condition: 14
11Literal
12ExprTuple74
13Operationoperator: 15
operand: 18
14Operationoperator: 68
operands: 17
15Literal
16ExprTuple18
17ExprTuple72, 19
18Lambdaparameters: 37
body: 20
19Literal
20Conditionalvalue: 21
condition: 22
21Operationoperator: 48
operands: 23
22Operationoperator: 50
operands: 24
23ExprTuple25, 26
24ExprTuple27
25Operationoperator: 68
operands: 28
26Operationoperator: 29
operand: 34
27ExprRangelambda_map: 31
start_index: 71
end_index: 72
28ExprTuple32, 33
29Literal
30ExprTuple34
31Lambdaparameter: 86
body: 35
32Operationoperator: 36
operands: 37
33Operationoperator: 38
operand: 64
34Lambdaparameters: 39
body: 40
35Operationoperator: 68
operands: 41
36Literal
37ExprTuple42
38Literal
39ExprTuple43
40Conditionalvalue: 44
condition: 45
41ExprTuple80, 64
42ExprRangelambda_map: 46
start_index: 71
end_index: 72
43ExprRangelambda_map: 47
start_index: 71
end_index: 72
44Operationoperator: 48
operands: 49
45Operationoperator: 50
operands: 51
46Lambdaparameter: 86
body: 80
47Lambdaparameter: 86
body: 81
48Literal
49ExprTuple52, 53
50Literal
51ExprTuple54, 55
52Operationoperator: 56
operands: 57
53Operationoperator: 58
operand: 64
54ExprRangelambda_map: 60
start_index: 71
end_index: 72
55Operationoperator: 61
operands: 62
56Literal
57ExprTuple63
58Literal
59ExprTuple64
60Lambdaparameter: 86
body: 65
61Literal
62ExprTuple66
63ExprRangelambda_map: 67
start_index: 71
end_index: 72
64Variable
65Operationoperator: 68
operands: 69
66ExprRangelambda_map: 70
start_index: 71
end_index: 72
67Lambdaparameter: 86
body: 73
68Literal
69ExprTuple81, 74
70Lambdaparameter: 86
body: 75
71Literal
72Variable
73Operationoperator: 76
operands: 77
74Variable
75Operationoperator: 78
operands: 79
76Literal
77ExprTuple81, 80
78Literal
79ExprTuple81, 82
80IndexedVarvariable: 83
index: 86
81IndexedVarvariable: 84
index: 86
82Literal
83Variable
84Variable
85ExprTuple86
86Variable