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 Span, lin_comb_axn
from proveit.logic import Equals, Forall, Set, SetOfAll
In [2]:
# build up the expression from sub-expressions
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()
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} \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}
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: 22
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operands: 8
6Operationoperator: 35
operands: 9
7Literal
8ExprTuple10, 11
9ExprTuple12
10Operationoperator: 13
operand: 18
11Operationoperator: 15
operand: 19
12ExprRangelambda_map: 17
start_index: 41
end_index: 42
13Literal
14ExprTuple18
15Literal
16ExprTuple19
17Lambdaparameter: 55
body: 20
18Operationoperator: 21
operands: 22
19Lambdaparameters: 23
body: 24
20Operationoperator: 47
operands: 25
21Literal
22ExprTuple26
23ExprTuple27
24Conditionalvalue: 28
condition: 29
25ExprTuple49, 30
26ExprRangelambda_map: 31
start_index: 41
end_index: 42
27ExprRangelambda_map: 32
start_index: 41
end_index: 42
28Operationoperator: 33
operands: 34
29Operationoperator: 35
operands: 36
30Variable
31Lambdaparameter: 55
body: 49
32Lambdaparameter: 55
body: 50
33Literal
34ExprTuple37
35Literal
36ExprTuple38
37ExprRangelambda_map: 39
start_index: 41
end_index: 42
38ExprRangelambda_map: 40
start_index: 41
end_index: 42
39Lambdaparameter: 55
body: 43
40Lambdaparameter: 55
body: 44
41Literal
42Variable
43Operationoperator: 45
operands: 46
44Operationoperator: 47
operands: 48
45Literal
46ExprTuple50, 49
47Literal
48ExprTuple50, 51
49IndexedVarvariable: 52
index: 55
50IndexedVarvariable: 53
index: 55
51Variable
52Variable
53Variable
54ExprTuple55
55Variable