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, VecSpaces, lin_comb_axn
from proveit.logic import Equals, Forall, InClass, Set, SetOfAll
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(V, Conditional(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), InClass(V, 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(V \mapsto \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] \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\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: 48
body: 3
2ExprTuple48
3Conditionalvalue: 4
condition: 5
4Operationoperator: 17
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple48, 10
9Lambdaparameter: 60
body: 12
10Operationoperator: 13
operand: 69
11ExprTuple60
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple69
15Operationoperator: 17
operand: 20
16Operationoperator: 65
operands: 19
17Literal
18ExprTuple20
19ExprTuple60, 21
20Lambdaparameters: 40
body: 22
21Literal
22Conditionalvalue: 23
condition: 24
23Operationoperator: 25
operands: 26
24Operationoperator: 53
operands: 27
25Literal
26ExprTuple28, 29
27ExprTuple30
28Operationoperator: 31
operand: 36
29Operationoperator: 33
operand: 37
30ExprRangelambda_map: 35
start_index: 59
end_index: 60
31Literal
32ExprTuple36
33Literal
34ExprTuple37
35Lambdaparameter: 73
body: 38
36Operationoperator: 39
operands: 40
37Lambdaparameters: 41
body: 42
38Operationoperator: 65
operands: 43
39Literal
40ExprTuple44
41ExprTuple45
42Conditionalvalue: 46
condition: 47
43ExprTuple67, 48
44ExprRangelambda_map: 49
start_index: 59
end_index: 60
45ExprRangelambda_map: 50
start_index: 59
end_index: 60
46Operationoperator: 51
operands: 52
47Operationoperator: 53
operands: 54
48Variable
49Lambdaparameter: 73
body: 67
50Lambdaparameter: 73
body: 68
51Literal
52ExprTuple55
53Literal
54ExprTuple56
55ExprRangelambda_map: 57
start_index: 59
end_index: 60
56ExprRangelambda_map: 58
start_index: 59
end_index: 60
57Lambdaparameter: 73
body: 61
58Lambdaparameter: 73
body: 62
59Literal
60Variable
61Operationoperator: 63
operands: 64
62Operationoperator: 65
operands: 66
63Literal
64ExprTuple68, 67
65Literal
66ExprTuple68, 69
67IndexedVarvariable: 70
index: 73
68IndexedVarvariable: 71
index: 73
69Variable
70Variable
71Variable
72ExprTuple73
73Variable