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 ExprTuple, K, Lambda, V, n
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import Span, SpanningSets, VecSpaces
from proveit.logic import Equals, Forall, InSet, 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(K, Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(InSet(sub_expr1, SpanningSets(V)), Equals(V, Span(sub_expr1))), domain = V).with_wrapping(), domain = NaturalPos), domain = 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(K \mapsto \left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{n \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{x_{1}, x_{2}, \ldots, x_{n} \in V}~\\
\left(\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{SpanningSets}\left(V\right)\right) = \left(V = \textrm{Span}\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\}\right)\right)\right)\end{array}\right]\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: 19
body: 2
2Operationoperator: 20
operand: 4
3ExprTuple4
4Lambdaparameter: 48
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 20
operand: 11
7Operationoperator: 9
operands: 10
8ExprTuple11
9Literal
10ExprTuple48, 12
11Lambdaparameter: 54
body: 14
12Operationoperator: 15
operand: 19
13ExprTuple54
14Conditionalvalue: 17
condition: 18
15Literal
16ExprTuple19
17Operationoperator: 20
operand: 23
18Operationoperator: 45
operands: 22
19Variable
20Literal
21ExprTuple23
22ExprTuple54, 24
23Lambdaparameters: 50
body: 25
24Literal
25Conditionalvalue: 26
condition: 27
26Operationoperator: 35
operands: 28
27Operationoperator: 29
operands: 30
28ExprTuple31, 32
29Literal
30ExprTuple33
31Operationoperator: 45
operands: 34
32Operationoperator: 35
operands: 36
33ExprRangelambda_map: 37
start_index: 53
end_index: 54
34ExprTuple47, 38
35Literal
36ExprTuple48, 39
37Lambdaparameter: 58
body: 40
38Operationoperator: 41
operand: 48
39Operationoperator: 43
operand: 47
40Operationoperator: 45
operands: 46
41Literal
42ExprTuple48
43Literal
44ExprTuple47
45Literal
46ExprTuple55, 48
47Operationoperator: 49
operands: 50
48Variable
49Literal
50ExprTuple51
51ExprRangelambda_map: 52
start_index: 53
end_index: 54
52Lambdaparameter: 58
body: 55
53Literal
54Variable
55IndexedVarvariable: 56
index: 58
56Variable
57ExprTuple58
58Variable