Skip to content
Snippets Groups Projects
Commit 46d4b2bf authored by Thorsten Wißmann's avatar Thorsten Wißmann :guitar:
Browse files

Add prov task

parent cae4b8d1
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*) *)
module CM = CoAlgMisc module CM = CoAlgMisc
module CF = CoAlgFormula
(* The type of formulae that are accepted. *) (* The type of formulae that are accepted. *)
(* (*
...@@ -36,7 +37,7 @@ let _ = Gc.set { (Gc.get()) with Gc.minor_heap_size = 4194304; major_heap_increm ...@@ -36,7 +37,7 @@ let _ = Gc.set { (Gc.get()) with Gc.minor_heap_size = 4194304; major_heap_increm
let printUsage () = let printUsage () =
print_endline "Usage: \"alc <task> <functor> [<flags>]\" where"; print_endline "Usage: \"alc <task> <functor> [<flags>]\" where";
print_endline " <task> in { sat print }"; print_endline " <task> in { sat print prov (is \f -> not (sat (not f))) }";
print_endline " <functor> in { MultiModalK MultiModalKD CoalitionLogic GML"; print_endline " <functor> in { MultiModalK MultiModalKD CoalitionLogic GML";
print_endline " (or: K) (or: KD) (or: CL) }"; print_endline " (or: K) (or: KD) (or: CL) }";
print_endline " <flags> = a list of the following items"; print_endline " <flags> = a list of the following items";
...@@ -79,15 +80,39 @@ let choiceSat () = ...@@ -79,15 +80,39 @@ let choiceSat () =
while true do while true do
let input = read_line () in let input = read_line () in
if not (GenAndComp.isEmptyString input) then if not (GenAndComp.isEmptyString input) then
let (f, tbox) = CoAlgFormula.importQuery input in let (tbox, f) = CoAlgFormula.importQuery input in
incr counter; incr counter;
print_string ("\nFormula " ^ (string_of_int !counter) ^ ": "); print_string ("\nFormula " ^ (string_of_int !counter) ^ ": ");
flush stdout; flush stdout;
printRes (CoAlgReasoner.isSat ~verbose:verb sorts nomTable f tbox) printRes (CoAlgReasoner.isSat ~verbose:verb sorts nomTable tbox f)
else () else ()
done done
with End_of_file -> () with End_of_file -> ()
let choiceProvable () =
let verb = !verbose in
let sorted_not ((s,f):CF.sortedFormula) : CF.sortedFormula =
(s,CF.NOT f)
in
let sorts = [| (parseFunctor Sys.argv.(2), [0]) |] in
let printRes sat =
if not verb then
print_endline (if not sat then "provable\n" else "unprovable\n")
else ()
in
try
while true do
let input = read_line () in
if not (GenAndComp.isEmptyString input) then
let (tbox,f) = CoAlgFormula.importQuery input in
let fneg = sorted_not f in
incr counter;
print_string ("\nFormula " ^ (string_of_int !counter) ^ ": ");
flush stdout;
printRes (CoAlgReasoner.isSat ~verbose:verb sorts nomTable tbox fneg)
else ()
done
with End_of_file -> ()
let choicePrint () = let choicePrint () =
try try
while true do while true do
...@@ -130,6 +155,7 @@ let _ = ...@@ -130,6 +155,7 @@ let _ =
parseFlags Sys.argv 3; parseFlags Sys.argv 3;
match choice with match choice with
| "sat" -> choiceSat () | "sat" -> choiceSat ()
| "prov" -> choiceProvable ()
| "print" -> choicePrint () | "print" -> choicePrint ()
| _ -> printUsage () | _ -> printUsage ()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment