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 x_1_to_n
from proveit.linear_algebra import Bases, LinDepSets, SpanningSets, VecSpaces
from proveit.logic import And, Equals, Forall, InClass, 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(V, Conditional(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), 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{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] \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: 53
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 16
operand: 7
3Operationoperator: 5
operands: 6
4ExprTuple7
5Literal
6ExprTuple53, 8
7Lambdaparameter: 56
body: 10
8Operationoperator: 11
operand: 15
9ExprTuple56
10Conditionalvalue: 13
condition: 14
11Literal
12ExprTuple15
13Operationoperator: 16
operand: 19
14Operationoperator: 42
operands: 18
15Variable
16Literal
17ExprTuple19
18ExprTuple56, 20
19Lambdaparameters: 49
body: 21
20Literal
21Conditionalvalue: 22
condition: 23
22Operationoperator: 24
operands: 25
23Operationoperator: 31
operands: 26
24Literal
25ExprTuple27, 28
26ExprTuple29
27Operationoperator: 42
operands: 30
28Operationoperator: 31
operands: 32
29ExprRangelambda_map: 33
start_index: 55
end_index: 56
30ExprTuple45, 34
31Literal
32ExprTuple35, 36
33Lambdaparameter: 60
body: 37
34Operationoperator: 38
operand: 53
35Operationoperator: 42
operands: 39
36Operationoperator: 40
operands: 41
37Operationoperator: 42
operands: 43
38Literal
39ExprTuple45, 44
40Literal
41ExprTuple45, 46
42Literal
43ExprTuple57, 53
44Operationoperator: 47
operand: 53
45Operationoperator: 48
operands: 49
46Operationoperator: 50
operand: 53
47Literal
48Literal
49ExprTuple52
50Literal
51ExprTuple53
52ExprRangelambda_map: 54
start_index: 55
end_index: 56
53Variable
54Lambdaparameter: 60
body: 57
55Literal
56Variable
57IndexedVarvariable: 58
index: 60
58Variable
59ExprTuple60
60Variable