# 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.
# 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, Dim
from proveit.logic import Equals, Forall, InSet, Set
from proveit.numbers import NaturalPos

In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(Dim(V), n), condition = InSet(Set(x_1_to_n), Bases(V))), 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[\forall_{x_{1}, x_{2}, \ldots, x_{n}~|~\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{Bases}\left(V\right)}~\left(\textrm{Dim}\left(V\right) = n\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: 7
operand: 2
1ExprTuple2
2Lambdaparameter: 31
body: 4
3ExprTuple31
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 17
operands: 9
7Literal
8ExprTuple10
9ExprTuple31, 11
10Lambdaparameters: 24
body: 12
11Literal
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 31
17Literal
18ExprTuple20, 21
19Operationoperator: 22
operand: 28
20Operationoperator: 23
operands: 24
21Operationoperator: 25
operand: 28
22Literal
23Literal
24ExprTuple27
25Literal
26ExprTuple28
27ExprRangelambda_map: 29
start_index: 30
end_index: 31
28Variable
29Lambdaparameter: 35
body: 32
30Literal
31Variable
32IndexedVarvariable: 33
index: 35
33Variable
34ExprTuple35
35Variable