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
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
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Set(x_1_to_n)
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()
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} \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}
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: 32
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operands: 8
6Operationoperator: 14
operands: 9
7Literal
8ExprTuple10, 11
9ExprTuple12
10Operationoperator: 25
operands: 13
11Operationoperator: 14
operands: 15
12ExprRangelambda_map: 16
start_index: 38
end_index: 39
13ExprTuple28, 17
14Literal
15ExprTuple18, 19
16Lambdaparameter: 43
body: 20
17Operationoperator: 21
operand: 36
18Operationoperator: 25
operands: 22
19Operationoperator: 23
operands: 24
20Operationoperator: 25
operands: 26
21Literal
22ExprTuple28, 27
23Literal
24ExprTuple28, 29
25Literal
26ExprTuple40, 36
27Operationoperator: 30
operand: 36
28Operationoperator: 31
operands: 32
29Operationoperator: 33
operand: 36
30Literal
31Literal
32ExprTuple35
33Literal
34ExprTuple36
35ExprRangelambda_map: 37
start_index: 38
end_index: 39
36Variable
37Lambdaparameter: 43
body: 40
38Literal
39Variable
40IndexedVarvariable: 41
index: 43
41Variable
42ExprTuple43
43Variable