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 Bases, Dim, VecSpaces
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(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(Dim(V), n), condition = InSet(Set(x_1_to_n), Bases(V))), 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[\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]\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: 41
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 20
operand: 11
7Operationoperator: 9
operands: 10
8ExprTuple11
9Literal
10ExprTuple41, 12
11Lambdaparameter: 44
body: 14
12Operationoperator: 15
operand: 19
13ExprTuple44
14Conditionalvalue: 17
condition: 18
15Literal
16ExprTuple19
17Operationoperator: 20
operand: 23
18Operationoperator: 30
operands: 22
19Variable
20Literal
21ExprTuple23
22ExprTuple44, 24
23Lambdaparameters: 37
body: 25
24Literal
25Conditionalvalue: 26
condition: 27
26Operationoperator: 28
operands: 29
27Operationoperator: 30
operands: 31
28Literal
29ExprTuple32, 44
30Literal
31ExprTuple33, 34
32Operationoperator: 35
operand: 41
33Operationoperator: 36
operands: 37
34Operationoperator: 38
operand: 41
35Literal
36Literal
37ExprTuple40
38Literal
39ExprTuple41
40ExprRangelambda_map: 42
start_index: 43
end_index: 44
41Variable
42Lambdaparameter: 48
body: 45
43Literal
44Variable
45IndexedVarvariable: 46
index: 48
46Variable
47ExprTuple48
48Variable