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, Lambda, V, n
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import Span, SpanningSets
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(n, Conditional(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(), InSet(n, NaturalPos)))
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())
n \mapsto \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} \textrm{ if } n \in \mathbb{N}^+\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 39
body: 2
1ExprTuple39
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 30
operands: 7
5Literal
6ExprTuple8
7ExprTuple39, 9
8Lambdaparameters: 35
body: 10
9Literal
10Conditionalvalue: 11
condition: 12
11Operationoperator: 20
operands: 13
12Operationoperator: 14
operands: 15
13ExprTuple16, 17
14Literal
15ExprTuple18
16Operationoperator: 30
operands: 19
17Operationoperator: 20
operands: 21
18ExprRangelambda_map: 22
start_index: 38
end_index: 39
19ExprTuple32, 23
20Literal
21ExprTuple33, 24
22Lambdaparameter: 43
body: 25
23Operationoperator: 26
operand: 33
24Operationoperator: 28
operand: 32
25Operationoperator: 30
operands: 31
26Literal
27ExprTuple33
28Literal
29ExprTuple32
30Literal
31ExprTuple40, 33
32Operationoperator: 34
operands: 35
33Variable
34Literal
35ExprTuple36
36ExprRangelambda_map: 37
start_index: 38
end_index: 39
37Lambdaparameter: 43
body: 40
38Literal
39Variable
40IndexedVarvariable: 41
index: 43
41Variable
42ExprTuple43
43Variable