Research Article

Behaviour Preservation across Code Versions in Erlang

Algorithm 1

Instrumentation rules for tracing.
(LEFT_PM)p = e p = begin np = e, tracer!add, npoi, np end
    if   (p = e, _ ) =
      ( _,p)) =
  where  ( _, npoi, np) = p,
(PAT_GEN_LC) [e ∣∣ gg] [e ∣∣  ngg]
     if   ([e ∣∣ gg], _ ) =
          ( _,(p_gen)) =
        (gg) s.t. = p_gen <- e_gen
   where   ( _, npoi, np_gen) = p_gen
         = p_gen <- begin tracer!add, npoi, [np_gen] end
        ngg = , np_gen <- e_gen,
(CLAUSE_PAT) echange_clauses(e, ncls)
     if    (e, _ ) = last(PathBefore)
        ∧  ( _, pos(p_c)) =
        . 1 ≤ length(cls) s.t. p_c when g_c -> b_c
   where   cls = clauses(e)
          ( _, npoi, np_c) = pfv(p_c, tl(PathAfter))
        nb_c = begin tracer!add, npoi, case np_c of cls end end
        ncls_i = np_c when true -> nb_c
        
(CLAUSE_GUARD) echange_clauses(e, ncls)
      if   (e, _ ) =
          ( _, pos(g_c)) =
        . 1 ≤ length(cls) s.t. = p_c when g_c -> b_c
    where   cls = clauses(e)
          (poi, _ ) = last(PathAfter)
        nb_c = begin tracer!add, poi, case np_c of cls end end
        ncl = p_c when true -> nb_c
        ncls =
(EXPR)     e begin fv = e, tracer!add, fv, fv end
otherwise
 where    (e, _ ) = last(PathAfter) ∧ fv =