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, Dim
from proveit.logic import Equals, Forall, InSet, Set
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(n, Conditional(Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(Dim(V), n), condition = InSet(Set(x_1_to_n), Bases(V))), 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\{\forall_{x_{1}, x_{2}, \ldots, x_{n}~|~\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{Bases}\left(V\right)}~\left(\textrm{Dim}\left(V\right) = n\right) \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: 30
body: 3
2ExprTuple30
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 16
operands: 8
6Literal
7ExprTuple9
8ExprTuple30, 10
9Lambdaparameters: 23
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18, 30
16Literal
17ExprTuple19, 20
18Operationoperator: 21
operand: 27
19Operationoperator: 22
operands: 23
20Operationoperator: 24
operand: 27
21Literal
22Literal
23ExprTuple26
24Literal
25ExprTuple27
26ExprRangelambda_map: 28
start_index: 29
end_index: 30
27Variable
28Lambdaparameter: 34
body: 31
29Literal
30Variable
31IndexedVarvariable: 32
index: 34
32Variable
33ExprTuple34
34Variable