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 Span, lin_comb_axn
from proveit.logic import Equals, Forall, Set, SetOfAll
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(Span(Set(x_1_to_n)), SetOfAll(instance_param_or_params = [a_1_to_n], instance_element = lin_comb_axn, domain = K)).with_wrapping_at(2), domain = V).with_wrapping(), domain = NaturalPos)
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_{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} \textrm{Span}\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\}\right) =  \\ \left\{\left(a_{1} \cdot x_{1}\right) +  \left(a_{2} \cdot x_{2}\right) +  \ldots +  \left(a_{n} \cdot x_{n}\right)\right\}_{a_{1}, a_{2}, \ldots, a_{n} \in K} \end{array} \end{array}\right)\end{array}\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: 7
operand: 2
1ExprTuple2
2Lambdaparameter: 50
body: 4
3ExprTuple50
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 55
operands: 9
7Literal
8ExprTuple10
9ExprTuple50, 11
10Lambdaparameters: 30
body: 12
11Literal
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 43
operands: 17
15Literal
16ExprTuple18, 19
17ExprTuple20
18Operationoperator: 21
operand: 26
19Operationoperator: 23
operand: 27
20ExprRangelambda_map: 25
start_index: 49
end_index: 50
21Literal
22ExprTuple26
23Literal
24ExprTuple27
25Lambdaparameter: 63
body: 28
26Operationoperator: 29
operands: 30
27Lambdaparameters: 31
body: 32
28Operationoperator: 55
operands: 33
29Literal
30ExprTuple34
31ExprTuple35
32Conditionalvalue: 36
condition: 37
33ExprTuple57, 38
34ExprRangelambda_map: 39
start_index: 49
end_index: 50
35ExprRangelambda_map: 40
start_index: 49
end_index: 50
36Operationoperator: 41
operands: 42
37Operationoperator: 43
operands: 44
38Variable
39Lambdaparameter: 63
body: 57
40Lambdaparameter: 63
body: 58
41Literal
42ExprTuple45
43Literal
44ExprTuple46
45ExprRangelambda_map: 47
start_index: 49
end_index: 50
46ExprRangelambda_map: 48
start_index: 49
end_index: 50
47Lambdaparameter: 63
body: 51
48Lambdaparameter: 63
body: 52
49Literal
50Variable
51Operationoperator: 53
operands: 54
52Operationoperator: 55
operands: 56
53Literal
54ExprTuple58, 57
55Literal
56ExprTuple58, 59
57IndexedVarvariable: 60
index: 63
58IndexedVarvariable: 61
index: 63
59Variable
60Variable
61Variable
62ExprTuple63
63Variable