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, V, b
from proveit.core_expr_types import a_1_to_i, c_1_to_k, d_1_to_i, e_1_to_k
from proveit.linear_algebra import TensorProd
from proveit.logic import Equals, Implies, InSet
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Implies(Equals(TensorProd(a_1_to_i, c_1_to_k), TensorProd(d_1_to_i, e_1_to_k)).with_wrapping_at(2), Equals(TensorProd(a_1_to_i, b, c_1_to_k), TensorProd(d_1_to_i, b, e_1_to_k)).with_wrapping_at(2)).with_wrapping_at(2), InSet(b, V))
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}{c} \begin{array}{l} \left(\begin{array}{c} \begin{array}{l} \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i}{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) =  \\ \left(d_{1} {\otimes}  d_{2} {\otimes}  \ldots {\otimes}  d_{i}{\otimes} e_{1} {\otimes}  e_{2} {\otimes}  \ldots {\otimes}  e_{k}\right) \end{array} \end{array}\right) \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} b{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) =  \\ \left(d_{1} {\otimes}  d_{2} {\otimes}  \ldots {\otimes}  d_{i} {\otimes} b{\otimes} e_{1} {\otimes}  e_{2} {\otimes}  \ldots {\otimes}  e_{k}\right) \end{array} \end{array}\right) \end{array} \end{array} \textrm{ if } b \in V\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
operands: 4
2Operationoperator: 5
operands: 6
3Literal
4ExprTuple7, 8
5Literal
6ExprTuple25, 9
7Operationoperator: 11
operands: 10
8Operationoperator: 11
operands: 12
9Variable
10ExprTuple13, 14
11Literal
12ExprTuple15, 16
13Operationoperator: 20
operands: 17
14Operationoperator: 20
operands: 18
15Operationoperator: 20
operands: 19
16Operationoperator: 20
operands: 21
17ExprTuple22, 23
18ExprTuple24, 26
19ExprTuple22, 25, 23
20Literal
21ExprTuple24, 25, 26
22ExprRangelambda_map: 27
start_index: 32
end_index: 30
23ExprRangelambda_map: 28
start_index: 32
end_index: 33
24ExprRangelambda_map: 29
start_index: 32
end_index: 30
25Variable
26ExprRangelambda_map: 31
start_index: 32
end_index: 33
27Lambdaparameter: 43
body: 34
28Lambdaparameter: 43
body: 35
29Lambdaparameter: 43
body: 36
30Variable
31Lambdaparameter: 43
body: 37
32Literal
33Variable
34IndexedVarvariable: 38
index: 43
35IndexedVarvariable: 39
index: 43
36IndexedVarvariable: 40
index: 43
37IndexedVarvariable: 41
index: 43
38Variable
39Variable
40Variable
41Variable
42ExprTuple43
43Variable