logo

Expression of type Forall

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, i, j, k
from proveit.core_expr_types import A_1_to_i, B_1_to_j, C_1_to_k
from proveit.linear_algebra import TensorProd, VecSpaces
from proveit.logic import Equals, Forall
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [i, j, k], instance_expr = Forall(instance_param_or_params = [A_1_to_i, B_1_to_j, C_1_to_k], instance_expr = Equals(TensorProd(A_1_to_i, TensorProd(B_1_to_j), C_1_to_k), TensorProd(A_1_to_i, B_1_to_j, C_1_to_k)).with_wrapping_at(1), domain = VecSpaces(K)).with_wrapping(), domain = Natural)
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())
\forall_{i, j, k \in \mathbb{N}}~\left[\begin{array}{l}\forall_{A_{1}, A_{2}, \ldots, A_{i}, B_{1}, B_{2}, \ldots, B_{j}, C_{1}, C_{2}, \ldots, C_{k} \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\\
\left(\begin{array}{c} \begin{array}{l} \left(A_{1} {\otimes}  A_{2} {\otimes}  \ldots {\otimes}  A_{i} {\otimes} \left(B_{1} {\otimes}  B_{2} {\otimes}  \ldots {\otimes}  B_{j}\right){\otimes} C_{1} {\otimes}  C_{2} {\otimes}  \ldots {\otimes}  C_{k}\right) \\  = \left(A_{1} {\otimes}  A_{2} {\otimes}  \ldots {\otimes}  A_{i}{\otimes} B_{1} {\otimes}  B_{2} {\otimes}  \ldots {\otimes}  B_{j}{\otimes} C_{1} {\otimes}  C_{2} {\otimes}  \ldots {\otimes}  C_{k}\right) \end{array} \end{array}\right)\end{array}\right]
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 7
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple45, 58, 47
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 24
operands: 9
7Literal
8ExprTuple10
9ExprTuple11, 12, 13
10Lambdaparameters: 32
body: 14
11Operationoperator: 17
operands: 15
12Operationoperator: 17
operands: 16
13Operationoperator: 17
operands: 18
14Conditionalvalue: 19
condition: 20
15ExprTuple45, 21
16ExprTuple58, 21
17Literal
18ExprTuple47, 21
19Operationoperator: 22
operands: 23
20Operationoperator: 24
operands: 25
21Literal
22Literal
23ExprTuple26, 27
24Literal
25ExprTuple28, 29, 30
26Operationoperator: 42
operands: 31
27Operationoperator: 42
operands: 32
28ExprRangelambda_map: 33
start_index: 57
end_index: 45
29ExprRangelambda_map: 34
start_index: 57
end_index: 58
30ExprRangelambda_map: 35
start_index: 57
end_index: 47
31ExprTuple37, 36, 38
32ExprTuple37, 52, 38
33Lambdaparameter: 67
body: 39
34Lambdaparameter: 67
body: 40
35Lambdaparameter: 67
body: 41
36Operationoperator: 42
operands: 43
37ExprRangelambda_map: 44
start_index: 57
end_index: 45
38ExprRangelambda_map: 46
start_index: 57
end_index: 47
39Operationoperator: 50
operands: 48
40Operationoperator: 50
operands: 49
41Operationoperator: 50
operands: 51
42Literal
43ExprTuple52
44Lambdaparameter: 67
body: 53
45Variable
46Lambdaparameter: 67
body: 54
47Variable
48ExprTuple53, 55
49ExprTuple63, 55
50Literal
51ExprTuple54, 55
52ExprRangelambda_map: 56
start_index: 57
end_index: 58
53IndexedVarvariable: 59
index: 67
54IndexedVarvariable: 60
index: 67
55Operationoperator: 61
operand: 64
56Lambdaparameter: 67
body: 63
57Literal
58Variable
59Variable
60Variable
61Literal
62ExprTuple64
63IndexedVarvariable: 65
index: 67
64Variable
65Variable
66ExprTuple67
67Variable