simultaneous fact morphism;
authorwenzelm
Fri Nov 24 22:05:17 2006 +0100 (2006-11-24)
changeset 21521095f4963beed
parent 21520 63c73f461eec
child 21522 bd641d927437
simultaneous fact morphism;
src/Pure/Isar/element.ML
src/Pure/morphism.ML
     1.1 --- a/src/Pure/Isar/element.ML	Fri Nov 24 22:05:16 2006 +0100
     1.2 +++ b/src/Pure/Isar/element.ML	Fri Nov 24 22:05:17 2006 +0100
     1.3 @@ -114,7 +114,7 @@
     1.4    var = Morphism.var phi,
     1.5    typ = Morphism.typ phi,
     1.6    term = Morphism.term phi,
     1.7 -  fact = map (Morphism.thm phi),
     1.8 +  fact = Morphism.fact phi,
     1.9    attrib = Args.morph_values phi};
    1.10  
    1.11  
    1.12 @@ -327,13 +327,10 @@
    1.13    end;
    1.14  
    1.15  fun hyps_rule rule th =
    1.16 -  let
    1.17 -    val cterm_rule = Drule.mk_term #> rule #> Drule.dest_term;
    1.18 -    val {hyps, ...} = Thm.crep_thm th;
    1.19 -  in
    1.20 +  let val {hyps, ...} = Thm.crep_thm th in
    1.21      Drule.implies_elim_list
    1.22        (rule (Drule.implies_intr_list hyps th))
    1.23 -      (map (Thm.assume o cterm_rule) hyps)
    1.24 +      (map (Thm.assume o Drule.cterm_rule rule) hyps)
    1.25    end;
    1.26  
    1.27  
    1.28 @@ -372,7 +369,7 @@
    1.29    end;
    1.30  
    1.31  fun rename_morphism ren = Morphism.morphism
    1.32 -  {name = I, var = rename_var ren, typ = I, term = rename_term ren, thm = rename_thm ren};
    1.33 +  {name = I, var = rename_var ren, typ = I, term = rename_term ren, fact = map (rename_thm ren)};
    1.34  
    1.35  
    1.36  (* instantiate types *)
    1.37 @@ -398,7 +395,7 @@
    1.38      in if null subst then th else th |> hyps_rule (instantiate_tfrees thy subst) end;
    1.39  
    1.40  fun instT_morphism thy env = Morphism.morphism
    1.41 -  {name = I, var = I, typ = instT_type env, term = instT_term env, thm = instT_thm thy env};
    1.42 +  {name = I, var = I, typ = instT_type env, term = instT_term env, fact = map (instT_thm thy env)};
    1.43  
    1.44  
    1.45  (* instantiate types and terms *)
    1.46 @@ -441,7 +438,8 @@
    1.47      end;
    1.48  
    1.49  fun inst_morphism thy envs = Morphism.morphism
    1.50 -  {name = I, var = I, typ = instT_type (#1 envs), term = inst_term envs, thm = inst_thm thy envs};
    1.51 +  {name = I, var = I, typ = instT_type (#1 envs), term = inst_term envs,
    1.52 +    fact = map (inst_thm thy envs)};
    1.53  
    1.54  
    1.55  (* satisfy hypotheses *)
    1.56 @@ -469,13 +467,13 @@
    1.57      val thy = ProofContext.theory_of inner;
    1.58      val maxidx =
    1.59        fold (fn ((_, atts), bs) => maxidx_atts atts #> fold (maxidx_atts o #2) bs) facts ~1;
    1.60 -    val exp_thm = Thm.adjust_maxidx_thm maxidx #>
    1.61 -      singleton ((if std then ProofContext.export_standard else ProofContext.export) inner outer);
    1.62 -    val exp_term = Drule.term_rule thy exp_thm;
    1.63 -    val exp_typ = Logic.mk_type #> exp_term #> Logic.dest_type;
    1.64 -    val exp_morphism =
    1.65 -      Morphism.morphism {name = I, var = I, typ = exp_typ, term = exp_term, thm = exp_thm};
    1.66 -    val Notes (_, facts') = morph_ctxt exp_morphism (Notes ("", facts));
    1.67 +    val exp_fact = map (Thm.adjust_maxidx_thm maxidx) #>
    1.68 +      ((if std then ProofContext.export_standard else ProofContext.export) inner outer);
    1.69 +    val exp_term = Drule.term_rule thy (singleton exp_fact);
    1.70 +    val exp_typ = Logic.type_map exp_term;
    1.71 +    val morphism =
    1.72 +      Morphism.morphism {name = I, var = I, typ = exp_typ, term = exp_term, fact = exp_fact};
    1.73 +    val Notes (_, facts') = morph_ctxt morphism (Notes ("", facts));
    1.74    in facts' end;
    1.75  
    1.76  in
     2.1 --- a/src/Pure/morphism.ML	Fri Nov 24 22:05:16 2006 +0100
     2.2 +++ b/src/Pure/morphism.ML	Fri Nov 24 22:05:17 2006 +0100
     2.3 @@ -20,17 +20,19 @@
     2.4    val name: morphism -> string -> string
     2.5    val typ: morphism -> typ -> typ
     2.6    val term: morphism -> term -> term
     2.7 +  val fact: morphism -> thm list -> thm list
     2.8    val thm: morphism -> thm -> thm
     2.9    val morphism:
    2.10     {name: string -> string,
    2.11      var: string * mixfix -> string * mixfix,
    2.12      typ: typ -> typ,
    2.13      term: term -> term,
    2.14 -    thm: thm -> thm} -> morphism
    2.15 +    fact: thm list -> thm list} -> morphism
    2.16    val name_morphism: (string -> string) -> morphism
    2.17    val var_morphism: (string * mixfix -> string * mixfix) -> morphism
    2.18    val typ_morphism: (typ -> typ) -> morphism
    2.19    val term_morphism: (term -> term) -> morphism
    2.20 +  val fact_morphism: (thm list -> thm list) -> morphism
    2.21    val thm_morphism: (thm -> thm) -> morphism
    2.22    val identity: morphism
    2.23    val comp: morphism -> morphism -> morphism
    2.24 @@ -44,29 +46,31 @@
    2.25    var: string * mixfix -> string * mixfix,
    2.26    typ: typ -> typ,
    2.27    term: term -> term,
    2.28 -  thm: thm -> thm};
    2.29 +  fact: thm list -> thm list};
    2.30  
    2.31  fun name (Morphism {name, ...}) = name;
    2.32  fun var (Morphism {var, ...}) = var;
    2.33  fun typ (Morphism {typ, ...}) = typ;
    2.34  fun term (Morphism {term, ...}) = term;
    2.35 -fun thm (Morphism {thm, ...}) = thm;
    2.36 +fun fact (Morphism {fact, ...}) = fact;
    2.37 +val thm = singleton o fact;
    2.38  
    2.39  val morphism = Morphism;
    2.40  
    2.41 -fun name_morphism name = morphism {name = name, var = I, typ = I, term = I, thm = I};
    2.42 -fun var_morphism var = morphism {name = I, var = var, typ = I, term = I, thm = I};
    2.43 -fun typ_morphism typ = morphism {name = I, var = I, typ = typ, term = I, thm = I};
    2.44 -fun term_morphism term = morphism {name = I, var = I, typ = I, term = term, thm = I};
    2.45 -fun thm_morphism thm = morphism {name = I, var = I, typ = I, term = I, thm = thm};
    2.46 +fun name_morphism name = morphism {name = name, var = I, typ = I, term = I, fact = I};
    2.47 +fun var_morphism var = morphism {name = I, var = var, typ = I, term = I, fact = I};
    2.48 +fun typ_morphism typ = morphism {name = I, var = I, typ = typ, term = I, fact = I};
    2.49 +fun term_morphism term = morphism {name = I, var = I, typ = I, term = term, fact = I};
    2.50 +fun fact_morphism fact = morphism {name = I, var = I, typ = I, term = I, fact = fact};
    2.51 +fun thm_morphism thm = morphism {name = I, var = I, typ = I, term = I, fact = map thm};
    2.52  
    2.53 -val identity = morphism {name = I, var = I, typ = I, term = I, thm = I};
    2.54 +val identity = morphism {name = I, var = I, typ = I, term = I, fact = I};
    2.55  
    2.56  fun comp
    2.57 -    (Morphism {name = name1, var = var1, typ = typ1, term = term1, thm = thm1})
    2.58 -    (Morphism {name = name2, var = var2, typ = typ2, term = term2, thm = thm2}) =
    2.59 +    (Morphism {name = name1, var = var1, typ = typ1, term = term1, fact = fact1})
    2.60 +    (Morphism {name = name2, var = var2, typ = typ2, term = term2, fact = fact2}) =
    2.61    morphism {name = name1 o name2, var = var1 o var2,
    2.62 -    typ = typ1 o typ2, term = term1 o term2, thm = thm1 o thm2};
    2.63 +    typ = typ1 o typ2, term = term1 o term2, fact = fact1 o fact2};
    2.64  
    2.65  fun phi1 $> phi2 = comp phi2 phi1;
    2.66