Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tracing kernel #1309

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*.uo
*.ui
*.o
*.tr
*.tr.gz
.hollogs
.holobjs
.HOLMK
Expand Down
3 changes: 3 additions & 0 deletions Manual/Developers/developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ The experimental kernel can be selected by passing the `--expk` option to `build
The *OpenTheory kernel* is based on the experimental kernel, but adds proof-logging to the primitive inference rules so that OpenTheory theory packages can be exported from HOL.
This kernel can be selected by passing the `--otknl` option to `build`.

The *tracing kernel* uses the same proof-logging to the primitive inference rules as OpenTheory, but exports inference rules without additional translation.
This kernel can be selected by passing the `--trknl` option to `build`.

## Build Sequences

When `build` runs, it choreographs its calls to `Holmake` by referring to a specified sequence of directories.
Expand Down
2 changes: 1 addition & 1 deletion developers/git-regression-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ else
die "ML system \"$ML\" is not executable."
fi

case $kernel in --expk | --stdknl | --otknl ) : ;; * ) die "Bad kernel spec \"$kernel\"."
case $kernel in --expk | --stdknl | --otknl | --trknl) : ;; * ) die "Bad kernel spec \"$kernel\"."
esac

if git pull > update-log 2>&1
Expand Down
1 change: 1 addition & 0 deletions src/portableML/Portable.sig
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,5 @@ sig
end

val reraise : exn -> 'a
val export : string * 'a -> unit
end
1 change: 1 addition & 0 deletions src/postkernel/Theory.sml
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@ fun export_theory () = let
theory_out (TheoryPP.pp_sig (!pp_thm) sigthry) ostrm1;
theory_out (TheoryPP.pp_struct structthry) ostrm2;
theory_out (TheoryPP.pp_thydata structthry) ostrm3;
Tracing.trace_theory name structthry;
mesg "done.\n";
if !report_times then
(mesg ("Theory "^Lib.quote thyname^" took "^ tstr ^ " to build\n");
Expand Down
8 changes: 8 additions & 0 deletions src/thm/Holmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ NET_UOD = $(dprot $(SIGOBJ)/Net.uo)
all: $(patsubst %.sml,%.uo,$(wildcard *.sml)) Thm.uo

ifeq ($(KERNELID),otknl)
Thm.sml: otknl-thm.ML
$(CP) $< $@

Thm-sig.sml: otknl-thmsig.ML
$(CP) $< $@

else ifeq ($(KERNELID),trknl)

Thm.sml: otknl-thm.ML
$(CP) $< $@

Expand Down
6 changes: 6 additions & 0 deletions src/tracing/no/Tracing.sig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
signature Tracing =
sig

val trace_theory : string -> TheoryPP.struct_info_record -> unit

end
6 changes: 6 additions & 0 deletions src/tracing/no/Tracing.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
structure Tracing :> Tracing =
struct

fun trace_theory _ _ = ()

end
6 changes: 6 additions & 0 deletions src/tracing/yes/Tracing.sig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
signature Tracing =
sig

val trace_theory : string -> TheoryPP.struct_info_record -> unit

end
21 changes: 21 additions & 0 deletions src/tracing/yes/Tracing.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
structure Tracing :> Tracing =
struct

open TheoryPP

fun export (file, x: 'a) = let
val _ = PolyML.shareCommonData x
val body = PolyML.exportSmall x
val ostream = BinIO.openOut file
val () = BinIO.output (ostream, body)
val () = BinIO.closeOut ostream
in () end

fun trace_theory name
({theory,parents,types,constants,axioms,definitions,theorems,mldeps,...}: struct_info_record) = let
val file = concat[".holobjs/",name,".tr"]
val () = export(file, (theory,parents,types,constants,axioms,definitions,theorems,mldeps))
val _ = Unix.execute ("/usr/bin/gzip", ["-f", file])
in () end

end
2 changes: 2 additions & 0 deletions tools/buildcline.sml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ val cline_opt_descrs = [
desc = mkBoolOpt #build_theory_graph false},
{help = "build with logging kernel", long = ["otknl"], short = "",
desc = setKname "--otknl"},
{help = "build with tracing kernel", long = ["trknl"], short = "",
desc = setKname "--trknl"},
{help = "do relocation build (e.g., after a cleanForReloc)",
long = ["relocbuild"], short = "",
desc = mkBool #relocbuild true},
Expand Down
8 changes: 5 additions & 3 deletions tools/buildutils.sml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ fun read_buildsequence {kernelname} bseq_fname = let
"stdknl" => "0"
| "expk" => "experimental-kernel"
| "otknl" => "0"
| "trknl" => "0"
| _ => die ("Bad kernelname: "^kernelname)
]
val readline = TextIO.inputLine
Expand Down Expand Up @@ -344,12 +345,12 @@ fun get_cline () = let
SOME s => String.extract(s,2,NONE)
| NONE =>
(case
List.find (fn s => mem s ["--expk", "--otknl", "--stdknl"])oldopts
List.find (fn s => mem s ["--expk", "--otknl", "--stdknl", "--trknl"]) oldopts
of
NONE => "stdknl"
| SOME s =>
(warn ("Using kernel spec "^s^ " from earlier build command;\n\
\ use one of --expk, --stdknl, --otknl to override");
\ use one of --expk, --stdknl, --otknl, --trknl to override");
String.extract(s,2,NONE)))
val _ = write_kernelid knlspec
val buildgraph =
Expand Down Expand Up @@ -519,7 +520,7 @@ fun cleanForReloc0 HOLDIR =
fun maybe_gmakeclean dirname owise () =
if OS <> "winNT" then
let
val gnumake =
val gnumake =
case List.rev (#arcs (OS.Path.fromString dirname)) of
"minisat" :: "sat_solvers" :: "HolSat" :: "src" :: _ => true
| "zc2hs" :: "sat_solvers" :: "HolSat" :: "src" :: _ => true
Expand Down Expand Up @@ -912,6 +913,7 @@ fun process_cline () =
Binaryset.empty cmp |> add "stdknl" dfltbuildseq
|> add "expk" knlseq
|> add "otknl" knlseq
|> add "trknl" dfltbuildseq
in
Binaryset.listItems alldirs
end
Expand Down
1 change: 1 addition & 0 deletions tools/sequences/core-theories
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ src/num/theories/cv_compute
# NOTE: otknl builds use the old Arithconv for proof constructions
(stdknl)src/num/reduce/conv
(expk)src/num/reduce/conv
(trknl)src/num/reduce/conv
(otknl)src/num/reduce/conv-old

src/num/reduce/src
Expand Down
5 changes: 5 additions & 0 deletions tools/sequences/kernel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ src/portableML/monads
src/prekernel
**KERNEL**
src/thm
(stdknl)src/tracing/no
(expk)src/tracing/no
[poly](trknl)src/tracing/yes
[mosml](trknl)src/tracing/no
(otknl)src/tracing/no
src/postkernel
# these three directories are required to even run hol.bare.unquote
src/parse
Expand Down
Loading