| 15153 |      1 | #!/usr/bin/env bash
 | 
|  |      2 | #
 | 
|  |      3 | # Author: Tjark Weber
 | 
|  |      4 | #
 | 
|  |      5 | # DESCRIPTION: convert DIMACS CNF files into Isabelle/HOL theories
 | 
|  |      6 | 
 | 
|  |      7 | 
 | 
|  |      8 | ## diagnostics
 | 
|  |      9 | 
 | 
|  |     10 | PRG="$(basename "$0")"
 | 
|  |     11 | 
 | 
|  |     12 | function usage()
 | 
|  |     13 | {
 | 
|  |     14 |   echo
 | 
| 28650 |     15 |   echo "Usage: isabelle $PRG FILES"
 | 
| 15153 |     16 |   echo
 | 
|  |     17 |   echo "  Convert files in DIMACS CNF format [1] into Isabelle/HOL theories."
 | 
|  |     18 |   echo
 | 
|  |     19 |   echo "  For each CNF file, a theory file (with '.thy' appended to the original"
 | 
|  |     20 |   echo "  filename) is generated.  The CNF files are not modified."
 | 
|  |     21 |   echo
 | 
|  |     22 |   echo "  This script is not too strict about the format of the input file.  However,"
 | 
|  |     23 |   echo "  in rare cases it may produce a theory that will not be accepted by"
 | 
|  |     24 |   echo "  Isabelle/HOL (e.g. when a CNF file contains '\\end{verbatim}' or '*}' in a"
 | 
|  |     25 |   echo "  comment)."
 | 
|  |     26 |   echo
 | 
|  |     27 |   echo "  Each CNF file must contain at least one clause, and may not contain empty"
 | 
|  |     28 |   echo "  clauses (i.e. '0' immediately followed by another '0')."
 | 
|  |     29 |   echo
 | 
|  |     30 |   echo "  The CNF formula is negated, so that an unsatisfiable formula becomes"
 | 
|  |     31 |   echo "  provable."
 | 
|  |     32 |   echo
 | 
|  |     33 |   echo "  [1] ftp://dimacs.rutgers.edu/pub/challenge/satisfiability/doc/satformat.dvi"
 | 
|  |     34 |   echo
 | 
|  |     35 |   exit 1
 | 
|  |     36 | }
 | 
|  |     37 | 
 | 
|  |     38 | 
 | 
|  |     39 | ## process command line
 | 
|  |     40 | 
 | 
|  |     41 | [ "$#" -eq 0 -o "$1" = "-?" ] && usage
 | 
|  |     42 | 
 | 
|  |     43 | 
 | 
|  |     44 | ## main
 | 
|  |     45 | 
 | 
| 26576 |     46 | exec perl -w "$ISABELLE_HOME/lib/scripts/dimacs2hol.pl" "$@"
 |