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 = [K], instance_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_{K}~\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]
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: 20
operand: 2
1ExprTuple2
2Lambdaparameter: 79
body: 3
3Operationoperator: 20
operand: 5
4ExprTuple5
5Lambdaparameter: 69
body: 6
6Conditionalvalue: 7
condition: 8
7Operationoperator: 20
operand: 12
8Operationoperator: 10
operands: 11
9ExprTuple12
10Literal
11ExprTuple69, 13
12Lambdaparameter: 77
body: 15
13Operationoperator: 16
operand: 79
14ExprTuple77
15Conditionalvalue: 18
condition: 19
16Literal
17ExprTuple79
18Operationoperator: 20
operand: 23
19Operationoperator: 73
operands: 22
20Literal
21ExprTuple23
22ExprTuple77, 24
23Lambdaparameters: 42
body: 25
24Literal
25Conditionalvalue: 26
condition: 27
26Operationoperator: 53
operands: 28
27Operationoperator: 55
operands: 29
28ExprTuple30, 31
29ExprTuple32
30Operationoperator: 73
operands: 33
31Operationoperator: 34
operand: 39
32ExprRangelambda_map: 36
start_index: 76
end_index: 77
33ExprTuple37, 38
34Literal
35ExprTuple39
36Lambdaparameter: 91
body: 40
37Operationoperator: 41
operands: 42
38Operationoperator: 43
operand: 69
39Lambdaparameters: 44
body: 45
40Operationoperator: 73
operands: 46
41Literal
42ExprTuple47
43Literal
44ExprTuple48
45Conditionalvalue: 49
condition: 50
46ExprTuple85, 69
47ExprRangelambda_map: 51
start_index: 76
end_index: 77
48ExprRangelambda_map: 52
start_index: 76
end_index: 77
49Operationoperator: 53
operands: 54
50Operationoperator: 55
operands: 56
51Lambdaparameter: 91
body: 85
52Lambdaparameter: 91
body: 86
53Literal
54ExprTuple57, 58
55Literal
56ExprTuple59, 60
57Operationoperator: 61
operands: 62
58Operationoperator: 63
operand: 69
59ExprRangelambda_map: 65
start_index: 76
end_index: 77
60Operationoperator: 66
operands: 67
61Literal
62ExprTuple68
63Literal
64ExprTuple69
65Lambdaparameter: 91
body: 70
66Literal
67ExprTuple71
68ExprRangelambda_map: 72
start_index: 76
end_index: 77
69Variable
70Operationoperator: 73
operands: 74
71ExprRangelambda_map: 75
start_index: 76
end_index: 77
72Lambdaparameter: 91
body: 78
73Literal
74ExprTuple86, 79
75Lambdaparameter: 91
body: 80
76Literal
77Variable
78Operationoperator: 81
operands: 82
79Variable
80Operationoperator: 83
operands: 84
81Literal
82ExprTuple86, 85
83Literal
84ExprTuple86, 87
85IndexedVarvariable: 88
index: 91
86IndexedVarvariable: 89
index: 91
87Literal
88Variable
89Variable
90ExprTuple91
91Variable