This GitLab instance reached the end of its service life. It won't be possible to create new users or projects.

Please read the deprecation notice for more information concerning the deprecation timeline

Visit migration.git.tu-berlin.de (internal network only) to import your old projects to the new GitLab platform 📥

NaiveDivergenceFinder.scala 997 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
package de.bbisping.coupledsim.algo

import de.bbisping.coupledsim.ts.TransitionSystem
import de.bbisping.coupledsim.util.FixedPoint
import de.bbisping.coupledsim.util.Coloring
import de.bbisping.coupledsim.ts.WeakTransitionSystem

class NaiveDivergenceFinder[S, A, L] (
    ts: WeakTransitionSystem[S, A, L]) {
  
  /** all tau-states are 0, the others are 1. */
  val labelColors = {
    Coloring(
      ts.nodes map { n =>
//        if (ts.silentNodes contains n) {
//          (n, 0)
//        } else {
//          (n, 1)
//        }
        (n, 1)
      } toMap 
    )
  }
  
  // coinductive: "divergent_state p' ⟹ tau t ∧ p ⟼t p'⟹ divergent_state p"
  
  def compute() = {

    FixedPoint[Coloring[S]] (
      { p => 
        p map { (s, cs) =>
          if (cs == 0 && ts.post(s).exists { case (l, ee2) => ts.silentActions(l) && ee2.exists(p(_) == 0) } ) {
            0
          } else {
            1
          }
        }
      },
      _ == _
    ) (labelColors)
    
  }
  
}