mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-07 03:35:38 -05:00
59 lines
1.6 KiB
OCaml
59 lines
1.6 KiB
OCaml
(*
|
|
MSAT is free software, using the Apache license, see file LICENSE
|
|
Copyright 2015 Guillaume Bury
|
|
*)
|
|
|
|
module type S = Backend_intf.S
|
|
|
|
module type Arg = sig
|
|
|
|
type proof
|
|
type lemma
|
|
type formula
|
|
|
|
val print : Format.formatter -> formula -> unit
|
|
val prove : Format.formatter -> lemma -> unit
|
|
val context : Format.formatter -> proof -> unit
|
|
end
|
|
|
|
module Make(S : Res.S)(A : Arg with type formula := S.St.formula and type lemma := S.lemma and type proof := S.proof) = struct
|
|
|
|
let pp_nl fmt = Format.fprintf fmt "@\n"
|
|
let fprintf fmt format = Format.kfprintf pp_nl fmt format
|
|
|
|
let clause_name c = S.St.(c.name)
|
|
|
|
let pp_clause fmt c =
|
|
let rec aux fmt = function
|
|
| [] -> ()
|
|
| a :: r ->
|
|
let f, pos =
|
|
if S.St.(a.var.pa == a) then
|
|
S.St.(a.lit), true
|
|
else
|
|
S.St.(a.neg.lit), false
|
|
in
|
|
fprintf fmt "%s _b %a ->@ %a"
|
|
(if pos then "_pos" else "_neg") A.print f aux r
|
|
in
|
|
fprintf fmt "_b : Prop ->@ %a ->@ _proof _b" aux (S.to_list c)
|
|
|
|
let context fmt p =
|
|
fprintf fmt "(; Embedding ;)";
|
|
fprintf fmt "Prop : Type.";
|
|
fprintf fmt "_proof : Prop -> Type.";
|
|
fprintf fmt "(; Notations for clauses ;)";
|
|
fprintf fmt "_pos : Prop -> Prop -> Type.";
|
|
fprintf fmt "_neg : Prop -> Prop -> Type.";
|
|
fprintf fmt "[b: Prop, p: Prop] _pos b p --> _proof p -> _proof b.";
|
|
fprintf fmt "[b: Prop, p: Prop] _neg b p --> _pos b p -> _proof b.";
|
|
A.context fmt p
|
|
|
|
let print fmt p =
|
|
fprintf fmt "#NAME Proof.";
|
|
fprintf fmt "(; Dedukti file automatically generated by mSAT ;)";
|
|
context fmt p;
|
|
()
|
|
|
|
end
|
|
|