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, ExprRange, ExprTuple, IndexedVar, K, Lambda, V, Variable, n, x
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 And, Equals, InSet, Set, SetOfAll
from proveit.numbers import one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprTuple(Lambda([x_1_to_n], Conditional(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), And(ExprRange(sub_expr1, InSet(IndexedVar(x, sub_expr1), V), one, n)))))
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(\left(x_{1}, x_{2}, \ldots, x_{n}\right) \mapsto \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} \textrm{ if } \left(x_{1} \in V\right) \land  \left(x_{2} \in V\right) \land  \ldots \land  \left(x_{n} \in V\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
0ExprTuple1
1Lambdaparameters: 20
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 33
operands: 7
5Literal
6ExprTuple8, 9
7ExprTuple10
8Operationoperator: 11
operand: 16
9Operationoperator: 13
operand: 17
10ExprRangelambda_map: 15
start_index: 39
end_index: 40
11Literal
12ExprTuple16
13Literal
14ExprTuple17
15Lambdaparameter: 53
body: 18
16Operationoperator: 19
operands: 20
17Lambdaparameters: 21
body: 22
18Operationoperator: 45
operands: 23
19Literal
20ExprTuple24
21ExprTuple25
22Conditionalvalue: 26
condition: 27
23ExprTuple47, 28
24ExprRangelambda_map: 29
start_index: 39
end_index: 40
25ExprRangelambda_map: 30
start_index: 39
end_index: 40
26Operationoperator: 31
operands: 32
27Operationoperator: 33
operands: 34
28Variable
29Lambdaparameter: 53
body: 47
30Lambdaparameter: 53
body: 48
31Literal
32ExprTuple35
33Literal
34ExprTuple36
35ExprRangelambda_map: 37
start_index: 39
end_index: 40
36ExprRangelambda_map: 38
start_index: 39
end_index: 40
37Lambdaparameter: 53
body: 41
38Lambdaparameter: 53
body: 42
39Literal
40Variable
41Operationoperator: 43
operands: 44
42Operationoperator: 45
operands: 46
43Literal
44ExprTuple48, 47
45Literal
46ExprTuple48, 49
47IndexedVarvariable: 50
index: 53
48IndexedVarvariable: 51
index: 53
49Variable
50Variable
51Variable
52ExprTuple53
53Variable