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 LinDepSets, VecZero, lin_comb_axn, some_nonzero_a
from proveit.logic import Equals, Exists, Forall, InSet, Set
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(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), 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} \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}\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: 63
body: 3
2ExprTuple63
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 59
operands: 8
6Literal
7ExprTuple9
8ExprTuple63, 10
9Lambdaparameters: 28
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 39
operands: 14
13Operationoperator: 41
operands: 15
14ExprTuple16, 17
15ExprTuple18
16Operationoperator: 59
operands: 19
17Operationoperator: 20
operand: 25
18ExprRangelambda_map: 22
start_index: 62
end_index: 63
19ExprTuple23, 24
20Literal
21ExprTuple25
22Lambdaparameter: 77
body: 26
23Operationoperator: 27
operands: 28
24Operationoperator: 29
operand: 55
25Lambdaparameters: 30
body: 31
26Operationoperator: 59
operands: 32
27Literal
28ExprTuple33
29Literal
30ExprTuple34
31Conditionalvalue: 35
condition: 36
32ExprTuple71, 55
33ExprRangelambda_map: 37
start_index: 62
end_index: 63
34ExprRangelambda_map: 38
start_index: 62
end_index: 63
35Operationoperator: 39
operands: 40
36Operationoperator: 41
operands: 42
37Lambdaparameter: 77
body: 71
38Lambdaparameter: 77
body: 72
39Literal
40ExprTuple43, 44
41Literal
42ExprTuple45, 46
43Operationoperator: 47
operands: 48
44Operationoperator: 49
operand: 55
45ExprRangelambda_map: 51
start_index: 62
end_index: 63
46Operationoperator: 52
operands: 53
47Literal
48ExprTuple54
49Literal
50ExprTuple55
51Lambdaparameter: 77
body: 56
52Literal
53ExprTuple57
54ExprRangelambda_map: 58
start_index: 62
end_index: 63
55Variable
56Operationoperator: 59
operands: 60
57ExprRangelambda_map: 61
start_index: 62
end_index: 63
58Lambdaparameter: 77
body: 64
59Literal
60ExprTuple72, 65
61Lambdaparameter: 77
body: 66
62Literal
63Variable
64Operationoperator: 67
operands: 68
65Variable
66Operationoperator: 69
operands: 70
67Literal
68ExprTuple72, 71
69Literal
70ExprTuple72, 73
71IndexedVarvariable: 74
index: 77
72IndexedVarvariable: 75
index: 77
73Literal
74Variable
75Variable
76ExprTuple77
77Variable