added Morphism.transform/form (generic non-sense);
authorwenzelm
Sat, 14 Apr 2007 00:46:20 +0200
changeset 22670 c803b2696ada
parent 22669 62857ad97cca
child 22671 3c62305fbee6
added Morphism.transform/form (generic non-sense);
src/Pure/Isar/proof_context.ML
src/Pure/morphism.ML
--- a/src/Pure/Isar/proof_context.ML	Sat Apr 14 00:46:20 2007 +0200
+++ b/src/Pure/Isar/proof_context.ML	Sat Apr 14 00:46:20 2007 +0200
@@ -921,7 +921,7 @@
     Context.mapping_result
       (Sign.add_abbrev Syntax.internalM arg') (add_abbrev Syntax.internalM arg')
     #-> (fn (lhs, _) =>
-      Term.equiv_types (rhs, rhs') ? target_notation prmode [(lhs, mx)] Morphism.identity)
+      Term.equiv_types (rhs, rhs') ? Morphism.form (target_notation prmode [(lhs, mx)]))
   end;
 
 fun local_abbrev (x, rhs) =
--- a/src/Pure/morphism.ML	Sat Apr 14 00:46:20 2007 +0200
+++ b/src/Pure/morphism.ML	Sat Apr 14 00:46:20 2007 +0200
@@ -37,6 +37,8 @@
   val thm_morphism: (thm -> thm) -> morphism
   val identity: morphism
   val compose: morphism -> morphism -> morphism
+  val transform: morphism -> (morphism -> 'a) -> morphism -> 'a
+  val form: (morphism -> 'a) -> 'a
 end;
 
 structure Morphism: MORPHISM =
@@ -76,6 +78,9 @@
 
 fun phi1 $> phi2 = compose phi2 phi1;
 
+fun transform phi f = fn psi => f (phi $> psi);
+fun form f = f identity;
+
 end;
 
 structure BasicMorphism: BASIC_MORPHISM = Morphism;