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, Dim, VecSpaces
from proveit.logic import Equals, Forall, InClass, InSet, Set
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
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(Dim(V), n), condition = InSet(Set(x_1_to_n), Bases(V))), 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[\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)\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: 38
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 17
operand: 8
4Operationoperator: 6
operands: 7
5ExprTuple8
6Literal
7ExprTuple38, 9
8Lambdaparameter: 41
body: 11
9Operationoperator: 12
operand: 16
10ExprTuple41
11Conditionalvalue: 14
condition: 15
12Literal
13ExprTuple16
14Operationoperator: 17
operand: 20
15Operationoperator: 27
operands: 19
16Variable
17Literal
18ExprTuple20
19ExprTuple41, 21
20Lambdaparameters: 34
body: 22
21Literal
22Conditionalvalue: 23
condition: 24
23Operationoperator: 25
operands: 26
24Operationoperator: 27
operands: 28
25Literal
26ExprTuple29, 41
27Literal
28ExprTuple30, 31
29Operationoperator: 32
operand: 38
30Operationoperator: 33
operands: 34
31Operationoperator: 35
operand: 38
32Literal
33Literal
34ExprTuple37
35Literal
36ExprTuple38
37ExprRangelambda_map: 39
start_index: 40
end_index: 41
38Variable
39Lambdaparameter: 45
body: 42
40Literal
41Variable
42IndexedVarvariable: 43
index: 45
43Variable
44ExprTuple45
45Variable