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 LinDepSets, VecZero, lin_comb_axn, some_nonzero_a
from proveit.logic import And, Equals, Exists, InSet, Set
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(InSet(Set(x_1_to_n), LinDepSets(V)), Exists(instance_param_or_params = [a_1_to_n], instance_expr = Equals(lin_comb_axn, VecZero(V)), domain = K, condition = some_nonzero_a).with_wrapping()).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} \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{LinDepSets}\left(V\right)\right) =  \\ \left[\begin{array}{l}\exists_{a_{1}, a_{2}, \ldots, a_{n} \in K~|~\left(a_{1} \neq 0\right) \lor  \left(a_{2} \neq 0\right) \lor  \ldots \lor  \left(a_{n} \neq 0\right)}~\\
\left(\left(\left(a_{1} \cdot x_{1}\right) +  \left(a_{2} \cdot x_{2}\right) +  \ldots +  \left(a_{n} \cdot x_{n}\right)\right) = \vec{0}\left(V\right)\right)\end{array}\right] \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: 19
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 30
operands: 5
4Operationoperator: 32
operands: 6
5ExprTuple7, 8
6ExprTuple9
7Operationoperator: 50
operands: 10
8Operationoperator: 11
operand: 16
9ExprRangelambda_map: 13
start_index: 53
end_index: 54
10ExprTuple14, 15
11Literal
12ExprTuple16
13Lambdaparameter: 68
body: 17
14Operationoperator: 18
operands: 19
15Operationoperator: 20
operand: 46
16Lambdaparameters: 21
body: 22
17Operationoperator: 50
operands: 23
18Literal
19ExprTuple24
20Literal
21ExprTuple25
22Conditionalvalue: 26
condition: 27
23ExprTuple62, 46
24ExprRangelambda_map: 28
start_index: 53
end_index: 54
25ExprRangelambda_map: 29
start_index: 53
end_index: 54
26Operationoperator: 30
operands: 31
27Operationoperator: 32
operands: 33
28Lambdaparameter: 68
body: 62
29Lambdaparameter: 68
body: 63
30Literal
31ExprTuple34, 35
32Literal
33ExprTuple36, 37
34Operationoperator: 38
operands: 39
35Operationoperator: 40
operand: 46
36ExprRangelambda_map: 42
start_index: 53
end_index: 54
37Operationoperator: 43
operands: 44
38Literal
39ExprTuple45
40Literal
41ExprTuple46
42Lambdaparameter: 68
body: 47
43Literal
44ExprTuple48
45ExprRangelambda_map: 49
start_index: 53
end_index: 54
46Variable
47Operationoperator: 50
operands: 51
48ExprRangelambda_map: 52
start_index: 53
end_index: 54
49Lambdaparameter: 68
body: 55
50Literal
51ExprTuple63, 56
52Lambdaparameter: 68
body: 57
53Literal
54Variable
55Operationoperator: 58
operands: 59
56Variable
57Operationoperator: 60
operands: 61
58Literal
59ExprTuple63, 62
60Literal
61ExprTuple63, 64
62IndexedVarvariable: 65
index: 68
63IndexedVarvariable: 66
index: 68
64Literal
65Variable
66Variable
67ExprTuple68
68Variable