Unverified Commit 1ed47632 authored by Merlin's avatar Merlin 💧
Browse files

Bit of refactoring and got it to compile

parent 1853b71b
Pipeline #13729 waiting for manual action with stages
......@@ -282,6 +282,10 @@ let lhtFind lht lit =
try
Some (LHt.find lht lit)
with Not_found -> None
let lhtMustFind lht l =
match lhtFind lht l with
| Some f -> f
| None -> assert false
let fhtInit () = FHt.create 16
let fhtAdd fht f lit = FHt.add fht f lit
......@@ -289,6 +293,10 @@ let fhtFind fht f =
try
Some (FHt.find fht f)
with Not_found -> None
let fhtMustFind fht f =
match fhtFind fht f with
| Some l -> l
| None -> assert false
let fhtReset fht = FHt.reset fht
let nhtInit () = NHt.create 8
......
......@@ -132,10 +132,12 @@ val formulaTypeIsModality: formulaType -> bool
val lhtInit : unit -> lht
val lhtAdd : lht -> Minisat_cool.lit -> localFormula -> unit
val lhtFind : lht -> Minisat_cool.lit -> localFormula option
val lhtMustFind : lht -> Minisat_cool.lit -> localFormula
val fhtInit : unit -> fht
val fhtAdd : fht -> localFormula -> Minisat_cool.lit -> unit
val fhtFind : fht -> localFormula -> Minisat_cool.lit option
val fhtMustFind : fht -> localFormula -> Minisat_cool.lit
val fhtReset : fht -> unit
val nhtInit : unit -> nht
......
This diff is collapsed.
(** A graph-tableau-based decision procedure framework for coalgebraic logics.
@author Florian Widmann
*)
open FocusTracking
module PG = Paritygame
module F = CoAlgFormula
module M = CoAlgMisc
type sortTable = (CoAlgMisc.functors * int list) array
type sortTable = M.sortTable
type nomTable = string -> F.sort option
type nomTable = string -> CoAlgFormula.sort option
type assumptions = F.sortedFormula list
type assumptions = CoAlgFormula.sortedFormula list
type input = sortTable * nomTable * assumptions * F.sortedFormula
type input = sortTable * nomTable * assumptions * CoAlgFormula.sortedFormula
type game_solver = PGSolver of PG.global_solver
| PGSolverLocal of PG.partial_solver
| Cool
exception ReasonerError of string
module R_com = CoAlgReasoner_common
module type S = sig
module G : CoolGraph.S
(** Specifies when cool propagates sat/unsat information. *)
(*type propagation_rate = G.propagation_rate =
| Once (** Propagate only when the tableaux is fully expanded *)
| Adaptive (** Automatic mode based on the number of open states *)
| Fixed of int (** Propagate after this many expansion steps *)
type game_solver = PGSolver of Paritygame.global_solver
| PGSolverLocal of Paritygame.partial_solver
| Cool*)
val isSat : ?verbose:bool -> CoAlgMisc.fragment_spec -> game_solver
-> G.propagation_rate -> M.sortTable
-> (string -> F.sort option) ->
F.sortedFormula list -> F.sortedFormula -> bool
val isSat : ?verbose:bool -> CoAlgMisc.fragment_spec -> R_com.game_solver
-> R_com.propagation_rate -> sortTable
-> (string -> CoAlgFormula.sort option) ->
CoAlgFormula.sortedFormula list -> CoAlgFormula.sortedFormula -> bool
val initReasoner : CoAlgMisc.fragment_spec -> R_com.game_solver -> R_com.propagation_rate
-> sortTable -> (string -> CoAlgFormula.sort option) ->
CoAlgFormula.sortedFormula list
-> CoAlgFormula.sortedFormula -> unit
val initReasoner : CoAlgMisc.fragment_spec -> game_solver -> G.propagation_rate
-> sortTable -> (string -> F.sort option) ->
F.sortedFormula list
-> F.sortedFormula -> unit
(** Run a single step of the reasoner. That is: Expand one node and perform sat
propagation.
......@@ -50,7 +37,3 @@ val reasonerFinished : unit -> bool
val isRootSat : unit -> bool option
end
module Make (T : FocusTracker) : S
(* vim: set et sw=2 sts=2 ts=8 : *)
......@@ -9,43 +9,10 @@ module M = Minisat_cool
module CU = CoolUtils
module PG = Paritygame
module C = CoAlgFormula
module R_com = CoAlgReasoner_common
type sortTable = CoAlgMisc.sortTable
type nomTable = string -> CoAlgFormula.sort option
type assumptions = CoAlgFormula.sortedFormula list
type input = sortTable * nomTable * assumptions * CoAlgFormula.sortedFormula
module R_com = CoAlgReasoner
exception ReasonerError of string
module type S = sig
module G : CoolGraph.S
val isSat : ?verbose:bool -> CoAlgMisc.fragment_spec -> R_com.game_solver
-> R_com.propagation_rate -> sortTable
-> (string -> CoAlgFormula.sort option) ->
CoAlgFormula.sortedFormula list -> CoAlgFormula.sortedFormula -> bool
val initReasoner : CoAlgMisc.fragment_spec -> R_com.game_solver -> R_com.propagation_rate
-> sortTable -> (string -> CoAlgFormula.sort option) ->
CoAlgFormula.sortedFormula list
-> CoAlgFormula.sortedFormula -> unit
(** Run a single step of the reasoner. That is: Expand one node and perform sat
propagation.
This is used in the debugger.
*)
val runReasonerStep : unit -> unit
val reasonerFinished : unit -> bool
val isRootSat : unit -> bool option
end
module Make(T : FocusTracker) = struct
module G = CoolGraph.Make(T)
module Logics = CoAlgLogics.Make(T)
......@@ -702,16 +669,6 @@ let solveGameWithPGsolverLocal algo =
(* Node Expansions *)
(*****************************************************************************)
let fhtMustFind fht f =
match fhtFind fht f with
| Some l -> l
| None -> assert false
let lhtMustFind lht l =
match lhtFind lht l with
| Some f -> f
| None -> assert false
let getLit sort fht solver f =
match fhtFind fht f with
| Some lit -> lit
......
(** A one-step function based decision procedure framework for coalgebraic logics.
@author Florian Widmann
*)
open FocusTracking
module R_com = CoAlgReasoner
module Make (T : FocusTracker) : R_com.S
(* vim: set et sw=2 sts=2 ts=8 : *)
This diff is collapsed.
(** A graph-tableau-based decision procedure framework for coalgebraic logics.
@author Florian Widmann
*)
open FocusTracking
module R_com = CoAlgReasoner
module Make (T : FocusTracker) : R_com.S
(* vim: set et sw=2 sts=2 ts=8 : *)
......@@ -226,16 +226,6 @@ let isConstraintUnsat cset =
| Some UnsatC -> true
| _ -> false
let fhtMustFind fht f =
match fhtFind fht f with
| Some l -> l
| None -> assert false
let lhtMustFind lht l =
match lhtFind lht l with
| Some f -> f
| None -> assert false
(* Gets a list of Things we know are unsatisfiable and propagates this
information backwards *)
let rec propagateUnsat = function
......
module PG = Paritygame
(*module type S = sig
module G : CoolGraph.S*)
type game_solver = PGSolver of PG.global_solver
| PGSolverLocal of Paritygame.partial_solver
| Cool
(*Hier noch G.propagation_rate einfügen, siehe git*)
type propagation_rate (*= G.propagation_rate*) = Once | Adaptive | Fixed of int
(** A graph-tableau-based decision procedure framework for coalgebraic logics.
@author Florian Widmann
*)
open FocusTracking
type sortTable = (CoAlgMisc.functors * int list) array
type nomTable = string -> CoAlgFormula.sort option
type assumptions = CoAlgFormula.sortedFormula list
type input = sortTable * nomTable * assumptions * CoAlgFormula.sortedFormula
exception ReasonerError of string
module R_com = CoAlgReasoner_common
module type S = sig
module G : CoolGraph.S
(** Specifies when cool propagates sat/unsat information. *)
(* type propagation_rate = G.propagation_rate =
| Once (** Propagate only when the tableaux is fully expanded *)
| Adaptive (** Automatic mode based on the number of open states *)
| Fixed of int (** Propagate after this many expansion steps *)
type game_solver = PGSolver of Paritygame.global_solver
| PGSolverLocal of Paritygame.partial_solver
| Cool
*)
val isSat : ?verbose:bool -> CoAlgMisc.fragment_spec -> R_com.game_solver
-> R_com.propagation_rate -> sortTable
-> (string -> CoAlgFormula.sort option) ->
CoAlgFormula.sortedFormula list -> CoAlgFormula.sortedFormula -> bool
val initReasoner : CoAlgMisc.fragment_spec -> R_com.game_solver -> R_com.propagation_rate
-> sortTable -> (string -> CoAlgFormula.sort option) ->
CoAlgFormula.sortedFormula list
-> CoAlgFormula.sortedFormula -> unit
(** Run a single step of the reasoner. That is: Expand one node and perform sat
propagation.
This is used in the debugger.
*)
val runReasonerStep : unit -> unit
val reasonerFinished : unit -> bool
val isRootSat : unit -> bool option
end
module Make (T : FocusTracker) : S
(* vim: set et sw=2 sts=2 ts=8 : *)
......@@ -2,7 +2,10 @@
open Cool
open OUnit2
module FP = FunctorParsing
module CR = CoAlgReasoner.Make(FocusTracking.PartialPermutationTracker)
module G = CoolGraph
module CR = CoAlgReasoner
module CRT = CoAlgReasonerOneStepTableau.Make(FocusTracking.PartialPermutationTracker)
module CRF = CoAlgReasonerOneStepFun.Make(FocusTracking.PartialPermutationTracker)
type testResult = | Sat
| Unsat
......@@ -41,7 +44,7 @@ let runSatCheck logic input =
(* isSat leaks tons of memory. Call it in new process to allow the OS to
reclaim that memory between calls. *)
match Unix.fork () with
| 0 -> let res = CR.isSat CoAlgMisc.Auto CR.Cool CR.Adaptive logic nomTable tbox f in
| 0 -> let res = CRT.isSat CoAlgMisc.Auto CR.Cool CRT.G.Adaptive logic nomTable tbox f in
if res then exit 0 else exit 1
| -1 -> raise (CoAlgFormula.CoAlgException "fork() failed")
| _ -> match Unix.wait () with
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment