anchor.diff:                  let! (sth, bod, pbod, lconsts) = v
                   let bvms = match_bvs tm pbod []
                   let! abod = deep_alpha bvms bod
  -                let ath = EQ_MP (ALPHA bod abod) sth
  +                let! ath = EQ_MP (ALPHA bod abod) sth
                   let! tm1 = partfn abod
                   let! insts = term_match lconsts tm1 tm
  -                let fth = INSTANTIATE insts ath
  -                let! fth' = fth
  -                let! ath' = ath
  -                if hyp fth' <> hyp ath' then 
  +                let! fth = INSTANTIATE insts (Choice.result ath)
  +                if hyp fth <> hyp ath then 
                       return! Choice.failwith "PART_MATCH: instantiated hyps"
                   else 
  -                    let! tm' = Choice.bind (partfn << concl) fth
  +                    let! tm' = partfn <| concl fth
                       if compare tm' tm = 0 then 
  -                        return! fth
  +                        return fth
                       else 
                           return!
  -                            SUBS [ALPHA tm' tm] fth
  +                            SUBS [ALPHA tm' tm] (Choice.result fth)
                               |> Choice.mapError (fun e -> nestedFailure e "PART_MATCH: Sanity check failure")
               }
   
       let GEN_PART_MATCH partfn (th : Protected<thm0>) = 
           let v =
               choice {
  -            let sth = SPEC_ALL th
  -            let! bod = Choice.map concl sth
  +            let! sth = SPEC_ALL th
  +            let bod = concl sth
               let! pbod = partfn bod
               let! tm0 = Choice.map concl th
               let! tl = Choice.map hyp th
  
positive.code: /// Unify two terms.
  let term_unify : term list -> term -> term -> Protected<_> = 
      let augment1 sofar (s, x) = 
          let s' = Choice.get <| subst sofar s
          if vfree_in x s && not(s = x) then
              failwith "augment_insts"
          else (s', x)
  
      let raw_augment_insts p insts =
          p :: (map (augment1 [p]) insts)
  
      let augment_insts (t, v) insts =
          let t' = Choice.get <| vsubst insts t
          if t' = v then insts
          elif vfree_in v t' then
              failwith "augment_insts"
          else raw_augment_insts (t', v) insts
  
      let rec unify vars tm1 tm2 sofar = 
          if tm1 = tm2 then sofar
          elif is_var tm1 && mem tm1 vars then
              match rev_assoc tm1 sofar with
              | Some tm1' ->
                  unify vars tm1' tm2 sofar
              | None ->
                  augment_insts (tm2, tm1) sofar
          elif is_var tm2 && mem tm2 vars then
              match rev_assoc tm2 sofar with
              | Some tm2' ->
                  unify vars tm1 tm2' sofar
              | None ->
                  augment_insts (tm1, tm2) sofar
          elif is_abs tm1 then 
              let tm1' = Choice.get <| body tm1
              let tm2' = Choice.get <| subst [Choice.get <| bndvar tm1, Choice.get <| bndvar tm2] (Choice.get <| body tm2)
              unify vars tm1' tm2' sofar
          else 
              let l1, r1 = Choice.get <| dest_comb tm1
              let l2, r2 = Choice.get <| dest_comb tm2
              unify vars l1 l2 (unify vars r1 r2 sofar)
  
      fun vars tm1 tm2 -> 
          Choice.attempt <| fun () ->
              [], unify vars tm1 tm2 [], []
  
  (* ------------------------------------------------------------------------- *)
  (* Modify bound variable names at depth. (Not very efficient...)             *)
  
negative.code: let MK_CONJ = 
      let andtm = parse_term @"(/\)"
      fun eq1 eq2 ->
          choice {
              let! eq1 = eq1
              let! eq2 = eq2
              let! th1 = AP_TERM andtm (Choice.result eq1)
              return! MK_COMB(Choice.result th1, Choice.result eq2)
          }
  
  /// Disjoin both sides of two equational theorems.
  let MK_DISJ = 
      let ortm = parse_term @"(\/)"
      fun eq1 eq2 ->
          choice {
              let! eq1 = eq1
              let! eq2 = eq2
              let! th1 = AP_TERM ortm (Choice.result eq1)
              return! MK_COMB(Choice.result th1, Choice.result eq2)
          }
  
  /// Universally quantifies both sides of equational theorem.
  let MK_FORALL = 
  