anchor.diff:  open preterm
   open parser
   
  -(*
  +
   (* ------------------------------------------------------------------------- *)
   (* Type abbreviation for conversions.                                        *)
   (* ------------------------------------------------------------------------- *)
   
  -type conv = term->thm
  +type conv = term -> thm
   
   (* ------------------------------------------------------------------------- *)
   (* A bit more syntax.                                                        *)
  
positive.code: (* Combinators for sequencing, trying, repeating etc. conversions.           *)
  (* ------------------------------------------------------------------------- *)
  
  let ((THENC):conv -> conv -> conv) =
    fun conv1 conv2 t ->
      let th1 = conv1 t
      let th2 = conv2 (rand(concl th1))
      TRANS th1 th2
  
  let ((ORELSEC):conv -> conv -> conv) =
      fun conv1 conv2 t ->
          try conv1 t
          with Failure _ ->
              conv2 t
  
  let (FIRST_CONV:conv list -> conv) = end_itlist (fun c1 c2 -> c1 ORELSEC c2)
  
  let (EVERY_CONV:conv list -> conv) =
    fun l -> itlist (fun c1 c2 -> c1 THENC c2) l ALL_CONV
  
  let REPEATC =
      let rec REPEATC conv t =
          ((conv THENC (REPEATC conv)) ORELSEC ALL_CONV) t
      (REPEATC:conv->conv)
  
  let (CHANGED_CONV:conv->conv) =
    fun conv tm ->
  
negative.code: 
  let mk_primed_var =
    let rec svariant avoid s =
      if mem s avoid || (can get_const_type s && not (is_hidden s)) then
        svariant avoid (s + "'")
      else s
    fun avoid v ->
      let s,ty = dest_var v
      let s' = svariant (mapfilter (fst << dest_var) avoid) s
      mk_var(s',ty)
  
  