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 x_1_to_n
from proveit.linear_algebra import Bases, LinDepSets, SpanningSets, VecSpaces
from proveit.logic import And, Equals, Forall, InSet, NotInSet, Set
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Set(x_1_to_n)
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(sub_expr1, Bases(V)), And(InSet(sub_expr1, SpanningSets(V)), NotInSet(sub_expr1, LinDepSets(V))).with_wrapping_at(2)).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{Bases}\left(V\right)\right) =  \\ \left(\begin{array}{c} \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{SpanningSets}\left(V\right)\right) \land  \\ \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \notin \textrm{LinDepSets}\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: 18
body: 1
1Operationoperator: 19
operand: 3
2ExprTuple3
3Lambdaparameter: 56
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 19
operand: 10
6Operationoperator: 8
operands: 9
7ExprTuple10
8Literal
9ExprTuple56, 11
10Lambdaparameter: 59
body: 13
11Operationoperator: 14
operand: 18
12ExprTuple59
13Conditionalvalue: 16
condition: 17
14Literal
15ExprTuple18
16Operationoperator: 19
operand: 22
17Operationoperator: 45
operands: 21
18Variable
19Literal
20ExprTuple22
21ExprTuple59, 23
22Lambdaparameters: 52
body: 24
23Literal
24Conditionalvalue: 25
condition: 26
25Operationoperator: 27
operands: 28
26Operationoperator: 34
operands: 29
27Literal
28ExprTuple30, 31
29ExprTuple32
30Operationoperator: 45
operands: 33
31Operationoperator: 34
operands: 35
32ExprRangelambda_map: 36
start_index: 58
end_index: 59
33ExprTuple48, 37
34Literal
35ExprTuple38, 39
36Lambdaparameter: 63
body: 40
37Operationoperator: 41
operand: 56
38Operationoperator: 45
operands: 42
39Operationoperator: 43
operands: 44
40Operationoperator: 45
operands: 46
41Literal
42ExprTuple48, 47
43Literal
44ExprTuple48, 49
45Literal
46ExprTuple60, 56
47Operationoperator: 50
operand: 56
48Operationoperator: 51
operands: 52
49Operationoperator: 53
operand: 56
50Literal
51Literal
52ExprTuple55
53Literal
54ExprTuple56
55ExprRangelambda_map: 57
start_index: 58
end_index: 59
56Variable
57Lambdaparameter: 63
body: 60
58Literal
59Variable
60IndexedVarvariable: 61
index: 63
61Variable
62ExprTuple63
63Variable