logo

Expression of type Conditional

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 Conditional, 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 And, Equals, Forall, InSet
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = Conditional(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(), And(InSet(i, Natural), InSet(j, Natural), InSet(k, 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())
\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} \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N} ,  k \in \mathbb{N}\right..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 3
operand: 6
2Operationoperator: 20
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8, 9
6Lambdaparameters: 28
body: 10
7Operationoperator: 13
operands: 11
8Operationoperator: 13
operands: 12
9Operationoperator: 13
operands: 14
10Conditionalvalue: 15
condition: 16
11ExprTuple41, 17
12ExprTuple54, 17
13Literal
14ExprTuple43, 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17Literal
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25, 26
22Operationoperator: 38
operands: 27
23Operationoperator: 38
operands: 28
24ExprRangelambda_map: 29
start_index: 53
end_index: 41
25ExprRangelambda_map: 30
start_index: 53
end_index: 54
26ExprRangelambda_map: 31
start_index: 53
end_index: 43
27ExprTuple33, 32, 34
28ExprTuple33, 48, 34
29Lambdaparameter: 63
body: 35
30Lambdaparameter: 63
body: 36
31Lambdaparameter: 63
body: 37
32Operationoperator: 38
operands: 39
33ExprRangelambda_map: 40
start_index: 53
end_index: 41
34ExprRangelambda_map: 42
start_index: 53
end_index: 43
35Operationoperator: 46
operands: 44
36Operationoperator: 46
operands: 45
37Operationoperator: 46
operands: 47
38Literal
39ExprTuple48
40Lambdaparameter: 63
body: 49
41Variable
42Lambdaparameter: 63
body: 50
43Variable
44ExprTuple49, 51
45ExprTuple59, 51
46Literal
47ExprTuple50, 51
48ExprRangelambda_map: 52
start_index: 53
end_index: 54
49IndexedVarvariable: 55
index: 63
50IndexedVarvariable: 56
index: 63
51Operationoperator: 57
operand: 60
52Lambdaparameter: 63
body: 59
53Literal
54Variable
55Variable
56Variable
57Literal
58ExprTuple60
59IndexedVarvariable: 61
index: 63
60Variable
61Variable
62ExprTuple63
63Variable