logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.tensors

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 ExprRange, ExprTuple, IndexedVar, K, Lambda, Variable, m, n
from proveit.core_expr_types import n_1_to_m
from proveit.linear_algebra import TensorProd
from proveit.logic import CartExp, Forall, SubsetEq
from proveit.numbers import Mult, NaturalPos, one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [m], instance_expr = Forall(instance_param_or_params = [n_1_to_m], instance_expr = SubsetEq(TensorProd(ExprRange(sub_expr1, CartExp(K, IndexedVar(n, sub_expr1)), one, m)), CartExp(K, Mult(n_1_to_m))), domain = NaturalPos), domain = 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(K \mapsto \left[\forall_{m \in \mathbb{N}^+}~\left[\forall_{n_{1}, n_{2}, \ldots, n_{m} \in \mathbb{N}^+}~\left(\left(K^{n_{1}} {\otimes}  K^{n_{2}} {\otimes}  \ldots {\otimes}  K^{n_{m}}\right) \subseteq K^{n_{1} \cdot  n_{2} \cdot  \ldots \cdot  n_{m}}\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: 44
body: 3
2ExprTuple44
3Operationoperator: 10
operand: 5
4ExprTuple5
5Lambdaparameter: 43
body: 7
6ExprTuple43
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operand: 13
9Operationoperator: 34
operands: 12
10Literal
11ExprTuple13
12ExprTuple43, 38
13Lambdaparameters: 33
body: 14
14Conditionalvalue: 15
condition: 16
15Operationoperator: 17
operands: 18
16Operationoperator: 19
operands: 20
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple23
21Operationoperator: 24
operands: 25
22Operationoperator: 39
operands: 26
23ExprRangelambda_map: 27
start_index: 42
end_index: 43
24Literal
25ExprTuple28
26ExprTuple44, 29
27Lambdaparameter: 48
body: 30
28ExprRangelambda_map: 31
start_index: 42
end_index: 43
29Operationoperator: 32
operands: 33
30Operationoperator: 34
operands: 35
31Lambdaparameter: 48
body: 36
32Literal
33ExprTuple37
34Literal
35ExprTuple45, 38
36Operationoperator: 39
operands: 40
37ExprRangelambda_map: 41
start_index: 42
end_index: 43
38Literal
39Literal
40ExprTuple44, 45
41Lambdaparameter: 48
body: 45
42Literal
43Variable
44Variable
45IndexedVarvariable: 46
index: 48
46Variable
47ExprTuple48
48Variable