src/Pure/thm.ML
changeset 15672 32aea1e31eb8
parent 15574 b1d1b5bfc464
child 15797 a63605582573
equal deleted inserted replaced
15671:8df681866dc9 15672:32aea1e31eb8
    59   val nprems_of         : thm -> int
    59   val nprems_of         : thm -> int
    60   val concl_of          : thm -> term
    60   val concl_of          : thm -> term
    61   val cprop_of          : thm -> cterm
    61   val cprop_of          : thm -> cterm
    62   val extra_shyps       : thm -> sort list
    62   val extra_shyps       : thm -> sort list
    63   val strip_shyps       : thm -> thm
    63   val strip_shyps       : thm -> thm
       
    64   val get_axiom_i       : theory -> string -> thm
    64   val get_axiom         : theory -> xstring -> thm
    65   val get_axiom         : theory -> xstring -> thm
    65   val def_name		: string -> string
    66   val def_name		: string -> string
    66   val get_def           : theory -> xstring -> thm
    67   val get_def           : theory -> xstring -> thm
    67   val axioms_of         : theory -> (string * thm) list
    68   val axioms_of         : theory -> (string * thm) list
    68 
    69 
   102   val rename_params_rule: string list * int -> thm -> thm
   103   val rename_params_rule: string list * int -> thm -> thm
   103   val bicompose         : bool -> bool * thm * int ->
   104   val bicompose         : bool -> bool * thm * int ->
   104     int -> thm -> thm Seq.seq
   105     int -> thm -> thm Seq.seq
   105   val biresolution      : bool -> (bool * thm) list ->
   106   val biresolution      : bool -> (bool * thm) list ->
   106     int -> thm -> thm Seq.seq
   107     int -> thm -> thm Seq.seq
       
   108   val invoke_oracle_i   : theory -> string -> Sign.sg * Object.T -> thm
   107   val invoke_oracle     : theory -> xstring -> Sign.sg * Object.T -> thm
   109   val invoke_oracle     : theory -> xstring -> Sign.sg * Object.T -> thm
   108 end;
   110 end;
   109 
   111 
   110 signature THM =
   112 signature THM =
   111 sig
   113 sig
   473 
   475 
   474 
   476 
   475 (** Axioms **)
   477 (** Axioms **)
   476 
   478 
   477 (*look up the named axiom in the theory*)
   479 (*look up the named axiom in the theory*)
   478 fun get_axiom theory raw_name =
   480 fun get_axiom_i theory name =
   479   let
   481   let
   480     val name = Sign.intern (Theory.sign_of theory) Theory.axiomK raw_name;
       
   481 
       
   482     fun get_ax [] = NONE
   482     fun get_ax [] = NONE
   483       | get_ax (thy :: thys) =
   483       | get_ax (thy :: thys) =
   484           let val {sign, axioms, ...} = Theory.rep_theory thy in
   484           let val {sign, axioms, ...} = Theory.rep_theory thy in
   485             (case Symtab.lookup (axioms, name) of
   485             (case Symtab.lookup (axioms, name) of
   486               SOME t =>
   486               SOME t =>
   498   in
   498   in
   499     (case get_ax (theory :: Theory.ancestors_of theory) of
   499     (case get_ax (theory :: Theory.ancestors_of theory) of
   500       SOME thm => thm
   500       SOME thm => thm
   501     | NONE => raise THEORY ("No axiom " ^ quote name, [theory]))
   501     | NONE => raise THEORY ("No axiom " ^ quote name, [theory]))
   502   end;
   502   end;
       
   503 
       
   504 fun get_axiom thy = get_axiom_i thy o Sign.intern (Theory.sign_of thy) Theory.axiomK;
   503 
   505 
   504 fun def_name name = name ^ "_def";
   506 fun def_name name = name ^ "_def";
   505 fun get_def thy = get_axiom thy o def_name;
   507 fun get_def thy = get_axiom thy o def_name;
   506 
   508 
   507 
   509 
  1452     in  Seq.flat (res brules)  end;
  1454     in  Seq.flat (res brules)  end;
  1453 
  1455 
  1454 
  1456 
  1455 (*** Oracles ***)
  1457 (*** Oracles ***)
  1456 
  1458 
  1457 fun invoke_oracle thy raw_name =
  1459 fun invoke_oracle_i thy name =
  1458   let
  1460   let
  1459     val {sign = sg, oracles, ...} = Theory.rep_theory thy;
  1461     val {sign = sg, oracles, ...} = Theory.rep_theory thy;
  1460     val name = Sign.intern sg Theory.oracleK raw_name;
       
  1461     val oracle =
  1462     val oracle =
  1462       (case Symtab.lookup (oracles, name) of
  1463       (case Symtab.lookup (oracles, name) of
  1463         NONE => raise THM ("Unknown oracle: " ^ name, 0, [])
  1464         NONE => raise THM ("Unknown oracle: " ^ name, 0, [])
  1464       | SOME (f, _) => f);
  1465       | SOME (f, _) => f);
  1465   in
  1466   in
  1481             tpairs = [],
  1482             tpairs = [],
  1482             prop = prop})
  1483             prop = prop})
  1483       end
  1484       end
  1484   end;
  1485   end;
  1485 
  1486 
       
  1487 fun invoke_oracle thy =
       
  1488   invoke_oracle_i thy o Sign.intern (Theory.sign_of thy) Theory.oracleK;
       
  1489 
  1486 
  1490 
  1487 end;
  1491 end;
  1488 
  1492 
  1489 
  1493 
  1490 structure BasicThm: BASIC_THM = Thm;
  1494 structure BasicThm: BASIC_THM = Thm;