anchor.diff:    areEqual (optim 5 exp1) <@@ fun a -> 1. / (a + 1.) @@>
     let exp2 = <@ fun a -> (1. / a + 1.) * a @>
     areEqual (optim 5 exp2) <@@ fun a -> 1. + a @@>
  +  let exp3 = <@ fun a -> (1. / (a*a) + 1.) * (a*a) @>
  +  areEqual (optim 5 exp3) <@@ fun a -> 1. + a*a @@>
  +  let exp4 = <@ fun a b -> (1. / (a*b) + 1.) * (a*b) @>
  +  areEqual (optim 5 exp4) <@@ fun a b -> 1. + a*b @@>
  +  let exp5 = <@ fun a -> (1. / (1. + 1. / a)) @>
  +  areEqual (optim 6 exp5) <@@ fun a -> a / (a + 1.) @@>
  +  let exp6 = <@ fun a -> (1. - a) * (1. + a) @>
  +  areEqual (optim 10 exp6) <@@ fun a -> 1. - a*a @@>
   
   let training_generator_k (init: unit -> unit) (cont1: int -> Expr -> unit) (cont2: int -> Expr -> unit): unit = 
     let trainingBase = "training_base"
  
positive.code: 
  [<Test>]
  let testSearchOnHardProgram () = 
    let debug = true
    let debugger = Logging.consoleLogger debug
    let reporter = Logging.completeReporter (ccodegen.prettyprint) debugger
    let comp = ruleengine.compilePatternToRule
    let rs = [comp <@ comAdd @>; comp <@ comMult @>] @ algebraicRulesScalar
    let optim levels e = 
      let t = tic()
      //let algo levels = bfs levels
      let algo levels = 
        let exprHash e = (exprPreorderString e).GetHashCode()
        //let exprHash e = e.GetHashCode()
        fastBfs levels (fun a b -> alphaEquals a b Map.empty) exprHash
      let o = algo levels reporter e ((optimizer.examineAllRules rs) ) (cost.fopCost) |> fst
      toc t "BFS"
      o
    let areEqual e1 e2 =
      let isEqual = transformer.alphaEquals e1 e2 Map.empty
      Assert.IsTrue(isEqual, sprintf "Expected: %A\nActual: %A" e2 e1)
  
negative.code:   //       )  
    steps
  
  let exprHashCode (exp: Expr): int = 
    let rec rcr e: int = 
      match e with 
      | ExprShape.ShapeLambda(i, e1) -> 'L'.GetHashCode() * 31 + (rcr e1)
      | ExprShape.ShapeVar(v)       -> 'V'.GetHashCode()
      | Patterns.Value(v, tp)       -> 'C'.GetHashCode()
      | ExprShape.ShapeCombination(o, exprs) ->
        let childrenHash = exprs |> List.fold (fun s e1 -> s + (rcr e1)) 0
        let label = (exprLabel e).GetHashCode()
        label * 31 + childrenHash
    rcr exp
  
  let log_optimize (e: Expr) (rs: List<Rule>) (logger: string -> unit)= 
    let debug = false
  