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, K, Lambda, V, n
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import Bases, LinDepSets, SpanningSets, VecSpaces
from proveit.logic import And, Equals, Forall, InClass, 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(V, Conditional(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), InClass(V, 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())
\left(V \mapsto \left\{\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] \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)\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: 54
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 17
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple54, 9
8Lambdaparameter: 57
body: 11
9Operationoperator: 12
operand: 16
10ExprTuple57
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple16
14Operationoperator: 17
operand: 20
15Operationoperator: 43
operands: 19
16Variable
17Literal
18ExprTuple20
19ExprTuple57, 21
20Lambdaparameters: 50
body: 22
21Literal
22Conditionalvalue: 23
condition: 24
23Operationoperator: 25
operands: 26
24Operationoperator: 32
operands: 27
25Literal
26ExprTuple28, 29
27ExprTuple30
28Operationoperator: 43
operands: 31
29Operationoperator: 32
operands: 33
30ExprRangelambda_map: 34
start_index: 56
end_index: 57
31ExprTuple46, 35
32Literal
33ExprTuple36, 37
34Lambdaparameter: 61
body: 38
35Operationoperator: 39
operand: 54
36Operationoperator: 43
operands: 40
37Operationoperator: 41
operands: 42
38Operationoperator: 43
operands: 44
39Literal
40ExprTuple46, 45
41Literal
42ExprTuple46, 47
43Literal
44ExprTuple58, 54
45Operationoperator: 48
operand: 54
46Operationoperator: 49
operands: 50
47Operationoperator: 51
operand: 54
48Literal
49Literal
50ExprTuple53
51Literal
52ExprTuple54
53ExprRangelambda_map: 55
start_index: 56
end_index: 57
54Variable
55Lambdaparameter: 61
body: 58
56Literal
57Variable
58IndexedVarvariable: 59
index: 61
59Variable
60ExprTuple61
61Variable