Isabelle can generate a graph of all theories of one development as a PDF file, as in this example. This is clearly rendered using graphviz, so I wonder: Is there a way to get hold of the original .dot
file that Isabelle used to generate this graph? This would be useful to render it with a different style, e.g. more compactly.

- 25,395
- 6
- 78
- 139
-
Hmm, reading the Isabelle source, I’m not so sure that this is actually using graphviz, but I’d still know if there is a good way to get hold of the graph is a form that can be processed further. – Joachim Breitner Dec 16 '15 at 13:45
2 Answers
This is rather simple using Isabelle/Scala. The following code can be saved to a file and directly executed as a script under the assumption that isabelle install some_bin_dir
has been executed previously where some_bin_dir
is in the PATH
.
#!/usr/bin/env isabelle_scala_script
import isabelle._
val options = Options.init()
val content = Build.session_content(options, false, Nil, "HOL")
val graph = content.session_graph
graph.dest.foreach {
case ((x, _), ys) =>
println(x.toString + " -> " + ys.iterator.map(_.toString).mkString("{", ", ", "}"))
}
Here's the output of this script (excerpt):
ATP -> {Metis}
Archimedean_Field -> {Rat}
BNF_Cardinal_Arithmetic -> {BNF_Def}
BNF_Cardinal_Order_Relation -> {BNF_Cardinal_Arithmetic}
BNF_Composition -> {BNF_Fixpoint_Base}
BNF_Def -> {BNF_Composition, Basic_BNFs}
BNF_Fixpoint_Base -> {BNF_Greatest_Fixpoint, BNF_Least_Fixpoint}
BNF_Greatest_Fixpoint -> {Main}
BNF_Least_Fixpoint -> {Basic_BNF_LFPs, Num}
BNF_Wellorder_Constructions -> {BNF_Cardinal_Order_Relation}
BNF_Wellorder_Embedding -> {BNF_Wellorder_Constructions}
BNF_Wellorder_Relation -> {BNF_Wellorder_Embedding}
Basic_BNF_LFPs -> {Fun_Def, Transfer}
Basic_BNFs -> {BNF_Fixpoint_Base}
The code above can be easily changed to produce, say, dot
-compatible output.
As for the parameters of the session_content
method: The third one (Nil
) is a list of session directories (corresponding to -d
in isabelle build
) and the fourth is the name of the session. Inside the script, the array args
is available which corresponds to the list of arguments passed through the command line which would allow you to take these parameters from the user.

- 2,579
- 8
- 30
Dot is not the only tool to make graph layouts. When the Isabelle graph layout was implemented the first time in 1996, its contender did already exist, but we were not satisfied with it. So we implemented a different algorithm.
In 2016, the situation is mostly the same. No new and better tools have emerged in the meantime, so the Isabelle one is still the relevant one (recently ported to Scala).

- 2,165
- 18
- 20