src/HOL/Tools/function_package/context_tree.ML
changeset 30492 cb7e886e4b10
parent 29329 e02b3a32f34f
equal deleted inserted replaced
30491:772e95280456 30492:cb7e886e4b10
     9 sig
     9 sig
    10     type ctxt = (string * typ) list * thm list (* poor man's contexts: fixes + assumes *)
    10     type ctxt = (string * typ) list * thm list (* poor man's contexts: fixes + assumes *)
    11     type ctx_tree
    11     type ctx_tree
    12 
    12 
    13     (* FIXME: This interface is a mess and needs to be cleaned up! *)
    13     (* FIXME: This interface is a mess and needs to be cleaned up! *)
    14     val get_fundef_congs : Context.generic -> thm list
    14     val get_fundef_congs : Proof.context -> thm list
    15     val add_fundef_cong : thm -> Context.generic -> Context.generic
    15     val add_fundef_cong : thm -> Context.generic -> Context.generic
    16     val map_fundef_congs : (thm list -> thm list) -> Context.generic -> Context.generic
    16     val map_fundef_congs : (thm list -> thm list) -> Context.generic -> Context.generic
    17 
    17 
    18     val cong_add: attribute
    18     val cong_add: attribute
    19     val cong_del: attribute
    19     val cong_del: attribute
    50   val empty = []
    50   val empty = []
    51   val extend = I
    51   val extend = I
    52   fun merge _ = Thm.merge_thms
    52   fun merge _ = Thm.merge_thms
    53 );
    53 );
    54 
    54 
    55 val map_fundef_congs = FundefCongs.map 
    55 val get_fundef_congs = FundefCongs.get o Context.Proof
    56 val get_fundef_congs = FundefCongs.get
    56 val map_fundef_congs = FundefCongs.map
    57 val add_fundef_cong = FundefCongs.map o Thm.add_thm
    57 val add_fundef_cong = FundefCongs.map o Thm.add_thm
    58 
    58 
    59 (* congruence rules *)
    59 (* congruence rules *)
    60 
    60 
    61 val cong_add = Thm.declaration_attribute (map_fundef_congs o Thm.add_thm o safe_mk_meta_eq);
    61 val cong_add = Thm.declaration_attribute (map_fundef_congs o Thm.add_thm o safe_mk_meta_eq);
   125   | find_cong_rule _ _ _ [] _ = sys_error "function_package/context_tree.ML: No cong rule found!"
   125   | find_cong_rule _ _ _ [] _ = sys_error "function_package/context_tree.ML: No cong rule found!"
   126 
   126 
   127 
   127 
   128 fun mk_tree fvar h ctxt t =
   128 fun mk_tree fvar h ctxt t =
   129     let 
   129     let 
   130       val congs = get_fundef_congs (Context.Proof ctxt)
   130       val congs = get_fundef_congs ctxt
   131       val congs_deps = map (fn c => (c, cong_deps c)) (congs @ default_congs) (* FIXME: Save in theory *)
   131       val congs_deps = map (fn c => (c, cong_deps c)) (congs @ default_congs) (* FIXME: Save in theory *)
   132 
   132 
   133       fun matchcall (a $ b) = if a = Free fvar then SOME b else NONE
   133       fun matchcall (a $ b) = if a = Free fvar then SOME b else NONE
   134         | matchcall _ = NONE
   134         | matchcall _ = NONE
   135 
   135