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 Function, f, g, k, l, m, n
from proveit.logic import Equals, Forall, Implies
from proveit.numbers import Interval, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [k]
sub_expr2 = [l]
sub_expr3 = Interval(m, n)
expr = Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = Equals(Function(f, sub_expr1), Function(g, sub_expr1)), domain = sub_expr3), Equals(Sum(index_or_indices = sub_expr2, summand = Function(f, sub_expr2), domain = sub_expr3), Sum(index_or_indices = sub_expr2, summand = Function(g, sub_expr2), domain = sub_expr3)))
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[\forall_{k \in \{m~\ldotp \ldotp~n\}}~\left(f\left(k\right) = g\left(k\right)\right)\right] \Rightarrow \left(\left(\sum_{l = m}^{n} f\left(l\right)\right) = \left(\sum_{l = m}^{n} g\left(l\right)\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: 5
operand: 8
4Operationoperator: 19
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameter: 35
body: 11
9Operationoperator: 13
operand: 17
10Operationoperator: 13
operand: 18
11Conditionalvalue: 15
condition: 16
12ExprTuple17
13Literal
14ExprTuple18
15Operationoperator: 19
operands: 20
16Operationoperator: 33
operands: 21
17Lambdaparameter: 36
body: 22
18Lambdaparameter: 36
body: 23
19Literal
20ExprTuple24, 25
21ExprTuple35, 37
22Conditionalvalue: 26
condition: 28
23Conditionalvalue: 27
condition: 28
24Operationoperator: 30
operand: 35
25Operationoperator: 31
operand: 35
26Operationoperator: 30
operand: 36
27Operationoperator: 31
operand: 36
28Operationoperator: 33
operands: 34
29ExprTuple35
30Variable
31Variable
32ExprTuple36
33Literal
34ExprTuple36, 37
35Variable
36Variable
37Operationoperator: 38
operands: 39
38Literal
39ExprTuple40, 41
40Variable
41Variable