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 Span, SpanningSets, VecSpaces
from proveit.logic import Equals, Forall, 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(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, SpanningSets(V)), Equals(V, Span(sub_expr1))), 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(\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]\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: 47
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 19
operand: 10
6Operationoperator: 8
operands: 9
7ExprTuple10
8Literal
9ExprTuple47, 11
10Lambdaparameter: 53
body: 13
11Operationoperator: 14
operand: 18
12ExprTuple53
13Conditionalvalue: 16
condition: 17
14Literal
15ExprTuple18
16Operationoperator: 19
operand: 22
17Operationoperator: 44
operands: 21
18Variable
19Literal
20ExprTuple22
21ExprTuple53, 23
22Lambdaparameters: 49
body: 24
23Literal
24Conditionalvalue: 25
condition: 26
25Operationoperator: 34
operands: 27
26Operationoperator: 28
operands: 29
27ExprTuple30, 31
28Literal
29ExprTuple32
30Operationoperator: 44
operands: 33
31Operationoperator: 34
operands: 35
32ExprRangelambda_map: 36
start_index: 52
end_index: 53
33ExprTuple46, 37
34Literal
35ExprTuple47, 38
36Lambdaparameter: 57
body: 39
37Operationoperator: 40
operand: 47
38Operationoperator: 42
operand: 46
39Operationoperator: 44
operands: 45
40Literal
41ExprTuple47
42Literal
43ExprTuple46
44Literal
45ExprTuple54, 47
46Operationoperator: 48
operands: 49
47Variable
48Literal
49ExprTuple50
50ExprRangelambda_map: 51
start_index: 52
end_index: 53
51Lambdaparameter: 57
body: 54
52Literal
53Variable
54IndexedVarvariable: 55
index: 57
55Variable
56ExprTuple57
57Variable