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 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, VecSpaces, lin_comb_axn
from proveit.logic import Equals, Forall, Set, SetOfAll
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(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(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(), 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())
\left(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(\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}\right]\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
1Lambdaparameter: 72
body: 2
2Operationoperator: 20
operand: 4
3ExprTuple4
4Lambdaparameter: 51
body: 6
5ExprTuple51
6Conditionalvalue: 7
condition: 8
7Operationoperator: 20
operand: 12
8Operationoperator: 10
operands: 11
9ExprTuple12
10Literal
11ExprTuple51, 13
12Lambdaparameter: 63
body: 15
13Operationoperator: 16
operand: 72
14ExprTuple63
15Conditionalvalue: 18
condition: 19
16Literal
17ExprTuple72
18Operationoperator: 20
operand: 23
19Operationoperator: 68
operands: 22
20Literal
21ExprTuple23
22ExprTuple63, 24
23Lambdaparameters: 43
body: 25
24Literal
25Conditionalvalue: 26
condition: 27
26Operationoperator: 28
operands: 29
27Operationoperator: 56
operands: 30
28Literal
29ExprTuple31, 32
30ExprTuple33
31Operationoperator: 34
operand: 39
32Operationoperator: 36
operand: 40
33ExprRangelambda_map: 38
start_index: 62
end_index: 63
34Literal
35ExprTuple39
36Literal
37ExprTuple40
38Lambdaparameter: 76
body: 41
39Operationoperator: 42
operands: 43
40Lambdaparameters: 44
body: 45
41Operationoperator: 68
operands: 46
42Literal
43ExprTuple47
44ExprTuple48
45Conditionalvalue: 49
condition: 50
46ExprTuple70, 51
47ExprRangelambda_map: 52
start_index: 62
end_index: 63
48ExprRangelambda_map: 53
start_index: 62
end_index: 63
49Operationoperator: 54
operands: 55
50Operationoperator: 56
operands: 57
51Variable
52Lambdaparameter: 76
body: 70
53Lambdaparameter: 76
body: 71
54Literal
55ExprTuple58
56Literal
57ExprTuple59
58ExprRangelambda_map: 60
start_index: 62
end_index: 63
59ExprRangelambda_map: 61
start_index: 62
end_index: 63
60Lambdaparameter: 76
body: 64
61Lambdaparameter: 76
body: 65
62Literal
63Variable
64Operationoperator: 66
operands: 67
65Operationoperator: 68
operands: 69
66Literal
67ExprTuple71, 70
68Literal
69ExprTuple71, 72
70IndexedVarvariable: 73
index: 76
71IndexedVarvariable: 74
index: 76
72Variable
73Variable
74Variable
75ExprTuple76
76Variable