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