logo

Expression of type Implies

from the theory of proveit.numbers.summation

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 ExprRange, IndexedVar, Variable, a, c, l
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import Add, Complex, Integer, Mult, Sum, one, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = [l]
sub_expr3 = Add(l, one)
sub_expr4 = IndexedVar(c, one)
sub_expr5 = ExprRange(sub_expr1, IndexedVar(a, sub_expr1), one, zero)
expr = Implies(Forall(instance_param_or_params = sub_expr2, instance_expr = InSet(sub_expr3, Complex), domain = Integer), Forall(instance_param_or_params = [sub_expr5, sub_expr4], instance_expr = Equals(Mult(sub_expr5, Sum(index_or_indices = sub_expr2, summand = sub_expr3, domain = Integer), sub_expr4), Sum(index_or_indices = sub_expr2, summand = Mult(sub_expr5, sub_expr3, sub_expr4), domain = Integer)).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_{l \in \mathbb{Z}}~\left(\left(l + 1\right) \in \mathbb{C}\right)\right] \Rightarrow  \\ \left[\begin{array}{l}\forall_{a_{1}, a_{2}, \ldots, a_{0}, c_{1} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{0} \cdot \left[\sum_{l \in \mathbb{Z}}~\left(l + 1\right)\right] \cdot c_{1}\right) =  \\ \left[\sum_{l \in \mathbb{Z}}~\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{0} \cdot \left(l + 1\right) \cdot c_{1}\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
8Lambdaparameter: 57
body: 10
9Lambdaparameters: 11
body: 12
10Conditionalvalue: 13
condition: 43
11ExprTuple44, 46
12Conditionalvalue: 14
condition: 15
13Operationoperator: 47
operands: 16
14Operationoperator: 17
operands: 18
15Operationoperator: 19
operands: 20
16ExprTuple45, 38
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple23, 24
21Operationoperator: 41
operands: 25
22Operationoperator: 32
operand: 30
23ExprRangelambda_map: 27
start_index: 58
end_index: 50
24Operationoperator: 47
operands: 28
25ExprTuple44, 29, 46
26ExprTuple30
27Lambdaparameter: 61
body: 31
28ExprTuple46, 38
29Operationoperator: 32
operand: 36
30Lambdaparameter: 57
body: 34
31Operationoperator: 47
operands: 35
32Literal
33ExprTuple36
34Conditionalvalue: 37
condition: 43
35ExprTuple56, 38
36Lambdaparameter: 57
body: 40
37Operationoperator: 41
operands: 42
38Literal
39ExprTuple57
40Conditionalvalue: 45
condition: 43
41Literal
42ExprTuple44, 45, 46
43Operationoperator: 47
operands: 48
44ExprRangelambda_map: 49
start_index: 58
end_index: 50
45Operationoperator: 51
operands: 52
46IndexedVarvariable: 53
index: 58
47Literal
48ExprTuple57, 55
49Lambdaparameter: 61
body: 56
50Literal
51Literal
52ExprTuple57, 58
53Variable
54ExprTuple58
55Literal
56IndexedVarvariable: 59
index: 61
57Variable
58Literal
59Variable
60ExprTuple61
61Variable