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 Span, SpanningSets
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(n, Conditional(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(), 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(\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} \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: 40
body: 3
2ExprTuple40
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 31
operands: 8
6Literal
7ExprTuple9
8ExprTuple40, 10
9Lambdaparameters: 36
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 21
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple17, 18
15Literal
16ExprTuple19
17Operationoperator: 31
operands: 20
18Operationoperator: 21
operands: 22
19ExprRangelambda_map: 23
start_index: 39
end_index: 40
20ExprTuple33, 24
21Literal
22ExprTuple34, 25
23Lambdaparameter: 44
body: 26
24Operationoperator: 27
operand: 34
25Operationoperator: 29
operand: 33
26Operationoperator: 31
operands: 32
27Literal
28ExprTuple34
29Literal
30ExprTuple33
31Literal
32ExprTuple41, 34
33Operationoperator: 35
operands: 36
34Variable
35Literal
36ExprTuple37
37ExprRangelambda_map: 38
start_index: 39
end_index: 40
38Lambdaparameter: 44
body: 41
39Literal
40Variable
41IndexedVarvariable: 42
index: 44
42Variable
43ExprTuple44
44Variable