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 Span, SpanningSets, VecSpaces
from proveit.logic import Equals, Forall, InClass, InSet, 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, SpanningSets(V)), Equals(V, Span(sub_expr1))), 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(\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{SpanningSets}\left(V\right)\right) = \left(V = \textrm{Span}\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\}\right)\right)\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: 44
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 16
operand: 7
3Operationoperator: 5
operands: 6
4ExprTuple7
5Literal
6ExprTuple44, 8
7Lambdaparameter: 50
body: 10
8Operationoperator: 11
operand: 15
9ExprTuple50
10Conditionalvalue: 13
condition: 14
11Literal
12ExprTuple15
13Operationoperator: 16
operand: 19
14Operationoperator: 41
operands: 18
15Variable
16Literal
17ExprTuple19
18ExprTuple50, 20
19Lambdaparameters: 46
body: 21
20Literal
21Conditionalvalue: 22
condition: 23
22Operationoperator: 31
operands: 24
23Operationoperator: 25
operands: 26
24ExprTuple27, 28
25Literal
26ExprTuple29
27Operationoperator: 41
operands: 30
28Operationoperator: 31
operands: 32
29ExprRangelambda_map: 33
start_index: 49
end_index: 50
30ExprTuple43, 34
31Literal
32ExprTuple44, 35
33Lambdaparameter: 54
body: 36
34Operationoperator: 37
operand: 44
35Operationoperator: 39
operand: 43
36Operationoperator: 41
operands: 42
37Literal
38ExprTuple44
39Literal
40ExprTuple43
41Literal
42ExprTuple51, 44
43Operationoperator: 45
operands: 46
44Variable
45Literal
46ExprTuple47
47ExprRangelambda_map: 48
start_index: 49
end_index: 50
48Lambdaparameter: 54
body: 51
49Literal
50Variable
51IndexedVarvariable: 52
index: 54
52Variable
53ExprTuple54
54Variable