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 LinDepSets, VecSpaces, 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(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(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(), 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} \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}\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: 78
body: 2
2Operationoperator: 19
operand: 4
3ExprTuple4
4Lambdaparameter: 68
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 19
operand: 11
7Operationoperator: 9
operands: 10
8ExprTuple11
9Literal
10ExprTuple68, 12
11Lambdaparameter: 76
body: 14
12Operationoperator: 15
operand: 78
13ExprTuple76
14Conditionalvalue: 17
condition: 18
15Literal
16ExprTuple78
17Operationoperator: 19
operand: 22
18Operationoperator: 72
operands: 21
19Literal
20ExprTuple22
21ExprTuple76, 23
22Lambdaparameters: 41
body: 24
23Literal
24Conditionalvalue: 25
condition: 26
25Operationoperator: 52
operands: 27
26Operationoperator: 54
operands: 28
27ExprTuple29, 30
28ExprTuple31
29Operationoperator: 72
operands: 32
30Operationoperator: 33
operand: 38
31ExprRangelambda_map: 35
start_index: 75
end_index: 76
32ExprTuple36, 37
33Literal
34ExprTuple38
35Lambdaparameter: 90
body: 39
36Operationoperator: 40
operands: 41
37Operationoperator: 42
operand: 68
38Lambdaparameters: 43
body: 44
39Operationoperator: 72
operands: 45
40Literal
41ExprTuple46
42Literal
43ExprTuple47
44Conditionalvalue: 48
condition: 49
45ExprTuple84, 68
46ExprRangelambda_map: 50
start_index: 75
end_index: 76
47ExprRangelambda_map: 51
start_index: 75
end_index: 76
48Operationoperator: 52
operands: 53
49Operationoperator: 54
operands: 55
50Lambdaparameter: 90
body: 84
51Lambdaparameter: 90
body: 85
52Literal
53ExprTuple56, 57
54Literal
55ExprTuple58, 59
56Operationoperator: 60
operands: 61
57Operationoperator: 62
operand: 68
58ExprRangelambda_map: 64
start_index: 75
end_index: 76
59Operationoperator: 65
operands: 66
60Literal
61ExprTuple67
62Literal
63ExprTuple68
64Lambdaparameter: 90
body: 69
65Literal
66ExprTuple70
67ExprRangelambda_map: 71
start_index: 75
end_index: 76
68Variable
69Operationoperator: 72
operands: 73
70ExprRangelambda_map: 74
start_index: 75
end_index: 76
71Lambdaparameter: 90
body: 77
72Literal
73ExprTuple85, 78
74Lambdaparameter: 90
body: 79
75Literal
76Variable
77Operationoperator: 80
operands: 81
78Variable
79Operationoperator: 82
operands: 83
80Literal
81ExprTuple85, 84
82Literal
83ExprTuple85, 86
84IndexedVarvariable: 87
index: 90
85IndexedVarvariable: 88
index: 90
86Literal
87Variable
88Variable
89ExprTuple90
90Variable