Commit 6e31cd1c by Christian Müller

### build approxElim

parent 4efe503d
 Workflow forallmay x:A,p:P True -> Conf += (x,p) True → Conf += (x,p) forallmay x:A,p:P !Conf(x,p) -> Assign += (x,p) !Conf(x,p) → Assign += (x,p) forall x:A,p:P (Assign(x,p) ∧ O(x,p)) -> Acc += (x,p) (Assign(x,p) ∧ O(x,p)) → Acc += (x,p) loop { forall xa:A,xb:A,p:P (Assign(xa,p) ∧ Acc(xb,p)) -> Read += (xa,xb,p) forallmay x:A,p:P (Assign(x,p) ∧ O(x,p)) -> Acc += (x,p) forall xa:A,xb:A,p:P (Assign(xa,p) ∧ Acc(xb,p)) → Read += (xa,xb,p) forallmay x:A,p:P (Assign(x,p)) → Acc += (x,p) } Declassify ... ...
 ... ... @@ -43,18 +43,23 @@ object Utils extends LazyLogging { ((t1 - t0) / 1000000, result) } def clear() { def recclear(folder: File) { for (fol <- folder.listFiles() if fol.isDirectory()) { recclear(fol) } folder.listFiles().foreach(_.delete()) private def recclear(folder: File) { for (fol <- folder.listFiles() if fol.isDirectory()) { recclear(fol) } folder.listFiles().foreach(_.delete()) } def clear() { val fol = new File(RESULTSFOLDER) fol.mkdirs() recclear(fol) } def clear(name:String) { val fol = new File(RESULTSFOLDER, name) fol.mkdirs() recclear(fol) } def write(dir: String, filename:String, prop: String) { val file = new File(s"\$RESULTSFOLDER/\$dir/\$filename") ... ... @@ -68,8 +73,21 @@ object Utils extends LazyLogging { logger.info(s"Written \$file") } def check(name:String, desc:String, spec:InvariantSpec, properties:InvProperties):Boolean = { clear(name) infer(name:String, desc:String, spec:InvariantSpec, properties:InvProperties) } def check(name:String, desc:String, inv:NISpec => Formula, properties:InvProperties):Boolean = { val spec = Examples.parseExampleWF(name).get check(name, desc, inv, spec, properties) } def check(name: String, desc:String, inv:NISpec => Formula, spec:NISpec, properties: InvProperties):Boolean = { clear(name) val basename = name.split("/").last val filenames = s"\$basename\${if (desc.isEmpty) "" else s"_\$desc"}" ... ... @@ -82,7 +100,7 @@ object Utils extends LazyLogging { check(name, desc, invspec, properties) } def check(name:String, desc:String, spec:InvariantSpec, properties:InvProperties):Boolean = { private def infer(name:String, desc:String, spec:InvariantSpec, properties:InvProperties):Boolean = { val model = if (properties.stubborn) "stubborn" else "causal" val basename = name.split("/").last ... ... @@ -111,9 +129,9 @@ object Utils extends LazyLogging { val labels = (for ((node, inv) <- labelling.last) yield { s"Node \${node}:\n\${inv.pretty}\n" }).mkString("\n") Utils.write(name, s"\$filenames.invariants", labels) val wfsize = graph.edges.size - 1 val invsizes = labelling.last.map(_._2.opsize) val maxsize = invsizes.max ... ... @@ -134,9 +152,4 @@ object Utils extends LazyLogging { ) res } def check(name:String, desc:String, inv:NISpec => Formula, properties:InvProperties):Boolean = { val spec = Examples.parseExampleWF(name).get check(name, desc, inv, spec, properties) } } \ No newline at end of file
 package de.tum.niwo.blocks import de.tum.niwo.foltl.FOLTL.{And, Formula, Or} import de.tum.niwo.foltl.FormulaFunctions object Saturator { def saturate(ts:TransitionSystem): TransitionSystem = { val allpredicates = ts.sig.allpredicates def saturateGuard(f:Formula) = { val (quantifiers, clauses) = FormulaFunctions.toCNFClauses(f) // part 1: Add equalities in CNF // FIXME: this may add too many eqs, since annotations T1, T2 are ignored val witheqs = for (c <- clauses) yield { val ineqs = for (pred <- allpredicates; pos <- FormulaFunctions.getPositiveArguments(c, pred.name); neg <- FormulaFunctions.getNegativeArguments(c, pred.name) ) yield { FormulaFunctions.eq(pos, neg) } c ++ ineqs } // do not rewrap quantifiers here val cnfwitheqs = And.make(witheqs.map(Or.make)) // part 2: Add inequalities in DNF val (_, dnfclauses) = FormulaFunctions.toDNFClauses(cnfwitheqs) val withineqs = for (c <- dnfclauses) yield { val ineqs = for (pred <- allpredicates; pos <- FormulaFunctions.getPositiveArguments(c, pred.name); neg <- FormulaFunctions.getNegativeArguments(c, pred.name) ) yield { FormulaFunctions.ineq(pos, neg) } c ++ ineqs } val dnfwithineqs = Or.make(withineqs.map(And.make)) // val theta = dnfwithineqs.toCNF // FIXME this should use theta if equalities would actually be introduced val newform = FormulaFunctions.rewrapQuantifiers(quantifiers, cnfwitheqs).simplify newform } val newsteps = ts.steps.map(_.mapStatements{ case SetStmt(guard, fun, tuple) => SetStmt(saturateGuard(guard), fun, tuple) }) ts.copy(steps = newsteps) } }