logo

Expression of type ExprTuple

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 Conditional, ExprTuple, Lambda, 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 = ExprTuple(Lambda(n, Conditional(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(), InSet(n, 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())
\left(n \mapsto \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} \textrm{ if } n \in \mathbb{N}^+\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 46
body: 3
2ExprTuple46
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 32
operands: 8
6Literal
7ExprTuple9
8ExprTuple46, 10
9Lambdaparameters: 39
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 21
operands: 16
14Literal
15ExprTuple17, 18
16ExprTuple19
17Operationoperator: 32
operands: 20
18Operationoperator: 21
operands: 22
19ExprRangelambda_map: 23
start_index: 45
end_index: 46
20ExprTuple35, 24
21Literal
22ExprTuple25, 26
23Lambdaparameter: 50
body: 27
24Operationoperator: 28
operand: 43
25Operationoperator: 32
operands: 29
26Operationoperator: 30
operands: 31
27Operationoperator: 32
operands: 33
28Literal
29ExprTuple35, 34
30Literal
31ExprTuple35, 36
32Literal
33ExprTuple47, 43
34Operationoperator: 37
operand: 43
35Operationoperator: 38
operands: 39
36Operationoperator: 40
operand: 43
37Literal
38Literal
39ExprTuple42
40Literal
41ExprTuple43
42ExprRangelambda_map: 44
start_index: 45
end_index: 46
43Variable
44Lambdaparameter: 50
body: 47
45Literal
46Variable
47IndexedVarvariable: 48
index: 50
48Variable
49ExprTuple50
50Variable