(`!s t n. ~(s n) /\ t n /\
(!m. m < n ==> (s(m) <=> t(m))) /\
(!n. ?m. m >= n /\ ~(s m))
==> suminf(\n. if s n then inv (&2 pow n) else &0)
< suminf(\n. if t n then inv (&2 pow n) else &0)`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC
REAL_LTE_TRANS THEN
EXISTS_TAC `sum(0,n+1) (\n. if t n then inv (&2 pow n) else &0)` THEN
CONJ_TAC THENL
[ALL_TAC;
MATCH_MP_TAC
SEQ_LE THEN MAP_EVERY EXISTS_TAC
[`\k:num. sum(0,n+1) (\n. if t n then inv (&2 pow n) else &0)`;
`\n:num. sum(0,n) (\n. if t n then inv (&2 pow n) else &0)`] THEN
REWRITE_TAC[
SEQ_CONST; GSYM sums;
SUMS_BINSEQUENCE] THEN
EXISTS_TAC `n + 1` THEN X_GEN_TAC `m:num` THEN
REWRITE_TAC[
GE;
LE_EXISTS] THEN DISCH_THEN(CHOOSE_THEN SUBST1_TAC) THEN
REWRITE_TAC[GSYM
ADD1] THEN
REWRITE_TAC[GSYM
SUM_SPLIT;
REAL_LE_ADDR;
SUM_BINSEQUENCE_LBOUND]] THEN
ASM_REWRITE_TAC[GSYM
SUM_SPLIT;
SUM_1;
ADD_CLAUSES] THEN
UNDISCH_THEN `!n:num. ?m. m >= n /\ ~s m` (MP_TAC o SPEC `n + 1`) THEN
REWRITE_TAC[
GE] THEN DISCH_THEN(X_CHOOSE_THEN `m:num` STRIP_ASSUME_TAC) THEN
MATCH_MP_TAC
REAL_LET_TRANS THEN EXISTS_TAC
`sum(0,m) (\n. if s n then inv (&2 pow n) else &0) + inv(&2 pow m)` THEN
CONJ_TAC THENL
[MATCH_MP_TAC
SEQ_LE THEN MAP_EVERY EXISTS_TAC
[`\n:num. sum(0,n) (\n. if s n then inv (&2 pow n) else &0)`;
`\k:num. sum(0,m) (\n. if s n then inv(&2 pow n) else &0) +
inv(&2 pow m)`] THEN
REWRITE_TAC[
SEQ_CONST; GSYM sums;
SUMS_BINSEQUENCE] THEN
EXISTS_TAC `m:num` THEN REWRITE_TAC[
GE;
LE_REFL] THEN
X_GEN_TAC `r:num` THEN REWRITE_TAC[
LE_EXISTS] THEN
DISCH_THEN(X_CHOOSE_THEN `p:num` SUBST_ALL_TAC) THEN
REWRITE_TAC[GSYM
SUM_SPLIT;
REAL_LE_LADD;
ADD_CLAUSES] THEN
DISJ_CASES_THEN SUBST_ALL_TAC (ARITH_RULE `p = 0 \/ p = 1 +
PRE p`) THEN
SIMP_TAC[sum;
REAL_LE_INV_EQ;
REAL_POW_LE;
REAL_POS] THEN
ONCE_REWRITE_TAC[GSYM
SUM_SPLIT] THEN
ASM_REWRITE_TAC[
SUM_1; REAL_ADD_LID] THEN
MATCH_MP_TAC
REAL_LE_TRANS THEN EXISTS_TAC `&2 / &2 pow (m + 1)` THEN
REWRITE_TAC[
SUM_BINSEQUENCE_UBOUND_LE] THEN
REWRITE_TAC[
REAL_POW_ADD;
REAL_POW_1] THEN CONV_TAC REAL_FIELD;
ALL_TAC] THEN
FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [
LE_EXISTS]) THEN
DISCH_THEN(X_CHOOSE_THEN `r:num` SUBST_ALL_TAC) THEN
REWRITE_TAC[GSYM
SUM_SPLIT] THEN
ASM_REWRITE_TAC[
ADD_CLAUSES;
SUM_1;
REAL_ADD_RID] THEN
MATCH_MP_TAC(REAL_ARITH `a = b /\ c < e - d ==> (a + c) + d < b + e`) THEN
CONJ_TAC THENL
[MATCH_MP_TAC
SUM_EQ THEN ASM_SIMP_TAC[
LE_0;
ADD_CLAUSES]; ALL_TAC] THEN
MATCH_MP_TAC
REAL_LET_TRANS THEN
EXISTS_TAC `&2 / &2 pow (n + 1) - &2 / &2 pow ((n + 1) + r)` THEN
REWRITE_TAC[
SUM_BINSEQUENCE_UBOUND_SHARP] THEN
MATCH_MP_TAC(REAL_ARITH `a = b /\ d < c ==> a - c < b - d`) THEN
CONJ_TAC THENL
[REWRITE_TAC[
REAL_POW_ADD;
REAL_POW_1] THEN CONV_TAC REAL_FIELD;
MATCH_MP_TAC(REAL_FIELD `&0 < inv(x) ==> inv(x) < &2 / x`) THEN
SIMP_TAC[
REAL_LT_INV_EQ;
REAL_POW_LT;
REAL_OF_NUM_LT; ARITH]]);;