Unverified Commit 196d1de9 authored by Merlin's avatar Merlin 💧
Browse files

Executables compiling

parent efa16205
Pipeline #13738 waiting for manual action with stages
...@@ -13,16 +13,18 @@ type game_solver = PGSolver of PG.global_solver ...@@ -13,16 +13,18 @@ type game_solver = PGSolver of PG.global_solver
| PGSolverLocal of PG.partial_solver | PGSolverLocal of PG.partial_solver
| Cool | Cool
exception ReasonerError of string
module type S = sig module type S = sig
module G : CoolGraph.S module G : CoolGraph.S
val isSat : ?verbose:bool -> CoAlgMisc.fragment_spec -> game_solver val isSat : ?verbose:bool -> CoAlgMisc.fragment_spec -> game_solver
-> G.propagation_rate -> sortTable -> CoolGraph.propagation_rate -> sortTable
-> (string -> F.sort option) -> -> (string -> F.sort option) ->
F.sortedFormula list -> F.sortedFormula -> bool F.sortedFormula list -> F.sortedFormula -> bool
val initReasoner : CoAlgMisc.fragment_spec -> game_solver -> G.propagation_rate val initReasoner : CoAlgMisc.fragment_spec -> game_solver -> CoolGraph.propagation_rate
-> sortTable -> (string -> F.sort option) -> -> sortTable -> (string -> F.sort option) ->
F.sortedFormula list F.sortedFormula list
-> F.sortedFormula -> unit -> F.sortedFormula -> unit
......
...@@ -13,15 +13,17 @@ type game_solver = PGSolver of PG.global_solver ...@@ -13,15 +13,17 @@ type game_solver = PGSolver of PG.global_solver
| PGSolverLocal of PG.partial_solver | PGSolverLocal of PG.partial_solver
| Cool | Cool
exception ReasonerError of string
module type S = sig module type S = sig
module G : CoolGraph.S module G : CoolGraph.S
val isSat : ?verbose:bool -> CoAlgMisc.fragment_spec -> game_solver val isSat : ?verbose:bool -> CoAlgMisc.fragment_spec -> game_solver
-> G.propagation_rate -> M.sortTable -> CoolGraph.propagation_rate -> M.sortTable
-> (string -> F.sort option) -> -> (string -> F.sort option) ->
F.sortedFormula list -> F.sortedFormula -> bool F.sortedFormula list -> F.sortedFormula -> bool
val initReasoner : CoAlgMisc.fragment_spec -> game_solver -> G.propagation_rate val initReasoner : CoAlgMisc.fragment_spec -> game_solver -> CoolGraph.propagation_rate
-> sortTable -> (string -> F.sort option) -> -> sortTable -> (string -> F.sort option) ->
F.sortedFormula list F.sortedFormula list
-> F.sortedFormula -> unit -> F.sortedFormula -> unit
......
...@@ -11,8 +11,6 @@ module PG = Paritygame ...@@ -11,8 +11,6 @@ module PG = Paritygame
module C = CoAlgFormula module C = CoAlgFormula
module R_com = CoAlgReasoner module R_com = CoAlgReasoner
exception ReasonerError of string
module Make(T : FocusTracker) = struct module Make(T : FocusTracker) = struct
module G = CoolGraph.Make(T) module G = CoolGraph.Make(T)
module Logics = CoAlgLogics.Make(T) module Logics = CoAlgLogics.Make(T)
...@@ -190,7 +188,7 @@ let rec propagateUnsat = function ...@@ -190,7 +188,7 @@ let rec propagateUnsat = function
| UState (state, _idxopt) -> begin | UState (state, _idxopt) -> begin
match stateGetStatus state with match stateGetStatus state with
| Unsat -> tl | Unsat -> tl
| Sat -> raise (ReasonerError ("Propagation tells state " | Sat -> raise (R_com.ReasonerError ("Propagation tells state "
^(string_of_int (stateGetIdx state)) ^(string_of_int (stateGetIdx state))
^" would be unsat, but it is already sat")) ^" would be unsat, but it is already sat"))
| Open | Open
...@@ -224,7 +222,7 @@ let rec propagateUnsat = function ...@@ -224,7 +222,7 @@ let rec propagateUnsat = function
| UCore (core, comesFromCnstr) -> begin | UCore (core, comesFromCnstr) -> begin
match coreGetStatus core with match coreGetStatus core with
| Unsat -> tl | Unsat -> tl
| Sat -> raise (ReasonerError ("Propagation tells core " | Sat -> raise (R_com.ReasonerError ("Propagation tells core "
^(string_of_int (coreGetIdx core)) ^(string_of_int (coreGetIdx core))
^" would be unsat, but it is already sat")) ^" would be unsat, but it is already sat"))
| Open | Open
......
...@@ -10,8 +10,6 @@ module CU = CoolUtils ...@@ -10,8 +10,6 @@ module CU = CoolUtils
module PG = Paritygame module PG = Paritygame
module R_com = CoAlgReasoner module R_com = CoAlgReasoner
exception ReasonerError of string
module Make(T : FocusTracker) = struct module Make(T : FocusTracker) = struct
module G = CoolGraph.Make(T) module G = CoolGraph.Make(T)
module Logics = CoAlgLogics.Make(T) module Logics = CoAlgLogics.Make(T)
...@@ -186,7 +184,7 @@ let rec propagateUnsat = function ...@@ -186,7 +184,7 @@ let rec propagateUnsat = function
| UState (state, _idxopt) -> begin | UState (state, _idxopt) -> begin
match stateGetStatus state with match stateGetStatus state with
| Unsat -> tl | Unsat -> tl
| Sat -> raise (ReasonerError ("Propagation tells state " | Sat -> raise (R_com.ReasonerError ("Propagation tells state "
^(string_of_int (stateGetIdx state)) ^(string_of_int (stateGetIdx state))
^" would be unsat, but it is already sat")) ^" would be unsat, but it is already sat"))
| Open | Open
...@@ -220,7 +218,7 @@ let rec propagateUnsat = function ...@@ -220,7 +218,7 @@ let rec propagateUnsat = function
| UCore (core, comesFromCnstr) -> begin | UCore (core, comesFromCnstr) -> begin
match coreGetStatus core with match coreGetStatus core with
| Unsat -> tl | Unsat -> tl
| Sat -> raise (ReasonerError ("Propagation tells core " | Sat -> raise (R_com.ReasonerError ("Propagation tells core "
^(string_of_int (coreGetIdx core)) ^(string_of_int (coreGetIdx core))
^" would be unsat, but it is already sat")) ^" would be unsat, but it is already sat"))
| Open | Open
...@@ -1055,8 +1053,6 @@ let reasonerFinished () = ...@@ -1055,8 +1053,6 @@ let reasonerFinished () =
| Sat -> true | Sat -> true
| Open -> queueIsEmpty () | Open -> queueIsEmpty ()
type propagation_rate = G.propagation_rate = Once | Adaptive | Fixed of int
(** A graph-tableau-based decision procedure framework for coalgebraic logics. (** A graph-tableau-based decision procedure framework for coalgebraic logics.
@param verbose An optional switch which determines @param verbose An optional switch which determines
whether the procedure shall print some information on the standard output. whether the procedure shall print some information on the standard output.
......
This diff is collapsed.
(** 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 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 -> ?onestep:bool
-> CoAlgMisc.fragment_spec -> game_solver
-> propagation_rate -> sortTable
-> (string -> CoAlgFormula.sort option) ->
CoAlgFormula.sortedFormula list -> CoAlgFormula.sortedFormula -> bool
val initReasoner : ?onestep:bool
-> CoAlgMisc.fragment_spec -> game_solver -> 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 : *)
...@@ -6,6 +6,8 @@ module L = List ...@@ -6,6 +6,8 @@ module L = List
module C = CoAlgFormula module C = CoAlgFormula
module HC = HashConsing module HC = HashConsing
type propagation_rate = Once | Adaptive | Fixed of int
module type S = sig module type S = sig
type focus type focus
...@@ -53,7 +55,6 @@ module type S = sig ...@@ -53,7 +55,6 @@ module type S = sig
val queueGetElement : unit -> queueElement val queueGetElement : unit -> queueElement
val queuePrettyStatus : unit -> string val queuePrettyStatus : unit -> string
type propagation_rate = Once | Adaptive | Fixed of int
val setPropagationRate : propagation_rate -> unit val setPropagationRate : propagation_rate -> unit
val getPropagationRate : unit -> propagation_rate val getPropagationRate : unit -> propagation_rate
...@@ -340,8 +341,6 @@ let queueGetElement () = ...@@ -340,8 +341,6 @@ let queueGetElement () =
let doNominalPropagation () = !doPropagation let doNominalPropagation () = !doPropagation
type propagation_rate = Once | Adaptive | Fixed of int
let prop_rate = ref Once let prop_rate = ref Once
let setPropagationRate p = prop_rate := p let setPropagationRate p = prop_rate := p
......
open FocusTracking open FocusTracking
open CoAlgMisc open CoAlgMisc
type propagation_rate = Once | Adaptive | Fixed of int
module type S = sig module type S = sig
type focus type focus
...@@ -48,7 +50,6 @@ module type S = sig ...@@ -48,7 +50,6 @@ module type S = sig
val queueGetElement : unit -> queueElement val queueGetElement : unit -> queueElement
val queuePrettyStatus : unit -> string val queuePrettyStatus : unit -> string
type propagation_rate = Once | Adaptive | Fixed of int
val setPropagationRate : propagation_rate -> unit val setPropagationRate : propagation_rate -> unit
val getPropagationRate : unit -> propagation_rate val getPropagationRate : unit -> propagation_rate
......
...@@ -44,7 +44,7 @@ let runSatCheck logic input = ...@@ -44,7 +44,7 @@ let runSatCheck logic input =
(* isSat leaks tons of memory. Call it in new process to allow the OS to (* isSat leaks tons of memory. Call it in new process to allow the OS to
reclaim that memory between calls. *) reclaim that memory between calls. *)
match Unix.fork () with match Unix.fork () with
| 0 -> let res = CRT.isSat CoAlgMisc.Auto CR.Cool CRT.G.Adaptive logic nomTable tbox f in | 0 -> let res = CRT.isSat CoAlgMisc.Auto CR.Cool G.Adaptive logic nomTable tbox f in
if res then exit 0 else exit 1 if res then exit 0 else exit 1
| -1 -> raise (CoAlgFormula.CoAlgException "fork() failed") | -1 -> raise (CoAlgFormula.CoAlgException "fork() failed")
| _ -> match Unix.wait () with | _ -> match Unix.wait () with
......
...@@ -9,9 +9,10 @@ open Cool ...@@ -9,9 +9,10 @@ open Cool
module CM = CoAlgMisc module CM = CoAlgMisc
module CF = CoAlgFormula module CF = CoAlgFormula
module EA = EAFormula module EA = EAFormula
module Reasoner = CoAlgReasoner.Make(FocusTracking.PartialPermutationTracker) module G = CoolGraph
module O_Reasoner = CoAlgReasoner_onestep.Make(FocusTracking.PartialPermutationTracker) module Reasoner = CoAlgReasonerOneStepTableau.Make(FocusTracking.PartialPermutationTracker)
module R_com = CoAlgReasoner_common module O_Reasoner = CoAlgReasonerOneStepFun.Make(FocusTracking.PartialPermutationTracker)
module R_com = CoAlgReasoner
module NF = Nom2fix module NF = Nom2fix
module FE = FunctorParsing module FE = FunctorParsing
...@@ -32,7 +33,7 @@ let _ = Gc.set { (Gc.get()) with Gc.minor_heap_size = 4194304; major_heap_increm ...@@ -32,7 +33,7 @@ let _ = Gc.set { (Gc.get()) with Gc.minor_heap_size = 4194304; major_heap_increm
type options = type options =
{ verbose : bool { verbose : bool
; fragment : CM.fragment_spec ; fragment : CM.fragment_spec
; prop_rate : R_com.propagation_rate ; prop_rate : G.propagation_rate
; game_solver : R_com.game_solver ; game_solver : R_com.game_solver
; onestep : bool ; onestep : bool
} }
...@@ -40,7 +41,7 @@ type options = ...@@ -40,7 +41,7 @@ type options =
let defaultOpts = let defaultOpts =
{ verbose = false { verbose = false
; fragment = CM.Auto ; fragment = CM.Auto
; prop_rate = R_com.Adaptive ; prop_rate = G.Adaptive
; game_solver = R_com.Cool ; game_solver = R_com.Cool
; onestep = false ; onestep = false
} }
...@@ -92,9 +93,9 @@ let options = ...@@ -92,9 +93,9 @@ let options =
^ " INTEGER: Propagate after this many expansion steps" ^ " INTEGER: Propagate after this many expansion steps"
; Args.argument = ; Args.argument =
let parse_prop_rate s = match s with let parse_prop_rate s = match s with
| "once" -> R_com.Once | "once" -> G.Once
| "adaptive" -> R_com.Adaptive | "adaptive" -> G.Adaptive
| _ -> try R_com.Fixed (int_of_string s) with | _ -> try G.Fixed (int_of_string s) with
| Failure _ -> raise (Args.ParseError ("Invalid integer: " ^ s)) | Failure _ -> raise (Args.ParseError ("Invalid integer: " ^ s))
in in
Args.Required_arg Args.Required_arg
...@@ -362,7 +363,7 @@ let _ = ...@@ -362,7 +363,7 @@ let _ =
| Args.Error e -> Printf.printf "%s\n\n" e; printUsage (Sys.argv.(0)) | Args.Error e -> Printf.printf "%s\n\n" e; printUsage (Sys.argv.(0))
| Args.Ok opts -> | Args.Ok opts ->
match opts.game_solver with match opts.game_solver with
| R_com.PGSolverLocal _ when opts.prop_rate <> R_com.Once -> | R_com.PGSolverLocal _ when opts.prop_rate <> G.Once ->
Printf.printf "Error: pgsolverlocal can not be used with intermediate propagation\n" Printf.printf "Error: pgsolverlocal can not be used with intermediate propagation\n"
| _ -> | _ ->
match choice with match choice with
......
...@@ -9,7 +9,8 @@ open Cool ...@@ -9,7 +9,8 @@ open Cool
module G = GenAndComp module G = GenAndComp
module C = CoAlgFormula module C = CoAlgFormula
module A = ALCFormula module A = ALCFormula
module Reasoner = CoAlgReasoner.Make(FocusTracking.FocusSet) module R = CoAlgReasoner
module Reasoner = CoAlgReasonerOneStepTableau.Make(FocusTracking.FocusSet)
open CoolUtils open CoolUtils
...@@ -126,7 +127,7 @@ let exportALCQuery tbox (_, f) = ...@@ -126,7 +127,7 @@ let exportALCQuery tbox (_, f) =
let solvCoalg sortTable args = let solvCoalg sortTable args =
G.evaluateFkt (fun (tbox, sf) -> Reasoner.isSat CoAlgMisc.Auto Reasoner.Cool Reasoner.Adaptive sortTable nomTable tbox sf) args G.evaluateFkt (fun (tbox, sf) -> Reasoner.isSat CoAlgMisc.Auto R.Cool CoolGraph.Adaptive sortTable nomTable tbox sf) args
let solvALC (tbox, sf) = let solvALC (tbox, sf) =
let args = exportALCQuery tbox sf in let args = exportALCQuery tbox sf in
......
...@@ -10,7 +10,8 @@ module CM = CoAlgMisc ...@@ -10,7 +10,8 @@ module CM = CoAlgMisc
module CF = CoAlgFormula module CF = CoAlgFormula
module FE = FunctorParsing module FE = FunctorParsing
module Reasoner = CoAlgReasoner.Make(FocusTracking.PartialPermutationTracker) module R = CoAlgReasoner
module Reasoner = CoAlgReasonerOneStepTableau.Make(FocusTracking.PartialPermutationTracker)
module G = Reasoner.G module G = Reasoner.G
(* A partial function mapping nominals to their sorts. *) (* A partial function mapping nominals to their sorts. *)
...@@ -101,7 +102,7 @@ let _ = ...@@ -101,7 +102,7 @@ let _ =
let formula = Sys.argv.(2) in let formula = Sys.argv.(2) in
let sorts = (FE.sortTableFromString Sys.argv.(1)) in let sorts = (FE.sortTableFromString Sys.argv.(1)) in
let (tbox, f) = CoAlgFormula.importQuery formula in let (tbox, f) = CoAlgFormula.importQuery formula in
Reasoner.initReasoner CoAlgMisc.Auto Reasoner.Cool Reasoner.Adaptive sorts nomTable tbox f; Reasoner.initReasoner CoAlgMisc.Auto R.Cool CoolGraph.Adaptive sorts nomTable tbox f;
let session = { let session = {
Repl.prompt = "> "; Repl.prompt = "> ";
Repl.bindings = Repl.addHelpBinding [ Repl.bindings = Repl.addHelpBinding [
......
...@@ -3,7 +3,8 @@ open Cool ...@@ -3,7 +3,8 @@ open Cool
open CoolUtils open CoolUtils
module OWLFP = OWLFunctionalParser module OWLFP = OWLFunctionalParser
module CF = CoAlgFormula module CF = CoAlgFormula
module CR = CoAlgReasoner.Make(FocusTracking.FocusSet) module R = CoAlgReasoner
module CR = CoAlgReasonerOneStepTableau.Make(FocusTracking.FocusSet)
module L = List module L = List
exception Exception of string exception Exception of string
...@@ -46,7 +47,7 @@ let consistency () = ...@@ -46,7 +47,7 @@ let consistency () =
| (_, []) -> raise (Exception "File needs to contain at least one ontology") | (_, []) -> raise (Exception "File needs to contain at least one ontology")
in in
let (sorts,nomTable,axioms) = OWL.to_coalg ontology in let (sorts,nomTable,axioms) = OWL.to_coalg ontology in
let cons = CR.isSat CoAlgMisc.Auto CR.Cool CR.Adaptive sorts nomTable axioms (0,CF.TRUE) in let cons = CR.isSat CoAlgMisc.Auto R.Cool CoolGraph.Adaptive sorts nomTable axioms (0,CF.TRUE) in
let cons = if cons then "yes" else "no" in let cons = if cons then "yes" else "no" in
let (ontoname, _) = ontology in let (ontoname, _) = ontology in
Printf.printf "%s consistent: %s\n" ontoname cons Printf.printf "%s consistent: %s\n" ontoname cons
......
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