anchor.diff:              Set<_,_>(comparer=comparer, tree=SetTree.ofSeq comparer l)
   
   
  -    [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
       [<NoEquality; NoComparison>]
  -    type MapTree<'Key,'T> = 
  -        | MapEmpty 
  -#if ONE 
  -        | MapOne of 'Key * 'T
  -#endif
  -        | MapNode of 'Key * 'T * MapTree<'Key,'T> *  MapTree<'Key,'T> * int
  +    [<AllowNullLiteral>]
  +    type internal MapTree<'Key, 'Value>(k: 'Key, v: 'Value) =
  +        member _.Key = k
  +        member _.Value = v
  +
  +    [<NoEquality; NoComparison>]
  +    [<Sealed>]
  +    [<AllowNullLiteral>]
  +    type internal MapTreeNode<'Key, 'Value>(k:'Key, v:'Value, left:MapTree<'Key, 'Value>, right: MapTree<'Key, 'Value>, h: int) =
  +        inherit MapTree<'Key,'Value>(k, v)
  +
  +        member _.Left = left
  +        member _.Right = right
  +        member _.Height = h
   
   
       [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
       module MapTree = 
   
  -        let empty = MapEmpty 
  -
  -        let inline height x  = 
  -          match x with 
  -          | MapEmpty -> 0
  -#if ONE 
  -          | MapOne _ -> 1
  -#endif
  -          | MapNode(_,_,_,_,h) -> h
  -
  -        let inline isEmpty m = 
  -            match m with 
  -            | MapEmpty -> true
  -            | _ -> false
  -
  -        let inline mk l k v r = 
  -#if ONE 
  -            match l,r with 
  -            | MapEmpty,MapEmpty -> MapOne(k,v)
  -            | _ -> 
  -#endif
  -                let hl = height l 
  -                let hr = height r 
  -                let m = if hl < hr then hr else hl 
  -                MapNode(k,v,l,r,m+1)
  -
  -        let rebalance t1 k v t2 =
  +        let empty = null 
  +
  +        let inline isEmpty (m:MapTree<'Key, 'Value>) = isNull m
  +            
  +        let rec sizeAux acc (m:MapTree<'Key, 'Value>) = 
  +            if isEmpty m then
  +                acc
  +            else
  +                match m with
  +                | :? MapTreeNode<'Key, 'Value> as mn -> sizeAux (sizeAux (acc+1) mn.Left) mn.Right 
  +                | _ -> acc + 1
  +
  +        let size x = sizeAux 0 x
  +
  +        let inline height (m: MapTree<'Key, 'Value>) = 
  +            if isEmpty m then 0
  +            else
  +                match m with
  +                | :? MapTreeNode<'Key, 'Value> as mn -> mn.Height
  +                | _ -> 1
  +
  +        let mk l k v r : MapTree<'Key, 'Value> = 
  +            let hl = height l
  +            let hr = height r
  +            let m = max hl hr
  +            if m = 0 then // m=0 ~ isEmpty l && isEmpty r 
  +                MapTree(k,v)
  +            else
  +                MapTreeNode(k,v,l,r,m+1) :> MapTree<'Key, 'Value>
  +
  +        let inline private asNode(value:MapTree<'Key,'Value>) : MapTreeNode<'Key,'Value> =
  +          value :?> MapTreeNode<'Key,'Value>
  +          
  +        let rebalance t1 (k: 'Key) (v: 'Value) t2 : MapTree<'Key, 'Value> =
               let t1h = height t1
  -            let t2h = height t2
  -            if t2h > t1h + 2 then // right is heavier than left 
  -                match t2 with 
  -                | MapNode(t2k,t2v,t2l,t2r,_) -> 
  -                   // one of the nodes must have height > height t1 + 1 
  -                   if height t2l > t1h + 1 then  // balance left: combination 
  -                     match t2l with 
  -                     | MapNode(t2lk,t2lv,t2ll,t2lr,_) ->
  -                        mk (mk t1 k v t2ll) t2lk t2lv (mk t2lr t2k t2v t2r) 
  -                     | _ -> failwith "rebalance"
  -                   else // rotate left 
  -                     mk (mk t1 k v t2l) t2k t2v t2r
  -                | _ -> failwith "rebalance"
  -            else
  -                if t1h > t2h + 2 then // left is heavier than right 
  -                  match t1 with 
  -                  | MapNode(t1k,t1v,t1l,t1r,_) -> 
  -                    // one of the nodes must have height > height t2 + 1 
  -                      if height t1r > t2h + 1 then 
  -                      // balance right: combination 
  -                        match t1r with 
  -                        | MapNode(t1rk,t1rv,t1rl,t1rr,_) ->
  -                            mk (mk t1l t1k t1v t1rl) t1rk t1rv (mk t1rr k v t2)
  -                        | _ -> failwith "rebalance"
  -                      else
  -                        mk t1l t1k t1v (mk t1r k v t2)
  -                  | _ -> failwith "rebalance"
  +            let t2h = height t2 
  +            if  t2h > t1h + 2 then (* right is heavier than left *)
  +                let t2' = asNode(t2)
  +                (* one of the nodes must have height > height t1 + 1 *)
  +                if height t2'.Left > t1h + 1 then  (* balance left: combination *)
  +                    let t2l = asNode(t2'.Left)
  +                    mk (mk t1 k v t2l.Left) t2l.Key t2l.Value (mk t2l.Right t2'.Key t2'.Value t2'.Right)
  +                else (* rotate left *)
  +                    mk (mk t1 k v t2'.Left) t2'.Key t2'.Value t2'.Right
  +            else
  +                if  t1h > t2h + 2 then (* left is heavier than right *)
  +                    let t1' = asNode(t1)
  +                    (* one of the nodes must have height > height t2 + 1 *)
  +                    if height t1'.Right > t2h + 1 then 
  +                    (* balance right: combination *)
  +                        let t1r = asNode(t1'.Right)
  +                        mk (mk t1'.Left t1'.Key t1'.Value t1r.Left) t1r.Key t1r.Value (mk t1r.Right k v t2)
  +                    else
  +                        mk t1'.Left t1'.Key t1'.Value (mk t1'.Right k v t2)
                   else mk t1 k v t2
   
  -        let rec sizeAux acc m = 
  -            match m with  
  -            | MapEmpty -> acc
  -#if ONE 
  -            | MapOne _ -> acc + 1
  -#endif
  -            | MapNode(_,_,l,r,_) -> sizeAux (sizeAux (acc+1) l) r 
  -
  -#if ONE 
  -#else
  -        let MapOne(k,v) = MapNode(k,v,MapEmpty,MapEmpty,1)
  -#endif
  +
  +        let rec add (comparer: IComparer<'Key>) k (v: 'Value) (m: MapTree<'Key, 'Value>) : MapTree<'Key, 'Value> = 
  +            if isEmpty m then MapTree(k,v)
  +            else
  +                let c = comparer.Compare(k,m.Key)
  +                match m with
  +                | :? MapTreeNode<'Key, 'Value> as mn ->
  +                    if c < 0 then rebalance (add comparer k v mn.Left) mn.Key mn.Value mn.Right
  +                    elif c = 0 then MapTreeNode(k,v,mn.Left,mn.Right,mn.Height) :> MapTree<'Key, 'Value>
  +                    else rebalance mn.Left mn.Key mn.Value (add comparer k v mn.Right)
  +                | _ ->
  +                    if c < 0   then MapTreeNode (k,v,empty,m,2) :> MapTree<'Key, 'Value>
  +                    elif c = 0 then MapTree(k,v)
  +                    else            MapTreeNode (k,v,m,empty,2) :> MapTree<'Key, 'Value> 
  +
  +        let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection"))
  +
  +        let rec tryGetValue (comparer: IComparer<'Key>) k (v: byref<'Value>) (m: MapTree<'Key, 'Value>) =                     
  +            if isEmpty m then false
  +            else
  +                let c = comparer.Compare(k, m.Key)
  +                if c = 0 then v <- m.Value; true
  +                else
  +                    match m with
  +                    | :? MapTreeNode<'Key, 'Value> as mn ->
  +                        tryGetValue comparer k &v (if c < 0 then mn.Left else mn.Right)
  +                    | _ -> false
  +
  +        let find (comparer: IComparer<'Key>) k (m: MapTree<'Key, 'Value>) =
  +            let mutable v = Unchecked.defaultof<'Value>
  +            if tryGetValue comparer k &v m then
  +                v
  +            else
  +                indexNotFound()
  +
  +        let tryFind (comparer: IComparer<'Key>) k (m: MapTree<'Key, 'Value>) = 
  +            let mutable v = Unchecked.defaultof<'Value>
  +            if tryGetValue comparer k &v m then
  +                Some v
  +            else
  +                None
  +
  +        let partition1 (comparer: IComparer<'Key>) (f: OptimizedClosures.FSharpFunc<_, _, _>) k v (acc1, acc2) = 
  +            if f.Invoke (k, v) then (add comparer k v acc1, acc2) else (acc1, add comparer k v acc2) 
  +
  +        let rec partitionAux (comparer: IComparer<'Key>) (f: OptimizedClosures.FSharpFunc<_, _, _>) (m: MapTree<'Key, 'Value>) acc = 
  +            if isEmpty m then acc
  +            else
  +                match m with        
  +                | :? MapTreeNode<'Key, 'Value> as mn ->
  +                    let acc = partitionAux comparer f mn.Right acc 
  +                    let acc = partition1 comparer f mn.Key mn.Value acc
  +                    partitionAux comparer f mn.Left acc
  +                | _ -> partition1 comparer f m.Key m.Value acc
  +
  +        let partition (comparer: IComparer<'Key>) f m =
  +            partitionAux comparer (OptimizedClosures.FSharpFunc<_, _, _>.Adapt f) m (empty, empty)
  +
  +        let filter1 (comparer: IComparer<'Key>) (f: OptimizedClosures.FSharpFunc<_, _, _>) k v acc =
  +            if f.Invoke (k, v) then add comparer k v acc else acc 
  +
  +        let rec filterAux (comparer: IComparer<'Key>) (f: OptimizedClosures.FSharpFunc<_, _, _>) (m: MapTree<'Key, 'Value>) acc = 
  +            if isEmpty m then acc
  +            else
  +                match m with 
  +                | :? MapTreeNode<'Key, 'Value> as mn ->
  +                    let acc = filterAux comparer f mn.Left acc
  +                    let acc = filter1 comparer f mn.Key mn.Value acc
  +                    filterAux comparer f mn.Right acc
  +                | _ -> filter1 comparer f m.Key m.Value acc
  +
  +        let filter (comparer: IComparer<'Key>) f m =
  +              filterAux comparer (OptimizedClosures.FSharpFunc<_, _, _>.Adapt f) m empty
  +
  +        let rec spliceOutSuccessor (m: MapTree<'Key, 'Value>) = 
  +            if isEmpty m then failwith "internal error: Map.spliceOutSuccessor"
  +            else
  +                match m with
  +                | :? MapTreeNode<'Key, 'Value> as mn ->
  +                    if isEmpty mn.Left then mn.Key, mn.Value, mn.Right
  +                    else let k3, v3, l' = spliceOutSuccessor mn.Left in k3, v3, mk l' mn.Key mn.Value mn.Right
  +                | _ -> m.Key, m.Value, empty
  +
  +        let rec remove (comparer: IComparer<'Key>) k (m: MapTree<'Key, 'Value>) = 
  +            if isEmpty m then empty
  +            else
  +                let c = comparer.Compare(k, m.Key)
  +                match m with 
  +                | :? MapTreeNode<'Key, 'Value> as mn ->
  +                    if c < 0 then rebalance (remove comparer k mn.Left) mn.Key mn.Value mn.Right
  +                    elif c = 0 then
  +                        if isEmpty mn.Left then mn.Right
  +                        elif isEmpty mn.Right then mn.Left
  +                        else
  +                            let sk, sv, r' = spliceOutSuccessor mn.Right 
  +                            mk mn.Left sk sv r'
  +                    else rebalance mn.Left mn.Key mn.Value (remove comparer k mn.Right)
  +                | _ ->
  +                    if c = 0 then empty else m
  +
  +        let rec mem (comparer: IComparer<'Key>) k (m: MapTree<'Key, 'Value>) = 
  +            if isEmpty m then false
  +            else
  +                let c = comparer.Compare(k, m.Key)
  +                match m with 
  +                | :? MapTreeNode<'Key, 'Value> as mn ->
  +                    if c < 0 then mem comparer k mn.Left
  +                    else (c = 0 || mem comparer k mn.Right)
  +                | _ -> c = 0
  +
  +        let rec iterOpt (f: OptimizedClosures.FSharpFunc<_, _, _>) (m: MapTree<'Key, 'Value>) =
  +            if isEmpty m then ()
  +            else
  +                match m with 
  +                | :? MapTreeNode<'Key, 'Value> as mn -> iterOpt f mn.Left; f.Invoke (mn.Key, mn.Value); iterOpt f mn.Right
  +                | _ -> f.Invoke (m.Key, m.Value)
  +
  +        let iter f m =
  +            iterOpt (OptimizedClosures.FSharpFunc<_, _, _>.Adapt f) m
  +
  +        let rec tryPickOpt (f: OptimizedClosures.FSharpFunc<_, _, _>) (m: MapTree<'Key, 'Value>) =
  +            if isEmpty m then None
  +            else
  +                match m with 
  +                | :? MapTreeNode<'Key, 'Value> as mn ->
  +                    match tryPickOpt f mn.Left with 
  +                    | Some _ as res -> res 
  +                    | None -> 
  +                    match f.Invoke (mn.Key, mn.Value) with 
  +                    | Some _ as res -> res 
  +                    | None -> 
  +                    tryPickOpt f mn.Right
  +                | _ -> f.Invoke (m.Key, m.Value)
  +
  +        let tryPick f m =
  +            tryPickOpt (OptimizedClosures.FSharpFunc<_, _, _>.Adapt f) m
  +
  +        let rec existsOpt (f: OptimizedClosures.FSharpFunc<_, _, _>) (m: MapTree<'Key, 'Value>) = 
  +            if isEmpty m then false
  +            else
  +                match m with 
  +                | :? MapTreeNode<'Key, 'Value> as mn -> existsOpt f mn.Left || f.Invoke (mn.Key, mn.Value) || existsOpt f mn.Right
  +                | _ -> f.Invoke (m.Key, m.Value)
  +
  +        let exists f m =
  +            existsOpt (OptimizedClosures.FSharpFunc<_, _, _>.Adapt f) m
  +
  +        let rec forallOpt (f: OptimizedClosures.FSharpFunc<_, _, _>) (m: MapTree<'Key, 'Value>) = 
  +            if isEmpty m then true
  +            else
  +                match m with 
  +                | :? MapTreeNode<'Key, 'Value> as mn -> forallOpt f mn.Left && f.Invoke (mn.Key, mn.Value) && forallOpt f mn.Right
  +                | _ -> f.Invoke (m.Key, m.Value)
           
  -        let count x = sizeAux 0 x
  -
  -        let rec add (comparer: IComparer<'T>) k v m = 
  -            match m with 
  -            | MapEmpty -> MapOne(k,v)
  -#if ONE 
  -            | MapOne(k2,v2) -> 
  -                let c = comparer.Compare(k,k2) 
  -                if c < 0   then MapNode (k,v,MapEmpty,m,2)
  -                elif c = 0 then MapOne(k,v)
  -                else            MapNode (k,v,m,MapEmpty,2)
  -#endif
  -            | MapNode(k2,v2,l,r,h) -> 
  -                let c = comparer.Compare(k,k2) 
  -                if c < 0 then rebalance (add comparer k v l) k2 v2 r
  -                elif c = 0 then MapNode(k,v,l,r,h)
  -                else rebalance l k2 v2 (add comparer k v r) 
  -
  -        let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection"))
  -
  -        let rec find (comparer: IComparer<'T>) k m = 
  -            match m with 
  -            | MapEmpty -> indexNotFound()
  -#if ONE 
  -            | MapOne(k2,v2) -> 
  -                let c = comparer.Compare(k,k2) 
  -                if c = 0 then v2
  -                else indexNotFound()
  -#endif
  -            | MapNode(k2,v2,l,r,_) -> 
  -                let c = comparer.Compare(k,k2) 
  -                if c < 0 then find comparer k l
  -                elif c = 0 then v2
  -                else find comparer k r
  -
  -        let rec tryFind (comparer: IComparer<'T>) k m = 
  -            match m with 
  -            | MapEmpty -> None
  -#if ONE 
  -            | MapOne(k2,v2) -> 
  -                let c = comparer.Compare(k,k2) 
  -                if c = 0 then Some v2
  -                else None
  -#endif
  -            | MapNode(k2,v2,l,r,_) -> 
  -                let c = comparer.Compare(k,k2) 
  -                if c < 0 then tryFind comparer k l
  -                elif c = 0 then Some v2
  -                else tryFind comparer k r
  -
  -        let partition1 (comparer: IComparer<'T>) f k v (acc1,acc2) = 
  -            if f k v then (add comparer k v acc1,acc2) else (acc1,add comparer k v acc2) 
  -        
  -        let rec partitionAux (comparer: IComparer<'T>) f s acc = 
  -            match s with 
  -            | MapEmpty -> acc
  -#if ONE 
  -            | MapOne(k,v) -> partition1 comparer f k v acc
  -#endif
  -            | MapNode(k,v,l,r,_) -> 
  -                let acc = partitionAux comparer f r acc 
  -                let acc = partition1 comparer f k v acc
  -                partitionAux comparer f l acc
  -
  -        let partition (comparer: IComparer<'T>) f s = partitionAux comparer f s (empty,empty)
  -
  -        let filter1 (comparer: IComparer<'T>) f k v acc = if f k v then add comparer k v acc else acc 
  -
  -        let rec filterAux (comparer: IComparer<'T>) f s acc = 
  -            match s with 
  -            | MapEmpty -> acc
  -#if ONE 
  -            | MapOne(k,v) -> filter1 comparer f k v acc
  -#endif
  -            | MapNode(k,v,l,r,_) ->
  -                let acc = filterAux comparer f l acc
  -                let acc = filter1 comparer f k v acc
  -                filterAux comparer f r acc
  -
  -        let filter (comparer: IComparer<'T>) f s = filterAux comparer f s empty
  -
  -        let rec spliceOutSuccessor m = 
  -            match m with 
  -            | MapEmpty -> failwith "internal error: Map.splice_out_succ_or_pred"
  -#if ONE 
  -            | MapOne(k2,v2) -> k2,v2,MapEmpty
  -#endif
  -            | MapNode(k2,v2,l,r,_) ->
  -                match l with 
  -                | MapEmpty -> k2,v2,r
  -                | _ -> let k3,v3,l' = spliceOutSuccessor l in k3,v3,mk l' k2 v2 r
  -
  -        let rec remove (comparer: IComparer<'T>) k m = 
  -            match m with 
  -            | MapEmpty -> empty
  -#if ONE 
  -            | MapOne(k2,v2) -> 
  -                let c = comparer.Compare(k,k2) 
  -                if c = 0 then MapEmpty else m
  -#endif
  -            | MapNode(k2,v2,l,r,_) -> 
  -                let c = comparer.Compare(k,k2) 
  -                if c < 0 then rebalance (remove comparer k l) k2 v2 r
  -                elif c = 0 then 
  -                  match l,r with 
  -                  | MapEmpty,_ -> r
  -                  | _,MapEmpty -> l
  -                  | _ -> 
  -                      let sk,sv,r' = spliceOutSuccessor r 
  -                      mk l sk sv r'
  -                else rebalance l k2 v2 (remove comparer k r) 
  -
  -        let rec containsKey (comparer: IComparer<'T>) k m = 
  -            match m with 
  -            | MapEmpty -> false
  -#if ONE 
  -            | MapOne(k2,v2) -> (comparer.Compare(k,k2) = 0)
  -#endif
  -            | MapNode(k2,_,l,r,_) -> 
  -                let c = comparer.Compare(k,k2) 
  -                if c < 0 then containsKey comparer k l
  -                else (c = 0 || containsKey comparer k r)
  -
  -        let rec iter f m = 
  -            match m with 
  -            | MapEmpty -> ()
  -#if ONE 
  -            | MapOne(k2,v2) -> f k2 v2
  -#endif
  -            | MapNode(k2,v2,l,r,_) -> iter f l; f k2 v2; iter f r
  -
  -        let rec first f m = 
  -            match m with 
  -            | MapEmpty -> None
  -#if ONE 
  -            | MapOne(k2,v2) -> f k2 v2 
  -#endif
  -            | MapNode(k2,v2,l,r,_) -> 
  -                match first f l with 
  -                | Some _ as res -> res 
  -                | None -> 
  -                match f k2 v2 with 
  -                | Some _ as res -> res 
  -                | None -> first f r
  -
  -        let rec exists f m = 
  -            match m with 
  -            | MapEmpty -> false
  -#if ONE 
  -            | MapOne(k2,v2) -> f k2 v2
  -#endif
  -            | MapNode(k2,v2,l,r,_) -> f k2 v2 || exists f l || exists f r
  -
  -        let rec forAll f m = 
  -            match m with 
  -            | MapEmpty -> true
  -#if ONE 
  -            | MapOne(k2,v2) -> f k2 v2
  -#endif
  -            | MapNode(k2,v2,l,r,_) -> f k2 v2 && forAll f l && forAll f r
  -
  -        let rec map f m = 
  -            match m with 
  -            | MapEmpty -> empty
  -#if ONE 
  -            | MapOne(k,v) -> MapOne(k,f v)
  -#endif
  -            | MapNode(k,v,l,r,h) -> let v2 = f v in MapNode(k,v2,map f l, map f r,h)
  -
  -        let rec mapi f m = 
  -            match m with
  -            | MapEmpty -> empty
  -#if ONE 
  -            | MapOne(k,v) -> MapOne(k,f k v)
  -#endif
  -            | MapNode(k,v,l,r,h) -> let v2 = f k v in MapNode(k,v2, mapi f l, mapi f r,h)
  +
  +        let forall f m =
  +            forallOpt (OptimizedClosures.FSharpFunc<_, _, _>.Adapt f) m
  +
  +        let rec map (f:'Value -> 'Result) (m: MapTree<'Key, 'Value>) : MapTree<'Key, 'Result> = 
  +            if isEmpty m then empty
  +            else
  +                match m with 
  +                | :? MapTreeNode<'Key, 'Value> as mn -> 
  +                    let l2 = map f mn.Left 
  +                    let v2 = f mn.Value
  +                    let r2 = map f mn.Right
  +                    MapTreeNode (mn.Key, v2, l2, r2, mn.Height) :> MapTree<'Key, 'Result>
  +                | _ -> MapTree (m.Key, f m.Value)
  +
  +        let rec mapiOpt (f: OptimizedClosures.FSharpFunc<'Key, 'Value, 'Result>) (m: MapTree<'Key, 'Value>) = 
  +            if isEmpty m then empty
  +            else
  +                match m with
  +                | :? MapTreeNode<'Key, 'Value> as mn ->
  +                    let l2 = mapiOpt f mn.Left
  +                    let v2 = f.Invoke (mn.Key, mn.Value) 
  +                    let r2 = mapiOpt f mn.Right
  +                    MapTreeNode (mn.Key, v2, l2, r2, mn.Height) :> MapTree<'Key, 'Result>
  +                | _ -> MapTree (m.Key, f.Invoke (m.Key, m.Value))
  +
  +        let mapi f m =
  +            mapiOpt (OptimizedClosures.FSharpFunc<_, _, _>.Adapt f) m
   
           // Fold, right-to-left. 
           //
           // NOTE: This differs from the behaviour of Set.fold which folds left-to-right.
  -        let rec fold f m x = 
  -            match m with 
  -            | MapEmpty -> x
  -#if ONE 
  -            | MapOne(k,v) -> f k v x
  -#endif
  -            | MapNode(k,v,l,r,_) -> fold f l (f k v (fold f r x))
  -
  -        let foldSection (comparer: IComparer<'T>) lo hi f m x =
  -            let rec fold_from_to f m x = 
  +
  +        let rec foldBackOpt (f: OptimizedClosures.FSharpFunc<_, _, _, _>) (m: MapTree<'Key, 'Value>) x = 
  +            if isEmpty m then x
  +            else
                   match m with 
  -                | MapEmpty -> x
  -#if ONE 
  -                | MapOne(k,v) ->
  -                    let clo_k = comparer.Compare(lo,k)
  -                    let ck_hi = comparer.Compare(k,hi)
  -                    let x = if clo_k <= 0 && ck_hi <= 0 then f k v x else x
  -                    x
  -#endif
  -                | MapNode(k,v,l,r,_) ->
  -                    let clo_k = comparer.Compare(lo,k)
  -                    let ck_hi = comparer.Compare(k,hi)
  -                    let x = if clo_k < 0                then fold_from_to f l x else x
  -                    let x = if clo_k <= 0 && ck_hi <= 0 then f k v x                     else x
  -                    let x = if ck_hi < 0                then fold_from_to f r x else x
  -                    x
  -           
  -            if comparer.Compare(lo,hi) = 1 then x else fold_from_to f m x
  -
  -        let rec foldMap (comparer: IComparer<'T>) f m z acc = 
  -            match m with 
  -            | MapEmpty -> acc,z
  -#if ONE 
  -            | MapOne(k,v) -> 
  -                let v',z = f k v z
  -                add comparer k v' acc,z
  -#endif
  -            | MapNode(k,v,l,r,_) -> 
  -                let acc,z = foldMap comparer f r z acc
  -                let v',z = f k v z
  -                let acc = add comparer k v' acc 
  -                foldMap comparer f l z acc
  -
  -        let toList m = fold (fun k v acc -> (k,v) :: acc) m []
  +                | :? MapTreeNode<'Key, 'Value> as mn ->
  +                    let x = foldBackOpt f mn.Right x
  +                    let x = f.Invoke (mn.Key, mn.Value, x)
  +                    foldBackOpt f mn.Left x
  +                | _ -> f.Invoke (m.Key, m.Value, x)
  +
  +        let foldBack f m x =
  +            foldBackOpt (OptimizedClosures.FSharpFunc<_, _, _, _>.Adapt f) m x
  +
  +        let foldSectionOpt (comparer: IComparer<'Key>) lo hi (f: OptimizedClosures.FSharpFunc<_, _, _, _>) (m: MapTree<'Key, 'Value>) x =
  +            let rec foldFromTo (f: OptimizedClosures.FSharpFunc<_, _, _, _>) (m: MapTree<'Key, 'Value>) x = 
  +                if isEmpty m then x
  +                else
  +                    match m with 
  +                    | :? MapTreeNode<'Key, 'Value> as mn ->
  +                        let cLoKey = comparer.Compare(lo, mn.Key)
  +                        let cKeyHi = comparer.Compare(mn.Key, hi)
  +                        let x = if cLoKey < 0 then foldFromTo f mn.Left x else x
  +                        let x = if cLoKey <= 0 && cKeyHi <= 0 then f.Invoke (mn.Key, mn.Value, x) else x
  +                        let x = if cKeyHi < 0 then foldFromTo f mn.Right x else x
  +                        x
  +                    | _ ->
  +                        let cLoKey = comparer.Compare(lo, m.Key)
  +                        let cKeyHi = comparer.Compare(m.Key, hi)
  +                        let x = if cLoKey <= 0 && cKeyHi <= 0 then f.Invoke (m.Key, m.Value, x) else x
  +                        x
  +
  +            if comparer.Compare(lo, hi) = 1 then x else foldFromTo f m x
  +
  +        let foldSection (comparer: IComparer<'Key>) lo hi f m x =
  +            foldSectionOpt comparer lo hi (OptimizedClosures.FSharpFunc<_, _, _, _>.Adapt f) m x
  +
  +        let rec foldMapOpt (comparer: IComparer<'Key>) (f: OptimizedClosures.FSharpFunc<_, _, _, _>) (m: MapTree<'Key, 'Value>) z acc = 
  +            if isEmpty m then acc,z
  +            else
  +                match m with
  +                | :? MapTreeNode<'Key, 'Value> as mn ->
  +                    let acc,z = foldMapOpt comparer f mn.Right z acc
  +                    let v',z = f.Invoke(mn.Key, mn.Value, z)
  +                    let acc = add comparer mn.Key v' acc 
  +                    foldMapOpt comparer f mn.Left z acc
  +                | _ -> 
  +                    let v',z = f.Invoke(m.Key, m.Value, z)
  +                    add comparer m.Key v' acc,z
  +
  +        let foldMap (comparer: IComparer<'Key>) f (m: MapTree<'Key, 'Value>) z acc =
  +            foldMapOpt comparer (OptimizedClosures.FSharpFunc<_, _, _, _>.Adapt f) m z acc
  +
  +        let toList m = foldBack (fun k v acc -> (k,v) :: acc) m []
           let toArray m = m |> toList |> Array.ofList
           let ofList comparer l = List.fold (fun acc (k,v) -> add comparer k v acc) empty l
   
  -        
           let rec mkFromEnumerator comparer acc (e : IEnumerator<_>) = 
               if e.MoveNext() then 
                   let (x,y) = e.Current 
  
positive.code:         member s.IsEmpty  = SetTree.isEmpty tree
  
          member s.Partition f  : Set<'T,'ComparerTag> *  Set<'T,'ComparerTag> = 
              match tree with 
              | SetEmpty -> s,s
              | _ -> 
                  let t1,t2 = SetTree.partition comparer f tree 
                  refresh s t1, refresh s t2
  
          member s.Filter f  : Set<'T,'ComparerTag> = 
              match tree with 
              | SetEmpty -> s
              | _ -> SetTree.filter comparer f tree |> refresh s
  
          member s.Exists f = SetTree.exists f tree
  
          member s.ForAll f = SetTree.forAll f tree
  
          static member (-) ((a: Set<'T,'ComparerTag>),(b: Set<'T,'ComparerTag>)) = Set<_,_>.Difference(a,b)
  
          static member (+)  ((a: Set<'T,'ComparerTag>),(b: Set<'T,'ComparerTag>)) = Set<_,_>.Union(a,b)
  
          static member Intersection((a: Set<'T,'ComparerTag>),(b: Set<'T,'ComparerTag>)) : Set<'T,'ComparerTag>  = 
              match b.Tree with 
              | SetEmpty -> b  // A INTER 0 = 0 
              | _ -> 
                 match a.Tree with 
                 | SetEmpty -> a // 0 INTER B = 0 
                 | _ -> SetTree.intersection a.Comparer  a.Tree b.Tree |> refresh a
             
          static member Union(a: Set<'T,'ComparerTag>,b: Set<'T,'ComparerTag>) : Set<'T,'ComparerTag>  = 
              match b.Tree with 
              | SetEmpty -> a  // A U 0 = A 
              | _ -> 
                 match a.Tree with 
                 | SetEmpty -> b  // 0 U B = B 
                 | _ -> SetTree.union a.Comparer  a.Tree b.Tree |> refresh a
  
          static member Difference(a: Set<'T,'ComparerTag>,b: Set<'T,'ComparerTag>) : Set<'T,'ComparerTag>  = 
              match a.Tree with 
              | SetEmpty -> a // 0 - B = 0 
              | _ -> 
                  match b.Tree with 
                  | SetEmpty -> a // A - 0 = A 
                  | _ -> SetTree.diff a.Comparer  a.Tree b.Tree |> refresh a
  
          static member Equality(a: Set<'T,'ComparerTag>,b: Set<'T,'ComparerTag>) = 
              (SetTree.compare a.Comparer  a.Tree b.Tree = 0)
  
negative.code:         // Set comparison.  This can be expensive.
          //--------------------------------------------------------------------------
  
          let rec compareStacks (comparer: IComparer<'T>) (l1:SetTree<'T> list) (l2:SetTree<'T> list) : int =
              let cont() =
                  match l1, l2 with 
                  | (x1 :: t1), _ when not (isEmpty x1) ->
                      match x1 with
                      | :? SetTreeNode<'T> as x1n ->
                          compareStacks comparer (x1n.Left :: (SetTreeNode (x1n.Key, empty, x1n.Right, 0) :> SetTree<'T>) :: t1) l2
                      | _ -> compareStacks comparer (empty :: SetTree x1.Key :: t1) l2
                  | _, (x2 :: t2) when not (isEmpty x2) ->
                      match x2 with
                      | :? SetTreeNode<'T> as x2n ->
                          compareStacks comparer l1 (x2n.Left :: (SetTreeNode (x2n.Key, empty, x2n.Right, 0) :> SetTree<'T>  ) :: t2)
                      | _ -> compareStacks comparer l1 (empty :: SetTree x2.Key :: t2)
                  | _ -> failwith "unexpected state in SetTree.compareStacks"
      
              match l1, l2 with 
              | [], [] ->  0
              | [], _  -> -1
              | _, [] ->  1
              | (x1 :: t1), (x2 :: t2) ->
                  if isEmpty x1 then
                      if isEmpty x2 then compareStacks comparer t1 t2
                      else cont()
                  elif isEmpty x2 then cont()
                  else
                      match x1 with
                      | :? SetTreeNode<'T> as x1n ->
                          if isEmpty x1n.Left then
                              match x2 with
                              | :? SetTreeNode<'T> as x2n ->
                                  if isEmpty x2n.Left then
                                      let c = comparer.Compare(x1n.Key, x2n.Key) 
                                      if c <> 0 then c else compareStacks comparer (x1n.Right :: t1) (x2n.Right :: t2)
                                  else cont()
                              | _ ->
                                  let c = comparer.Compare(x1n.Key, x2.Key) 
                                  if c <> 0 then c else compareStacks comparer (x1n.Right :: t1) (empty :: t2)
                          else cont()
                      | _ ->
                          match x2 with
                          | :? SetTreeNode<'T> as x2n ->
                              if isEmpty x2n.Left then
                                  let c = comparer.Compare(x1.Key, x2n.Key) 
                                  if c <> 0 then c else compareStacks comparer (empty :: t1) (x2n.Right :: t2)
                              else cont()
                          | _ ->
                              let c = comparer.Compare(x1.Key, x2.Key) 
                              if c <> 0 then c else compareStacks comparer t1 t2
                              
          let compare comparer (t1:SetTree<'T>) (t2:SetTree<'T>) = 
              if isEmpty t1 then
                  if isEmpty t2 then 0
                  else -1
              else
                  if isEmpty t2 then 1
                  else compareStacks comparer [t1] [t2]
  
          let choose s = minimumElement s
  
          let toList (t:SetTree<'T>) = 
              let rec loop (t':SetTree<'T>) acc =
                  if isEmpty t' then acc
                  else
                      match t' with 
                      | :? SetTreeNode<'T> as tn -> loop tn.Left (tn.Key :: loop tn.Right acc)
                      | _ ->  t'.Key :: acc
              loop t []         
  
          let copyToArray s (arr: _[]) i =
              let mutable j = i 
  