src/HOL/Tools/Function/function_lib.ML
changeset 41113 b223fa19af3c
parent 40722 441260986b63
child 41116 7230a7c379dc
equal deleted inserted replaced
41112:866148b76247 41113:b223fa19af3c
     1 (*  Title:      HOL/Tools/Function/function_lib.ML
     1 (*  Title:      HOL/Tools/Function/function_lib.ML
     2     Author:     Alexander Krauss, TU Muenchen
     2     Author:     Alexander Krauss, TU Muenchen
     3 
     3 
     4 A package for general recursive function definitions.
     4 Ad-hoc collection of function waiting to be eliminated, generalized,
     5 Some fairly general functions that should probably go somewhere else...
     5 moved elsewhere or otherwise cleaned up.
     6 *)
     6 *)
     7 
     7 
     8 structure Function_Lib =   (* FIXME proper signature *)
     8 signature FUNCTION_LIB =
       
     9 sig
       
    10   val plural: string -> string -> 'a list -> string
       
    11 
       
    12   val dest_all_all: term -> term list * term
       
    13   val dest_all_all_ctx: Proof.context -> term -> Proof.context * (string * typ) list * term
       
    14 
       
    15   val map4: ('a -> 'b -> 'c -> 'd -> 'e) -> 'a list -> 'b list -> 'c list -> 'd list -> 'e list
       
    16   val map7: ('a -> 'b -> 'c -> 'd -> 'e -> 'f -> 'g -> 'h) -> 'a list -> 'b list -> 'c list ->
       
    17     'd list -> 'e list -> 'f list -> 'g list -> 'h list
       
    18 
       
    19   val unordered_pairs: 'a list -> ('a * 'a) list
       
    20 
       
    21   val replace_frees: (string * term) list -> term -> term
       
    22   val rename_bound: string -> term -> term
       
    23   val mk_forall_rename: (string * term) -> term -> term
       
    24   val forall_intr_rename: (string * cterm) -> thm -> thm
       
    25 
       
    26   val frees_in_term: Proof.context -> term -> (string * typ) list
       
    27 
       
    28   datatype proof_attempt = Solved of thm | Stuck of thm | Fail
       
    29   val try_proof: cterm -> tactic -> proof_attempt
       
    30 
       
    31   val dest_binop_list: string -> term -> term list
       
    32   val regroup_conv: string -> string -> thm list -> int list -> conv
       
    33   val regroup_union_conv: int list -> conv
       
    34 end
       
    35 
       
    36 structure Function_Lib: FUNCTION_LIB =
     9 struct
    37 struct
    10 
    38 
    11 (* "The variable" ^ plural " is" "s are" vs *)
    39 (* "The variable" ^ plural " is" "s are" vs *)
    12 fun plural sg pl [x] = sg
    40 fun plural sg pl [x] = sg
    13   | plural sg pl _ = pl
    41   | plural sg pl _ = pl