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 ExprTuple, K, Lambda, i
from proveit.core_expr_types import V_1_to_i, a_1_to_i
from proveit.linear_algebra import TensorProd, VecSpaces
from proveit.logic import Forall, InSet
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [V_1_to_i]
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [i], instance_expr = Forall(instance_param_or_params = sub_expr1, instance_expr = Forall(instance_param_or_params = [a_1_to_i], instance_expr = InSet(TensorProd(a_1_to_i), TensorProd(V_1_to_i)), domains = sub_expr1), 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())
\left(K \mapsto \left[\forall_{i \in \mathbb{N}^+}~\left[\forall_{V_{1}, V_{2}, \ldots, V_{i} \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{\left(a_{1} \in V_{1}\right), \left(a_{2} \in V_{2}\right), \ldots, \left(a_{i} \in V_{i}\right)}~\left(\left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i}\right) \in \left(V_{1} {\otimes}  V_{2} {\otimes}  \ldots {\otimes}  V_{i}\right)\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: 44
body: 2
2Operationoperator: 16
operand: 4
3ExprTuple4
4Lambdaparameter: 48
body: 6
5ExprTuple48
6Conditionalvalue: 7
condition: 8
7Operationoperator: 16
operand: 11
8Operationoperator: 49
operands: 10
9ExprTuple11
10ExprTuple48, 12
11Lambdaparameters: 37
body: 13
12Literal
13Conditionalvalue: 14
condition: 15
14Operationoperator: 16
operand: 19
15Operationoperator: 27
operands: 18
16Literal
17ExprTuple19
18ExprTuple20
19Lambdaparameters: 35
body: 21
20ExprRangelambda_map: 22
start_index: 47
end_index: 48
21Conditionalvalue: 23
condition: 24
22Lambdaparameter: 56
body: 25
23Operationoperator: 49
operands: 26
24Operationoperator: 27
operands: 28
25Operationoperator: 29
operands: 30
26ExprTuple31, 32
27Literal
28ExprTuple33
29Literal
30ExprTuple52, 34
31Operationoperator: 36
operands: 35
32Operationoperator: 36
operands: 37
33ExprRangelambda_map: 38
start_index: 47
end_index: 48
34Operationoperator: 39
operand: 44
35ExprTuple41
36Literal
37ExprTuple42
38Lambdaparameter: 56
body: 43
39Literal
40ExprTuple44
41ExprRangelambda_map: 45
start_index: 47
end_index: 48
42ExprRangelambda_map: 46
start_index: 47
end_index: 48
43Operationoperator: 49
operands: 50
44Variable
45Lambdaparameter: 56
body: 51
46Lambdaparameter: 56
body: 52
47Literal
48Variable
49Literal
50ExprTuple51, 52
51IndexedVarvariable: 53
index: 56
52IndexedVarvariable: 54
index: 56
53Variable
54Variable
55ExprTuple56
56Variable