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