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
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
In [2]:
# build up the expression from sub-expressions
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()
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())
\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}
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneTrue('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: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameters: 21
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 32
operands: 7
6Operationoperator: 34
operands: 8
7ExprTuple9, 10
8ExprTuple11
9Operationoperator: 52
operands: 12
10Operationoperator: 13
operand: 18
11ExprRangelambda_map: 15
start_index: 55
end_index: 56
12ExprTuple16, 17
13Literal
14ExprTuple18
15Lambdaparameter: 70
body: 19
16Operationoperator: 20
operands: 21
17Operationoperator: 22
operand: 48
18Lambdaparameters: 23
body: 24
19Operationoperator: 52
operands: 25
20Literal
21ExprTuple26
22Literal
23ExprTuple27
24Conditionalvalue: 28
condition: 29
25ExprTuple64, 48
26ExprRangelambda_map: 30
start_index: 55
end_index: 56
27ExprRangelambda_map: 31
start_index: 55
end_index: 56
28Operationoperator: 32
operands: 33
29Operationoperator: 34
operands: 35
30Lambdaparameter: 70
body: 64
31Lambdaparameter: 70
body: 65
32Literal
33ExprTuple36, 37
34Literal
35ExprTuple38, 39
36Operationoperator: 40
operands: 41
37Operationoperator: 42
operand: 48
38ExprRangelambda_map: 44
start_index: 55
end_index: 56
39Operationoperator: 45
operands: 46
40Literal
41ExprTuple47
42Literal
43ExprTuple48
44Lambdaparameter: 70
body: 49
45Literal
46ExprTuple50
47ExprRangelambda_map: 51
start_index: 55
end_index: 56
48Variable
49Operationoperator: 52
operands: 53
50ExprRangelambda_map: 54
start_index: 55
end_index: 56
51Lambdaparameter: 70
body: 57
52Literal
53ExprTuple65, 58
54Lambdaparameter: 70
body: 59
55Literal
56Variable
57Operationoperator: 60
operands: 61
58Variable
59Operationoperator: 62
operands: 63
60Literal
61ExprTuple65, 64
62Literal
63ExprTuple65, 66
64IndexedVarvariable: 67
index: 70
65IndexedVarvariable: 68
index: 70
66Literal
67Variable
68Variable
69ExprTuple70
70Variable