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 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 Equals, Forall, Implies, NotEquals
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [b, e], instance_expr = 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), domain = V, conditions = [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())
\forall_{b, e \in V~|~b = e, b \neq \vec{0}\left(V\right)}~\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}\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: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameters: 23
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operands: 8
6Operationoperator: 9
operands: 10
7Literal
8ExprTuple11, 12
9Literal
10ExprTuple13, 14, 15, 16
11Operationoperator: 22
operands: 17
12Operationoperator: 22
operands: 18
13Operationoperator: 20
operands: 19
14Operationoperator: 20
operands: 21
15Operationoperator: 22
operands: 23
16Operationoperator: 24
operands: 25
17ExprTuple26, 27
18ExprTuple28, 29
19ExprTuple38, 44
20Literal
21ExprTuple39, 44
22Literal
23ExprTuple38, 39
24Literal
25ExprTuple38, 30
26Operationoperator: 34
operands: 31
27Operationoperator: 34
operands: 32
28Operationoperator: 34
operands: 33
29Operationoperator: 34
operands: 35
30Operationoperator: 36
operand: 44
31ExprTuple40, 38, 41
32ExprTuple42, 39, 43
33ExprTuple40, 41
34Literal
35ExprTuple42, 43
36Literal
37ExprTuple44
38Variable
39Variable
40ExprRangelambda_map: 45
start_index: 50
end_index: 48
41ExprRangelambda_map: 46
start_index: 50
end_index: 51
42ExprRangelambda_map: 47
start_index: 50
end_index: 48
43ExprRangelambda_map: 49
start_index: 50
end_index: 51
44Variable
45Lambdaparameter: 61
body: 52
46Lambdaparameter: 61
body: 53
47Lambdaparameter: 61
body: 54
48Variable
49Lambdaparameter: 61
body: 55
50Literal
51Variable
52IndexedVarvariable: 56
index: 61
53IndexedVarvariable: 57
index: 61
54IndexedVarvariable: 58
index: 61
55IndexedVarvariable: 59
index: 61
56Variable
57Variable
58Variable
59Variable
60ExprTuple61
61Variable