anchor.diff:                           iterate op s f)"),
         let lemma = 
            prove
  -             ((parse_term 
  -                   "t SUBSET s ==> (s = (s DIFF t) UNION t) /\ DISJOINT (s DIFF t) t"), 
  +             ((parse_term @"t SUBSET s ==> (s = (s DIFF t) UNION t) /\ DISJOINT (s DIFF t) t"), 
                 SET_TAC [])
        MESON_TAC [lemma; ITERATE_UNION; FINITE_UNION; FINITE_SUBSET; SUBSET_DIFF])
   
  
positive.code: 
  let NUMSEG_COMBINE_R = 
      prove
          ((parse_term 
                "!m p n. m <= p + 1 /\ p <= n ==> ((m..p) UNION ((p+1)..n) = m..n)"), 
           REWRITE_TAC [EXTENSION; IN_UNION; numseg; IN_ELIM_THM]
           |> THEN <| ARITH_TAC)
  let NUMSEG_COMBINE_L = 
      prove
          ((parse_term 
                "!m p n. m <= p /\ p <= n + 1 ==> ((m..(p-1)) UNION (p..n) = m..n)"), 
           REWRITE_TAC [EXTENSION; IN_UNION; numseg; IN_ELIM_THM]
           |> THEN <| ARITH_TAC)
  let NUMSEG_LREC = 
  
negative.code:                                  |> THEN 
                                   <| REWRITE_TAC 
                                          [ARITH_RULE
                                               (parse_term @"2 * m <= SUC 0 <=> m = 0")]
                                   |> THEN <| COND_CASES_TAC
                                   |> THEN <| ASM_REWRITE_TAC [MULT_EQ_0; ARITH]
                                   REWRITE_TAC 
                                       [ARITH_RULE
                                            (parse_term @"2 * SUC n + 1 = SUC(SUC(2 * n + 1))")]
                                   |> THEN 
                                   <| ASM_SIMP_TAC [ITERATE_CLAUSES_NUMSEG]
                                   |> THEN 
                                   <| REWRITE_TAC 
                                          [ARITH_RULE
                                               (parse_term @"2 * m <= SUC(SUC(2 * n + 1)) <=> m <= SUC n")
                                           ARITH_RULE
                                               (parse_term @"2 * m <= SUC(2 * n + 1) <=> m <= SUC n")]
                                   |> THEN <| COND_CASES_TAC
                                   |> THEN <| ASM_REWRITE_TAC []
                                   |> THEN 
                                   <| REWRITE_TAC 
                                          [ARITH_RULE
                                               (parse_term @"2 * SUC n = SUC(2 * n + 1)")
                                           ARITH_RULE
                                               (parse_term @"2 * SUC n + 1 = SUC(SUC(2 * n + 1))")]
                                   |> THEN <| ASM_MESON_TAC [monoidal]])
  
  prioritize_num()
  