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 Span, SpanningSets, VecSpaces
from proveit.logic import Equals, Forall, InClass, 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(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, SpanningSets(V)), Equals(V, Span(sub_expr1))), 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(\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] \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: 45
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 17
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple45, 9
8Lambdaparameter: 51
body: 11
9Operationoperator: 12
operand: 16
10ExprTuple51
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple16
14Operationoperator: 17
operand: 20
15Operationoperator: 42
operands: 19
16Variable
17Literal
18ExprTuple20
19ExprTuple51, 21
20Lambdaparameters: 47
body: 22
21Literal
22Conditionalvalue: 23
condition: 24
23Operationoperator: 32
operands: 25
24Operationoperator: 26
operands: 27
25ExprTuple28, 29
26Literal
27ExprTuple30
28Operationoperator: 42
operands: 31
29Operationoperator: 32
operands: 33
30ExprRangelambda_map: 34
start_index: 50
end_index: 51
31ExprTuple44, 35
32Literal
33ExprTuple45, 36
34Lambdaparameter: 55
body: 37
35Operationoperator: 38
operand: 45
36Operationoperator: 40
operand: 44
37Operationoperator: 42
operands: 43
38Literal
39ExprTuple45
40Literal
41ExprTuple44
42Literal
43ExprTuple52, 45
44Operationoperator: 46
operands: 47
45Variable
46Literal
47ExprTuple48
48ExprRangelambda_map: 49
start_index: 50
end_index: 51
49Lambdaparameter: 55
body: 52
50Literal
51Variable
52IndexedVarvariable: 53
index: 55
53Variable
54ExprTuple55
55Variable