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, VecSpaces, VecZero, lin_comb_axn, some_nonzero_a
from proveit.logic import Equals, Exists, Forall, InClass, InSet, Set
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(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), 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} \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] \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: 65
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 16
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple65, 9
8Lambdaparameter: 73
body: 11
9Operationoperator: 12
operand: 75
10ExprTuple73
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple75
14Operationoperator: 16
operand: 19
15Operationoperator: 69
operands: 18
16Literal
17ExprTuple19
18ExprTuple73, 20
19Lambdaparameters: 38
body: 21
20Literal
21Conditionalvalue: 22
condition: 23
22Operationoperator: 49
operands: 24
23Operationoperator: 51
operands: 25
24ExprTuple26, 27
25ExprTuple28
26Operationoperator: 69
operands: 29
27Operationoperator: 30
operand: 35
28ExprRangelambda_map: 32
start_index: 72
end_index: 73
29ExprTuple33, 34
30Literal
31ExprTuple35
32Lambdaparameter: 87
body: 36
33Operationoperator: 37
operands: 38
34Operationoperator: 39
operand: 65
35Lambdaparameters: 40
body: 41
36Operationoperator: 69
operands: 42
37Literal
38ExprTuple43
39Literal
40ExprTuple44
41Conditionalvalue: 45
condition: 46
42ExprTuple81, 65
43ExprRangelambda_map: 47
start_index: 72
end_index: 73
44ExprRangelambda_map: 48
start_index: 72
end_index: 73
45Operationoperator: 49
operands: 50
46Operationoperator: 51
operands: 52
47Lambdaparameter: 87
body: 81
48Lambdaparameter: 87
body: 82
49Literal
50ExprTuple53, 54
51Literal
52ExprTuple55, 56
53Operationoperator: 57
operands: 58
54Operationoperator: 59
operand: 65
55ExprRangelambda_map: 61
start_index: 72
end_index: 73
56Operationoperator: 62
operands: 63
57Literal
58ExprTuple64
59Literal
60ExprTuple65
61Lambdaparameter: 87
body: 66
62Literal
63ExprTuple67
64ExprRangelambda_map: 68
start_index: 72
end_index: 73
65Variable
66Operationoperator: 69
operands: 70
67ExprRangelambda_map: 71
start_index: 72
end_index: 73
68Lambdaparameter: 87
body: 74
69Literal
70ExprTuple82, 75
71Lambdaparameter: 87
body: 76
72Literal
73Variable
74Operationoperator: 77
operands: 78
75Variable
76Operationoperator: 79
operands: 80
77Literal
78ExprTuple82, 81
79Literal
80ExprTuple82, 83
81IndexedVarvariable: 84
index: 87
82IndexedVarvariable: 85
index: 87
83Literal
84Variable
85Variable
86ExprTuple87
87Variable