logo

Expression of type Forall

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 K, 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 = 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())
\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]
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 17
operand: 2
1ExprTuple2
2Lambdaparameter: 66
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 17
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple66, 10
9Lambdaparameter: 74
body: 12
10Operationoperator: 13
operand: 76
11ExprTuple74
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple76
15Operationoperator: 17
operand: 20
16Operationoperator: 70
operands: 19
17Literal
18ExprTuple20
19ExprTuple74, 21
20Lambdaparameters: 39
body: 22
21Literal
22Conditionalvalue: 23
condition: 24
23Operationoperator: 50
operands: 25
24Operationoperator: 52
operands: 26
25ExprTuple27, 28
26ExprTuple29
27Operationoperator: 70
operands: 30
28Operationoperator: 31
operand: 36
29ExprRangelambda_map: 33
start_index: 73
end_index: 74
30ExprTuple34, 35
31Literal
32ExprTuple36
33Lambdaparameter: 88
body: 37
34Operationoperator: 38
operands: 39
35Operationoperator: 40
operand: 66
36Lambdaparameters: 41
body: 42
37Operationoperator: 70
operands: 43
38Literal
39ExprTuple44
40Literal
41ExprTuple45
42Conditionalvalue: 46
condition: 47
43ExprTuple82, 66
44ExprRangelambda_map: 48
start_index: 73
end_index: 74
45ExprRangelambda_map: 49
start_index: 73
end_index: 74
46Operationoperator: 50
operands: 51
47Operationoperator: 52
operands: 53
48Lambdaparameter: 88
body: 82
49Lambdaparameter: 88
body: 83
50Literal
51ExprTuple54, 55
52Literal
53ExprTuple56, 57
54Operationoperator: 58
operands: 59
55Operationoperator: 60
operand: 66
56ExprRangelambda_map: 62
start_index: 73
end_index: 74
57Operationoperator: 63
operands: 64
58Literal
59ExprTuple65
60Literal
61ExprTuple66
62Lambdaparameter: 88
body: 67
63Literal
64ExprTuple68
65ExprRangelambda_map: 69
start_index: 73
end_index: 74
66Variable
67Operationoperator: 70
operands: 71
68ExprRangelambda_map: 72
start_index: 73
end_index: 74
69Lambdaparameter: 88
body: 75
70Literal
71ExprTuple83, 76
72Lambdaparameter: 88
body: 77
73Literal
74Variable
75Operationoperator: 78
operands: 79
76Variable
77Operationoperator: 80
operands: 81
78Literal
79ExprTuple83, 82
80Literal
81ExprTuple83, 84
82IndexedVarvariable: 85
index: 88
83IndexedVarvariable: 86
index: 88
84Literal
85Variable
86Variable
87ExprTuple88
88Variable