Skip to content

Commit a58264b

Browse files
authored
Correct lambdapi and dedukti outputs for GDV (#53)
* Take -gdv into account also for the Dedukti output * Add requirements in the lambdapi output even when the -gdv flag is on
1 parent e418965 commit a58264b

4 files changed

Lines changed: 20 additions & 16 deletions

File tree

‎dkprint.ml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,13 @@ and print_dk_cst o t =
7777
if Mltoll.is_meta s then fprintf o "zenon.select (zenon.iota)"
7878
else
7979
begin
80-
if !Globals.signature_name = "" then fprintf o "%s" (escape_name s)
81-
else fprintf o "%s.%s" !Globals.signature_name (escape_name s);
80+
let prefix =
81+
if !Globals.signature_name = "" then
82+
if !Globals.gdv then "Signature."
83+
else ""
84+
else !Globals.signature_name ^ "."
85+
in
86+
fprintf o "%s%s" prefix (escape_name s);
8287
if !Globals.conjecture <> ""
8388
&& not !Globals.check_axiom && Typetptp.is_axiom s then
8489
fprintf o " __negated_conjecture_proof__"

‎lltodk.ml‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,9 @@ let output oc phrases llp =
10341034
let prooftree = extract_prooftree llp in
10351035
let dkproof = make_proof_term (List.hd goal) prooftree in
10361036
fprintf oc "#REQUIRE zenon;\n\n";
1037-
if !Globals.signature_name = "" then List.iter (print_line oc) dksigs;
1037+
if !Globals.ctx_flag then List.iter (print_line oc) dksigs;
10381038
fprintf oc "\n";
1039-
if !Globals.signature_name = "" then List.iter (print_line oc) dkctx;
1039+
if !Globals.ctx_flag then List.iter (print_line oc) dkctx;
10401040
fprintf oc "\n";
10411041
List.iter (print_line oc) dkrules;
10421042
fprintf oc "\n";
@@ -1062,18 +1062,18 @@ let output_term oc phrases _ llp =
10621062
let dkproof = make_proof_term (List.hd goal) prooftree in
10631063
fprintf oc "#REQUIRE zenon.\n";
10641064
let sig_name = !Globals.signature_name in
1065-
if sig_name <> "" then
1066-
begin
1065+
if sig_name <> "" then begin
10671066
fprintf oc "#REQUIRE %s.\n" !Globals.signature_name;
1068-
fprintf oc "\n[] %s.%s --> " !Globals.signature_name goal_name
1069-
end
1067+
fprintf oc "\n[] %s.%s --> " !Globals.signature_name goal_name end
1068+
else if !Globals.gdv then
1069+
fprintf oc "\n[] Signature.%s --> " goal_name
10701070
else fprintf oc "\n[] %s --> " goal_name;
10711071
if !Globals.conjecture <> "" then
10721072
fprintf oc "__negated_conjecture_proof__ : \
10731073
zenon.proof (zenon.not %slambdapi__conjecture) =>\n"
1074-
(if sig_name <> "" then sig_name^"." else "");
1074+
(if sig_name <> "" then sig_name^"." else if !Globals.gdv then "Signature." else "");
10751075
fprintf oc "zenon.nnpp (%a)\n(%a)"
10761076
print_dk_term dkgoal print_dk_term dkproof;
1077-
if sig_name <> "" then fprintf oc ".";
1077+
if !Globals.gdv then fprintf oc ".";
10781078
fprintf oc "\n";
10791079
[]

‎lltolp.ml‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,13 +1059,12 @@ let output_term oc phrases _ llp =
10591059
let prooftree = extract_prooftree llp in
10601060
let goal_name = (List.hd llp).name in
10611061
let dkproof = make_proof_term (List.hd goal) prooftree in
1062+
fprintf oc "require open Stdlib.Prop Stdlib.Set Stdlib.Eq Stdlib.FOL \
1063+
Logic.Zenon.Main;\n";
10621064
if !Globals.gdv then
10631065
fprintf oc "\nrule F.%s ↪ " goal_name
1064-
else begin
1065-
fprintf oc "require open Stdlib.Prop Stdlib.Set Stdlib.Eq Stdlib.FOL \
1066-
Logic.Zenon.Main;\n";
1067-
fprintf oc "\nsymbol %s ≔ " goal_name
1068-
end;
1066+
else
1067+
fprintf oc "\nsymbol %s ≔ " goal_name;
10691068
if !Globals.conjecture <> "" then
10701069
fprintf oc "λ __negated_conjecture_proof__,";
10711070
begin

‎main.ml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ let argspec = [
218218
"-sig", Arg.String (fun s -> Globals.signature_name := s),
219219
"<n> set the module path of the signature";
220220
"-gdv", Arg.Set Globals.gdv,
221-
" use the format expected by GDV for the lambdapi output";
221+
" use the format expected by GDV for the lambdapi and dedukti outputs";
222222
"-odkterm", Arg.Unit (fun () -> proof_level := Proof_dkterm;
223223
opt_level := 0;
224224
Globals.output_dk := true),

0 commit comments

Comments
 (0)