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 V, n
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import Bases, LinDepSets, SpanningSets
from proveit.logic import And, Equals, Forall, InSet, NotInSet, 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 = [n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(InSet(sub_expr1, Bases(V)), And(InSet(sub_expr1, SpanningSets(V)), NotInSet(sub_expr1, LinDepSets(V))).with_wrapping_at(2)).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} \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{Bases}\left(V\right)\right) =  \\ \left(\begin{array}{c} \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{SpanningSets}\left(V\right)\right) \land  \\ \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \notin \textrm{LinDepSets}\left(V\right)\right) \end{array}\right) \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: 47
body: 4
3ExprTuple47
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 33
operands: 9
7Literal
8ExprTuple10
9ExprTuple47, 11
10Lambdaparameters: 40
body: 12
11Literal
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 22
operands: 17
15Literal
16ExprTuple18, 19
17ExprTuple20
18Operationoperator: 33
operands: 21
19Operationoperator: 22
operands: 23
20ExprRangelambda_map: 24
start_index: 46
end_index: 47
21ExprTuple36, 25
22Literal
23ExprTuple26, 27
24Lambdaparameter: 51
body: 28
25Operationoperator: 29
operand: 44
26Operationoperator: 33
operands: 30
27Operationoperator: 31
operands: 32
28Operationoperator: 33
operands: 34
29Literal
30ExprTuple36, 35
31Literal
32ExprTuple36, 37
33Literal
34ExprTuple48, 44
35Operationoperator: 38
operand: 44
36Operationoperator: 39
operands: 40
37Operationoperator: 41
operand: 44
38Literal
39Literal
40ExprTuple43
41Literal
42ExprTuple44
43ExprRangelambda_map: 45
start_index: 46
end_index: 47
44Variable
45Lambdaparameter: 51
body: 48
46Literal
47Variable
48IndexedVarvariable: 49
index: 51
49Variable
50ExprTuple51
51Variable