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 K, Lambda, V, n
from proveit.linear_algebra import TensorExp, VecSpaces
from proveit.logic import CartExp, Forall, SubsetEq
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Lambda(K, Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [V], instance_expr = SubsetEq(TensorExp(V, n), CartExp(V, n)), domain = VecSpaces(K)), 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_{n \in \mathbb{N}^+}~\left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left(V^{\otimes n} \subseteq V^{n}\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: 32
body: 1
1Operationoperator: 8
operand: 3
2ExprTuple3
3Lambdaparameter: 31
body: 5
4ExprTuple31
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 12
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12
10Literal
11ExprTuple31, 13
12Lambdaparameter: 30
body: 15
13Literal
14ExprTuple30
15Conditionalvalue: 16
condition: 17
16Operationoperator: 18
operands: 19
17Operationoperator: 20
operands: 21
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple30, 24
22Operationoperator: 25
operands: 27
23Operationoperator: 26
operands: 27
24Operationoperator: 28
operand: 32
25Literal
26Literal
27ExprTuple30, 31
28Literal
29ExprTuple32
30Variable
31Variable
32Variable