src/HOL/Tools/Sledgehammer/sledgehammer_fol_clause.ML
changeset 35865 2f8fb5242799
parent 35827 f552152d7747
child 36062 194cb6e3c13f
     1.1 --- a/src/HOL/Tools/Sledgehammer/sledgehammer_fol_clause.ML	Fri Mar 19 06:14:37 2010 +0100
     1.2 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_fol_clause.ML	Fri Mar 19 13:02:18 2010 +0100
     1.3 @@ -44,19 +44,19 @@
     1.4    datatype arLit =
     1.5        TConsLit of class * string * string list
     1.6      | TVarLit of class * string
     1.7 -  datatype arityClause = ArityClause of
     1.8 +  datatype arity_clause = ArityClause of
     1.9     {axiom_name: axiom_name, conclLit: arLit, premLits: arLit list}
    1.10 -  datatype classrelClause = ClassrelClause of
    1.11 +  datatype classrel_clause = ClassrelClause of
    1.12     {axiom_name: axiom_name, subclass: class, superclass: class}
    1.13 -  val make_classrel_clauses: theory -> class list -> class list -> classrelClause list
    1.14 -  val make_arity_clauses_dfg: bool -> theory -> string list -> class list -> class list * arityClause list
    1.15 -  val make_arity_clauses: theory -> string list -> class list -> class list * arityClause list
    1.16 +  val make_classrel_clauses: theory -> class list -> class list -> classrel_clause list
    1.17 +  val make_arity_clauses_dfg: bool -> theory -> string list -> class list -> class list * arity_clause list
    1.18 +  val make_arity_clauses: theory -> string list -> class list -> class list * arity_clause list
    1.19    val add_type_sort_preds: typ * int Symtab.table -> int Symtab.table
    1.20 -  val add_classrelClause_preds : classrelClause * int Symtab.table -> int Symtab.table
    1.21 +  val add_classrel_clause_preds : classrel_clause * int Symtab.table -> int Symtab.table
    1.22    val class_of_arityLit: arLit -> class
    1.23 -  val add_arityClause_preds: arityClause * int Symtab.table -> int Symtab.table
    1.24 +  val add_arity_clause_preds: arity_clause * int Symtab.table -> int Symtab.table
    1.25    val add_foltype_funcs: fol_type * int Symtab.table -> int Symtab.table
    1.26 -  val add_arityClause_funcs: arityClause * int Symtab.table -> int Symtab.table
    1.27 +  val add_arity_clause_funcs: arity_clause * int Symtab.table -> int Symtab.table
    1.28    val init_functab: int Symtab.table
    1.29    val dfg_sign: bool -> string -> string
    1.30    val dfg_of_typeLit: bool -> type_literal -> string
    1.31 @@ -67,14 +67,14 @@
    1.32    val string_of_start: string -> string
    1.33    val string_of_descrip : string -> string
    1.34    val dfg_tfree_clause : string -> string
    1.35 -  val dfg_classrelClause: classrelClause -> string
    1.36 -  val dfg_arity_clause: arityClause -> string
    1.37 +  val dfg_classrel_clause: classrel_clause -> string
    1.38 +  val dfg_arity_clause: arity_clause -> string
    1.39    val tptp_sign: bool -> string -> string
    1.40    val tptp_of_typeLit : bool -> type_literal -> string
    1.41    val gen_tptp_cls : int * string * kind * string list * string list -> string
    1.42    val tptp_tfree_clause : string -> string
    1.43 -  val tptp_arity_clause : arityClause -> string
    1.44 -  val tptp_classrelClause : classrelClause -> string
    1.45 +  val tptp_arity_clause : arity_clause -> string
    1.46 +  val tptp_classrel_clause : classrel_clause -> string
    1.47  end
    1.48  
    1.49  structure Sledgehammer_FOL_Clause : SLEDGEHAMMER_FOL_CLAUSE =
    1.50 @@ -96,28 +96,23 @@
    1.51  
    1.52  fun union_all xss = List.foldl (uncurry (union (op =))) [] xss;
    1.53  
    1.54 -(*Provide readable names for the more common symbolic functions*)
    1.55 +(* Provide readable names for the more common symbolic functions *)
    1.56  val const_trans_table =
    1.57 -      Symtab.make [(@{const_name "op ="}, "equal"),
    1.58 -                   (@{const_name Orderings.less_eq}, "lessequals"),
    1.59 -                   (@{const_name "op &"}, "and"),
    1.60 -                   (@{const_name "op |"}, "or"),
    1.61 -                   (@{const_name "op -->"}, "implies"),
    1.62 -                   (@{const_name "op :"}, "in"),
    1.63 -                   ("Sledgehammer.fequal", "fequal"),
    1.64 -                   ("Sledgehammer.COMBI", "COMBI"),
    1.65 -                   ("Sledgehammer.COMBK", "COMBK"),
    1.66 -                   ("Sledgehammer.COMBB", "COMBB"),
    1.67 -                   ("Sledgehammer.COMBC", "COMBC"),
    1.68 -                   ("Sledgehammer.COMBS", "COMBS"),
    1.69 -                   ("Sledgehammer.COMBB'", "COMBB_e"),
    1.70 -                   ("Sledgehammer.COMBC'", "COMBC_e"),
    1.71 -                   ("Sledgehammer.COMBS'", "COMBS_e")];
    1.72 +  Symtab.make [(@{const_name "op ="}, "equal"),
    1.73 +               (@{const_name Orderings.less_eq}, "lessequals"),
    1.74 +               (@{const_name "op &"}, "and"),
    1.75 +               (@{const_name "op |"}, "or"),
    1.76 +               (@{const_name "op -->"}, "implies"),
    1.77 +               (@{const_name "op :"}, "in"),
    1.78 +               (@{const_name fequal}, "fequal"),
    1.79 +               (@{const_name COMBI}, "COMBI"),
    1.80 +               (@{const_name COMBK}, "COMBK"),
    1.81 +               (@{const_name COMBB}, "COMBB"),
    1.82 +               (@{const_name COMBC}, "COMBC"),
    1.83 +               (@{const_name COMBS}, "COMBS")];
    1.84  
    1.85  val type_const_trans_table =
    1.86 -      Symtab.make [("*", "prod"),
    1.87 -                   ("+", "sum"),
    1.88 -                   ("~=>", "map")];
    1.89 +  Symtab.make [("*", "prod"), ("+", "sum"), ("~=>", "map")];
    1.90  
    1.91  (*Escaping of special characters.
    1.92    Alphanumeric characters are left unchanged.
    1.93 @@ -290,7 +285,7 @@
    1.94  datatype arLit = TConsLit of class * string * string list
    1.95                 | TVarLit of class * string;
    1.96  
    1.97 -datatype arityClause =
    1.98 +datatype arity_clause =
    1.99           ArityClause of {axiom_name: axiom_name,
   1.100                           conclLit: arLit,
   1.101                           premLits: arLit list};
   1.102 @@ -316,7 +311,7 @@
   1.103  
   1.104  (**** Isabelle class relations ****)
   1.105  
   1.106 -datatype classrelClause =
   1.107 +datatype classrel_clause =
   1.108           ClassrelClause of {axiom_name: axiom_name,
   1.109                              subclass: class,
   1.110                              superclass: class};
   1.111 @@ -330,13 +325,13 @@
   1.112            fun add_supers (sub,pairs) = List.foldl (add_super sub) pairs supers
   1.113        in  List.foldl add_supers [] subs  end;
   1.114  
   1.115 -fun make_classrelClause (sub,super) =
   1.116 +fun make_classrel_clause (sub,super) =
   1.117    ClassrelClause {axiom_name = clrelclause_prefix ^ ascii_of sub ^ "_" ^ ascii_of super,
   1.118                    subclass = make_type_class sub,
   1.119                    superclass = make_type_class super};
   1.120  
   1.121  fun make_classrel_clauses thy subs supers =
   1.122 -  map make_classrelClause (class_pairs thy subs supers);
   1.123 +  map make_classrel_clause (class_pairs thy subs supers);
   1.124  
   1.125  
   1.126  (** Isabelle arities **)
   1.127 @@ -391,13 +386,13 @@
   1.128  fun add_type_sort_preds (T, preds) =
   1.129        update_many (preds, map pred_of_sort (sorts_on_typs T));
   1.130  
   1.131 -fun add_classrelClause_preds (ClassrelClause {subclass,superclass,...}, preds) =
   1.132 +fun add_classrel_clause_preds (ClassrelClause {subclass,superclass,...}, preds) =
   1.133    Symtab.update (subclass,1) (Symtab.update (superclass,1) preds);
   1.134  
   1.135  fun class_of_arityLit (TConsLit (tclass, _, _)) = tclass
   1.136    | class_of_arityLit (TVarLit (tclass, _)) = tclass;
   1.137  
   1.138 -fun add_arityClause_preds (ArityClause {conclLit,premLits,...}, preds) =
   1.139 +fun add_arity_clause_preds (ArityClause {conclLit,premLits,...}, preds) =
   1.140    let val classes = map (make_type_class o class_of_arityLit) (conclLit::premLits)
   1.141        fun upd (class,preds) = Symtab.update (class,1) preds
   1.142    in  List.foldl upd preds classes  end;
   1.143 @@ -414,7 +409,7 @@
   1.144    | add_type_sort_funcs (TFree (a, _), funcs) =
   1.145        Symtab.update (make_fixed_type_var a, 0) funcs
   1.146  
   1.147 -fun add_arityClause_funcs (ArityClause {conclLit,...}, funcs) =
   1.148 +fun add_arity_clause_funcs (ArityClause {conclLit,...}, funcs) =
   1.149    let val TConsLit (_, tcons, tvars) = conclLit
   1.150    in  Symtab.update (tcons, length tvars) funcs  end;
   1.151  
   1.152 @@ -480,7 +475,7 @@
   1.153  
   1.154  fun dfg_classrelLits sub sup =  "not(" ^ sub ^ "(T)), " ^ sup ^ "(T)";
   1.155  
   1.156 -fun dfg_classrelClause (ClassrelClause {axiom_name,subclass,superclass,...}) =
   1.157 +fun dfg_classrel_clause (ClassrelClause {axiom_name,subclass,superclass,...}) =
   1.158    "clause(forall([T],\nor( " ^ dfg_classrelLits subclass superclass ^ ")),\n" ^
   1.159    axiom_name ^ ").\n\n";
   1.160  
   1.161 @@ -528,7 +523,7 @@
   1.162    let val tvar = "(T)"
   1.163    in  tptp_pack [tptp_sign false (sub^tvar), tptp_sign true (sup^tvar)]  end;
   1.164  
   1.165 -fun tptp_classrelClause (ClassrelClause {axiom_name,subclass,superclass,...}) =
   1.166 +fun tptp_classrel_clause (ClassrelClause {axiom_name,subclass,superclass,...}) =
   1.167    "cnf(" ^ axiom_name ^ ",axiom," ^ tptp_classrelLits subclass superclass ^ ").\n"
   1.168  
   1.169  end;