logo

Expression of type Implies

from the theory of proveit.numbers.multiplication

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 Function, Q, f
from proveit.core_expr_types import a_1_to_i, b_1_to_j, c_1_to_k
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import Complex, Mult, Sum
from proveit.numbers.summation import summation_b1toj_fQ
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [b_1_to_j]
sub_expr2 = Function(f, sub_expr1)
sub_expr3 = Function(Q, sub_expr1)
expr = Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(sub_expr2, Complex), condition = sub_expr3), Forall(instance_param_or_params = [a_1_to_i, c_1_to_k], instance_expr = Equals(Mult(a_1_to_i, summation_b1toj_fQ, c_1_to_k), Sum(index_or_indices = sub_expr1, summand = Mult(a_1_to_i, sub_expr2, c_1_to_k), condition = sub_expr3)).with_wrapping_at(2), domain = Complex).with_wrapping()).with_wrapping_at(2)
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())
\begin{array}{c} \begin{array}{l} \left[\forall_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(f\left(b_{1}, b_{2}, \ldots, b_{j}\right) \in \mathbb{C}\right)\right] \Rightarrow  \\ \left[\begin{array}{l}\forall_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{k} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right]\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) =  \\ \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right)\right] \end{array} \end{array}\right)\end{array}\right] \end{array} \end{array}
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()(2)('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4
3Operationoperator: 6
operand: 8
4Operationoperator: 6
operand: 9
5ExprTuple8
6Literal
7ExprTuple9
8Lambdaparameters: 53
body: 10
9Lambdaparameters: 11
body: 12
10Conditionalvalue: 13
condition: 45
11ExprTuple46, 48
12Conditionalvalue: 14
condition: 15
13Operationoperator: 37
operands: 16
14Operationoperator: 17
operands: 18
15Operationoperator: 19
operands: 20
16ExprTuple47, 41
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple23, 24
21Operationoperator: 43
operands: 25
22Operationoperator: 33
operand: 30
23ExprRangelambda_map: 27
start_index: 61
end_index: 51
24ExprRangelambda_map: 28
start_index: 61
end_index: 55
25ExprTuple46, 29, 48
26ExprTuple30
27Lambdaparameter: 67
body: 31
28Lambdaparameter: 67
body: 32
29Operationoperator: 33
operand: 39
30Lambdaparameters: 53
body: 35
31Operationoperator: 37
operands: 36
32Operationoperator: 37
operands: 38
33Literal
34ExprTuple39
35Conditionalvalue: 40
condition: 45
36ExprTuple56, 41
37Literal
38ExprTuple58, 41
39Lambdaparameters: 53
body: 42
40Operationoperator: 43
operands: 44
41Literal
42Conditionalvalue: 47
condition: 45
43Literal
44ExprTuple46, 47, 48
45Operationoperator: 49
operands: 53
46ExprRangelambda_map: 50
start_index: 61
end_index: 51
47Operationoperator: 52
operands: 53
48ExprRangelambda_map: 54
start_index: 61
end_index: 55
49Variable
50Lambdaparameter: 67
body: 56
51Variable
52Variable
53ExprTuple57
54Lambdaparameter: 67
body: 58
55Variable
56IndexedVarvariable: 59
index: 67
57ExprRangelambda_map: 60
start_index: 61
end_index: 62
58IndexedVarvariable: 63
index: 67
59Variable
60Lambdaparameter: 67
body: 64
61Literal
62Variable
63Variable
64IndexedVarvariable: 65
index: 67
65Variable
66ExprTuple67
67Variable