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, e
from proveit.core_expr_types import a_1_to_i, c_1_to_k, d_1_to_i, f_1_to_k
from proveit.linear_algebra import TensorProd, VecZero
from proveit.logic import And, Equals, Implies, InSet, NotEquals
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Implies(Equals(TensorProd(a_1_to_i, b, c_1_to_k), TensorProd(d_1_to_i, e, f_1_to_k)).with_wrapping_at(2), Equals(TensorProd(a_1_to_i, c_1_to_k), TensorProd(d_1_to_i, f_1_to_k)).with_wrapping_at(2)).with_wrapping_at(2), And(InSet(b, V), InSet(e, V), Equals(b, e), NotEquals(b, VecZero(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} 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} e{\otimes} f_{1} {\otimes}  f_{2} {\otimes}  \ldots {\otimes}  f_{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} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) =  \\ \left(d_{1} {\otimes}  d_{2} {\otimes}  \ldots {\otimes}  d_{i}{\otimes} f_{1} {\otimes}  f_{2} {\otimes}  \ldots {\otimes}  f_{k}\right) \end{array} \end{array}\right) \end{array} \end{array} \textrm{ if } b \in V ,  e \in V ,  b = e ,  b \neq \vec{0}\left(V\right)\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
6ExprTuple9, 10, 11, 12
7Operationoperator: 18
operands: 13
8Operationoperator: 18
operands: 14
9Operationoperator: 16
operands: 15
10Operationoperator: 16
operands: 17
11Operationoperator: 18
operands: 19
12Operationoperator: 20
operands: 21
13ExprTuple22, 23
14ExprTuple24, 25
15ExprTuple34, 40
16Literal
17ExprTuple35, 40
18Literal
19ExprTuple34, 35
20Literal
21ExprTuple34, 26
22Operationoperator: 30
operands: 27
23Operationoperator: 30
operands: 28
24Operationoperator: 30
operands: 29
25Operationoperator: 30
operands: 31
26Operationoperator: 32
operand: 40
27ExprTuple36, 34, 37
28ExprTuple38, 35, 39
29ExprTuple36, 37
30Literal
31ExprTuple38, 39
32Literal
33ExprTuple40
34Variable
35Variable
36ExprRangelambda_map: 41
start_index: 46
end_index: 44
37ExprRangelambda_map: 42
start_index: 46
end_index: 47
38ExprRangelambda_map: 43
start_index: 46
end_index: 44
39ExprRangelambda_map: 45
start_index: 46
end_index: 47
40Variable
41Lambdaparameter: 57
body: 48
42Lambdaparameter: 57
body: 49
43Lambdaparameter: 57
body: 50
44Variable
45Lambdaparameter: 57
body: 51
46Literal
47Variable
48IndexedVarvariable: 52
index: 57
49IndexedVarvariable: 53
index: 57
50IndexedVarvariable: 54
index: 57
51IndexedVarvariable: 55
index: 57
52Variable
53Variable
54Variable
55Variable
56ExprTuple57
57Variable