Generating Documents with ProB and Latex
ProB can (as of version 1.6.1) be used to process Latex files, i.e., the command-line tool probcli scans a given Latex file and replaces certain commands by processed results.
A typical usage would be as follows:
probcli FILE -init -latex Raw.tex Final.texYou will probably want to put the probcli call into a Makefile, in particular when you want to generate dot graphics using ProB.
The distribution folder of ProB contains an example with a Makefile, producing the following file, which at the same time documents the core features:
Commands
Section titled “Commands”The commands are described in the PDF document above. Here is a short summary of some of the commands:
-
\probexpr{EXRP}command takes a B expressionEXPRas argument and evaluates it. By default it shows the B expression and the value of the expression. Example:\probexpr{{1}\/{2**10}}will be replaced by{1,1024}asciito print the result as ASCII rather than using Latex math symbolstimeto display the time taken for the commandstringthe result value is a string, and do not print the quotes around the stringvalueto just print the value, not the expression
-
\probrepl{CMD}command takes a probcli REPL commandCMDas argument and executes it. By default it shows only the output of the execution, e.g., in case it is a predicate TRUE or FALSE. Example:\probrepl{let DOM = 1..3}. A variation of the latter is the new command\problet{DOM}{1..3}which shows the let construct itself within the generated Latex. Optional arguments for\probreplare :solutionto display the solution bindings (for existential variables) found by ProBstoreto store the solution bindings as local variables (similar to let)asciito print the result as ASCII rather than using Latex math symbolstimeto display the time taken for the commandprintto print the expression/predicate being evaluated (automatically set by\probletsilentto not print the result of the evaluation
-
\probtable{EXRP}command takes a B expressionEXPRas argument, evaluates it and shows it as a Latex table. Optional arguments areno-tabular,no-hline,no-headings,no-row-numbers,max-table-size=NR. -
\probdot{DOT}{File1}command takes a B expressionEXPRas argument, evaluates it as a graph and writes a dot fileFile1. You can provide a second File as argument, in which casedotis called to generate a PDF document. You can also setsfdpas third argument, in which case thesfdptool will be used instead ofdot. -
\probprint{EXRP}command takes a B expression or predicateEXPRas argument and pretty prints it. Optional arguments are:predonly try to parse first argument as predicateexpronly try to parse first argument as expressionasciito print the result as ASCII rather than using Latex math symbols
-
\probif{EXPR}{Then}{Else}command takes an expression or predicateEXPRand two Latex texts. If the expression evaluates to TRUE the first branchThenis processed, otherwise the other oneElseis processed. -
\probfor{ID}{Set}{Body}command takes an identifierID, a set expressionSetand a Latex textBody, and processes the Latex text for every element of the set expression, setting the identifier to a value of the set.
Some Examples
Section titled “Some Examples”- Presentation held in Grenoble in September 2016 about “Constraint Programming Puzzles in B” File:Puzzle latex presentation.pdf
- SBMF’2016 keynote article “Formal Model-Based Constraint Solving and Document Generation” File:Sbmf 2016 latex.pdf