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, VecSpaces, 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 = [V], instance_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), 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} \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]\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: 18
operand: 2
1ExprTuple2
2Lambdaparameter: 49
body: 4
3ExprTuple49
4Conditionalvalue: 5
condition: 6
5Operationoperator: 18
operand: 10
6Operationoperator: 8
operands: 9
7ExprTuple10
8Literal
9ExprTuple49, 11
10Lambdaparameter: 61
body: 13
11Operationoperator: 14
operand: 70
12ExprTuple61
13Conditionalvalue: 16
condition: 17
14Literal
15ExprTuple70
16Operationoperator: 18
operand: 21
17Operationoperator: 66
operands: 20
18Literal
19ExprTuple21
20ExprTuple61, 22
21Lambdaparameters: 41
body: 23
22Literal
23Conditionalvalue: 24
condition: 25
24Operationoperator: 26
operands: 27
25Operationoperator: 54
operands: 28
26Literal
27ExprTuple29, 30
28ExprTuple31
29Operationoperator: 32
operand: 37
30Operationoperator: 34
operand: 38
31ExprRangelambda_map: 36
start_index: 60
end_index: 61
32Literal
33ExprTuple37
34Literal
35ExprTuple38
36Lambdaparameter: 74
body: 39
37Operationoperator: 40
operands: 41
38Lambdaparameters: 42
body: 43
39Operationoperator: 66
operands: 44
40Literal
41ExprTuple45
42ExprTuple46
43Conditionalvalue: 47
condition: 48
44ExprTuple68, 49
45ExprRangelambda_map: 50
start_index: 60
end_index: 61
46ExprRangelambda_map: 51
start_index: 60
end_index: 61
47Operationoperator: 52
operands: 53
48Operationoperator: 54
operands: 55
49Variable
50Lambdaparameter: 74
body: 68
51Lambdaparameter: 74
body: 69
52Literal
53ExprTuple56
54Literal
55ExprTuple57
56ExprRangelambda_map: 58
start_index: 60
end_index: 61
57ExprRangelambda_map: 59
start_index: 60
end_index: 61
58Lambdaparameter: 74
body: 62
59Lambdaparameter: 74
body: 63
60Literal
61Variable
62Operationoperator: 64
operands: 65
63Operationoperator: 66
operands: 67
64Literal
65ExprTuple69, 68
66Literal
67ExprTuple69, 70
68IndexedVarvariable: 71
index: 74
69IndexedVarvariable: 72
index: 74
70Variable
71Variable
72Variable
73ExprTuple74
74Variable