anchor.diff:      lists:foldl(FolderFun, new(), V).
   
   %% @private
  -cross_provenance(ProvenanceL, ProvenanceR) ->
  -    ordsets:fold(
  -      fun(DotL, AccCrossProvenance0) ->
  -              ordsets:fold(
  -                fun(DotR, AccCrossProvenance1) ->
  -                        CrossDot = ordsets:union(DotL, DotR),
  -                        ordsets:add_element(CrossDot, AccCrossProvenance1)
  -                end, AccCrossProvenance0, ProvenanceR)
  -      end, ordsets:new(), ProvenanceL).
  -
  -%% @private
  -subtract_removed(Provenance, ValidEvents) ->
  -    ordsets:fold(
  -      fun(Dot, AccNewProvenance0) ->
  -              case ordsets:intersection(Dot, ValidEvents) of
  -                  Dot ->
  -                      ordsets:add_element(Dot, AccNewProvenance0);
  -                  _ ->
  -                      AccNewProvenance0
  -              end
  -      end, ordsets:new(), Provenance).
  -
  -%% @private
   join_all_events({vclock, AllEventsA}, {vclock, AllEventsB}) ->
       {JoinedAllEvents, RestB} =
           lists:foldl(
  
positive.code:                                                     IntersectElem =
                                                          get_inter_elem(ElemL, ElemR),
                                                      IntersectProvenance =
                                                          cross_provenance(
                                                            RestProvenanceL,
                                                            RestProvenanceR),
                                                      ordsets:fold(
  
negative.code:     {IntersectElemDataStore, IntersectEventDataStore} =
          orddict:fold(
            fun(ElemL, ProvenanceL, AccIntersectDataStore0) ->
                    case state_oorset_ps:subtract_removed(ProvenanceL, ValidEventsL1) of
                        [] ->
                            AccIntersectDataStore0;
                        RestProvenanceL ->
                            orddict:fold(
                              fun(ElemR, ProvenanceR, AccIntersectDataStore1) ->
                                      case state_oorset_ps:subtract_removed(
                                             ProvenanceR, ValidEventsR1) of
                                          [] ->
                                              AccIntersectDataStore1;
                                          RestProvenanceR ->
  