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 x_1_to_n
from proveit.linear_algebra import Span, SpanningSets, VecSpaces
from proveit.logic import Equals, Forall, InSet, Set
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Set(x_1_to_n)
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(sub_expr1, SpanningSets(V)), Equals(V, Span(sub_expr1))), 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(\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{SpanningSets}\left(V\right)\right) = \left(V = \textrm{Span}\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\}\right)\right)\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: 46
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 18
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple46, 10
9Lambdaparameter: 52
body: 12
10Operationoperator: 13
operand: 17
11ExprTuple52
12Conditionalvalue: 15
condition: 16
13Literal
14ExprTuple17
15Operationoperator: 18
operand: 21
16Operationoperator: 43
operands: 20
17Variable
18Literal
19ExprTuple21
20ExprTuple52, 22
21Lambdaparameters: 48
body: 23
22Literal
23Conditionalvalue: 24
condition: 25
24Operationoperator: 33
operands: 26
25Operationoperator: 27
operands: 28
26ExprTuple29, 30
27Literal
28ExprTuple31
29Operationoperator: 43
operands: 32
30Operationoperator: 33
operands: 34
31ExprRangelambda_map: 35
start_index: 51
end_index: 52
32ExprTuple45, 36
33Literal
34ExprTuple46, 37
35Lambdaparameter: 56
body: 38
36Operationoperator: 39
operand: 46
37Operationoperator: 41
operand: 45
38Operationoperator: 43
operands: 44
39Literal
40ExprTuple46
41Literal
42ExprTuple45
43Literal
44ExprTuple53, 46
45Operationoperator: 47
operands: 48
46Variable
47Literal
48ExprTuple49
49ExprRangelambda_map: 50
start_index: 51
end_index: 52
50Lambdaparameter: 56
body: 53
51Literal
52Variable
53IndexedVarvariable: 54
index: 56
54Variable
55ExprTuple56
56Variable