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(a, one)
sub_expr5 = ExprRange(sub_expr1, IndexedVar(c, 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_expr4, sub_expr5], instance_expr = Equals(Mult(sub_expr4, Sum(index_or_indices = sub_expr2, summand = sub_expr3, domain = Integer), sub_expr5), Sum(index_or_indices = sub_expr2, summand = Mult(sub_expr4, sub_expr3, sub_expr5), 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}, c_{1}, c_{2}, \ldots, c_{0} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot \left[\sum_{l \in \mathbb{Z}}~\left(l + 1\right)\right]\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{0}\right) =  \\ \left[\sum_{l \in \mathbb{Z}}~\left(a_{1} \cdot \left(l + 1\right)\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{0}\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: 56
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
23Operationoperator: 47
operands: 27
24ExprRangelambda_map: 28
start_index: 57
end_index: 54
25ExprTuple44, 29, 46
26ExprTuple30
27ExprTuple44, 38
28Lambdaparameter: 61
body: 31
29Operationoperator: 32
operand: 36
30Lambdaparameter: 56
body: 34
31Operationoperator: 47
operands: 35
32Literal
33ExprTuple36
34Conditionalvalue: 37
condition: 43
35ExprTuple58, 38
36Lambdaparameter: 56
body: 40
37Operationoperator: 41
operands: 42
38Literal
39ExprTuple56
40Conditionalvalue: 45
condition: 43
41Literal
42ExprTuple44, 45, 46
43Operationoperator: 47
operands: 48
44IndexedVarvariable: 49
index: 57
45Operationoperator: 51
operands: 52
46ExprRangelambda_map: 53
start_index: 57
end_index: 54
47Literal
48ExprTuple56, 55
49Variable
50ExprTuple57
51Literal
52ExprTuple56, 57
53Lambdaparameter: 61
body: 58
54Literal
55Literal
56Variable
57Literal
58IndexedVarvariable: 59
index: 61
59Variable
60ExprTuple61
61Variable