logo

Expression of type ExprTuple

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, ExprTuple, K, Lambda, V, n
from proveit.core_expr_types import a_1_to_n, x_1_to_n
from proveit.linear_algebra import Span, lin_comb_axn
from proveit.logic import Equals, Forall, InSet, Set, SetOfAll
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(n, Conditional(Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(Span(Set(x_1_to_n)), SetOfAll(instance_param_or_params = [a_1_to_n], instance_element = lin_comb_axn, domain = K)).with_wrapping_at(2), 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())
\left(n \mapsto \left\{\begin{array}{l}\forall_{x_{1}, x_{2}, \ldots, x_{n} \in V}~\\
\left(\begin{array}{c} \begin{array}{l} \textrm{Span}\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\}\right) =  \\ \left\{\left(a_{1} \cdot x_{1}\right) +  \left(a_{2} \cdot x_{2}\right) +  \ldots +  \left(a_{n} \cdot x_{n}\right)\right\}_{a_{1}, a_{2}, \ldots, a_{n} \in K} \end{array} \end{array}\right)\end{array} \textrm{ if } n \in \mathbb{N}^+\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 49
body: 3
2ExprTuple49
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 54
operands: 8
6Literal
7ExprTuple9
8ExprTuple49, 10
9Lambdaparameters: 29
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 42
operands: 16
14Literal
15ExprTuple17, 18
16ExprTuple19
17Operationoperator: 20
operand: 25
18Operationoperator: 22
operand: 26
19ExprRangelambda_map: 24
start_index: 48
end_index: 49
20Literal
21ExprTuple25
22Literal
23ExprTuple26
24Lambdaparameter: 62
body: 27
25Operationoperator: 28
operands: 29
26Lambdaparameters: 30
body: 31
27Operationoperator: 54
operands: 32
28Literal
29ExprTuple33
30ExprTuple34
31Conditionalvalue: 35
condition: 36
32ExprTuple56, 37
33ExprRangelambda_map: 38
start_index: 48
end_index: 49
34ExprRangelambda_map: 39
start_index: 48
end_index: 49
35Operationoperator: 40
operands: 41
36Operationoperator: 42
operands: 43
37Variable
38Lambdaparameter: 62
body: 56
39Lambdaparameter: 62
body: 57
40Literal
41ExprTuple44
42Literal
43ExprTuple45
44ExprRangelambda_map: 46
start_index: 48
end_index: 49
45ExprRangelambda_map: 47
start_index: 48
end_index: 49
46Lambdaparameter: 62
body: 50
47Lambdaparameter: 62
body: 51
48Literal
49Variable
50Operationoperator: 52
operands: 53
51Operationoperator: 54
operands: 55
52Literal
53ExprTuple57, 56
54Literal
55ExprTuple57, 58
56IndexedVarvariable: 59
index: 62
57IndexedVarvariable: 60
index: 62
58Variable
59Variable
60Variable
61ExprTuple62
62Variable