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 i, m, n, x
from proveit.logic import And, Equals, Forall, Implies, TRUE
from proveit.numbers import Add, Exp, Interval, Natural, Sum, frac, one, subtract, two, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [i]
sub_expr2 = Exp(x, i)
sub_expr3 = Add(m, one)
sub_expr4 = subtract(one, x)
expr = Implies(And(TRUE, Forall(instance_param_or_params = [m], instance_expr = Equals(Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = Interval(zero, sub_expr3)), frac(subtract(one, Exp(x, Add(m, two))), sub_expr4)), domain = Natural, condition = Equals(Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = Interval(zero, m)), frac(subtract(one, Exp(x, sub_expr3)), sub_expr4)))), Forall(instance_param_or_params = [n], instance_expr = Equals(Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = Interval(zero, n)), frac(subtract(one, Exp(x, Add(n, one))), sub_expr4)), domain = Natural))
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(\top \land \left[\forall_{m \in \mathbb{N}~|~\left(\sum_{i = 0}^{m} x^{i}\right) = \frac{1 - x^{m + 1}}{1 - x}}~\left(\left(\sum_{i = 0}^{m + 1} x^{i}\right) = \frac{1 - x^{m + 2}}{1 - x}\right)\right]\right) \Rightarrow \left[\forall_{n \in \mathbb{N}}~\left(\left(\sum_{i = 0}^{n} x^{i}\right) = \frac{1 - x^{n + 1}}{1 - x}\right)\right]
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.()()('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: 26
operands: 5
4Operationoperator: 10
operand: 9
5ExprTuple7, 8
6ExprTuple9
7Literal
8Operationoperator: 10
operand: 14
9Lambdaparameter: 93
body: 13
10Literal
11ExprTuple14
12ExprTuple93
13Conditionalvalue: 15
condition: 16
14Lambdaparameter: 105
body: 18
15Operationoperator: 39
operands: 19
16Operationoperator: 83
operands: 20
17ExprTuple105
18Conditionalvalue: 21
condition: 22
19ExprTuple23, 24
20ExprTuple93, 45
21Operationoperator: 39
operands: 25
22Operationoperator: 26
operands: 27
23Operationoperator: 52
operand: 34
24Operationoperator: 54
operands: 29
25ExprTuple30, 31
26Literal
27ExprTuple32, 33
28ExprTuple34
29ExprTuple35, 62
30Operationoperator: 52
operand: 43
31Operationoperator: 54
operands: 37
32Operationoperator: 83
operands: 38
33Operationoperator: 39
operands: 40
34Lambdaparameter: 90
body: 41
35Operationoperator: 103
operands: 42
36ExprTuple43
37ExprTuple44, 62
38ExprTuple105, 45
39Literal
40ExprTuple46, 47
41Conditionalvalue: 75
condition: 48
42ExprTuple106, 49
43Lambdaparameter: 90
body: 50
44Operationoperator: 103
operands: 51
45Literal
46Operationoperator: 52
operand: 60
47Operationoperator: 54
operands: 55
48Operationoperator: 83
operands: 56
49Operationoperator: 86
operand: 64
50Conditionalvalue: 75
condition: 58
51ExprTuple106, 59
52Literal
53ExprTuple60
54Literal
55ExprTuple61, 62
56ExprTuple90, 63
57ExprTuple64
58Operationoperator: 83
operands: 65
59Operationoperator: 86
operand: 74
60Lambdaparameter: 90
body: 68
61Operationoperator: 103
operands: 69
62Operationoperator: 103
operands: 70
63Operationoperator: 95
operands: 71
64Operationoperator: 97
operands: 72
65ExprTuple90, 73
66ExprTuple74
67ExprTuple90
68Conditionalvalue: 75
condition: 76
69ExprTuple106, 77
70ExprTuple106, 78
71ExprTuple100, 93
72ExprTuple101, 79
73Operationoperator: 95
operands: 80
74Operationoperator: 97
operands: 81
75Operationoperator: 97
operands: 82
76Operationoperator: 83
operands: 84
77Operationoperator: 86
operand: 92
78Operationoperator: 86
operand: 101
79Operationoperator: 103
operands: 88
80ExprTuple100, 102
81ExprTuple101, 89
82ExprTuple101, 90
83Literal
84ExprTuple90, 91
85ExprTuple92
86Literal
87ExprTuple101
88ExprTuple93, 106
89Operationoperator: 103
operands: 94
90Variable
91Operationoperator: 95
operands: 96
92Operationoperator: 97
operands: 98
93Variable
94ExprTuple105, 99
95Literal
96ExprTuple100, 105
97Literal
98ExprTuple101, 102
99Literal
100Literal
101Variable
102Operationoperator: 103
operands: 104
103Literal
104ExprTuple105, 106
105Variable
106Literal