logo

Expression of type Lambda

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, 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 = 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())
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]
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 43
body: 2
1ExprTuple43
2Operationoperator: 9
operand: 4
3ExprTuple4
4Lambdaparameter: 42
body: 6
5ExprTuple42
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 12
8Operationoperator: 33
operands: 11
9Literal
10ExprTuple12
11ExprTuple42, 37
12Lambdaparameters: 32
body: 13
13Conditionalvalue: 14
condition: 15
14Operationoperator: 16
operands: 17
15Operationoperator: 18
operands: 19
16Literal
17ExprTuple20, 21
18Literal
19ExprTuple22
20Operationoperator: 23
operands: 24
21Operationoperator: 38
operands: 25
22ExprRangelambda_map: 26
start_index: 41
end_index: 42
23Literal
24ExprTuple27
25ExprTuple43, 28
26Lambdaparameter: 47
body: 29
27ExprRangelambda_map: 30
start_index: 41
end_index: 42
28Operationoperator: 31
operands: 32
29Operationoperator: 33
operands: 34
30Lambdaparameter: 47
body: 35
31Literal
32ExprTuple36
33Literal
34ExprTuple44, 37
35Operationoperator: 38
operands: 39
36ExprRangelambda_map: 40
start_index: 41
end_index: 42
37Literal
38Literal
39ExprTuple43, 44
40Lambdaparameter: 47
body: 44
41Literal
42Variable
43Variable
44IndexedVarvariable: 45
index: 47
45Variable
46ExprTuple47
47Variable