src/HOL/ex/Reflection.thy
author urbanc
Tue Jun 05 09:56:19 2007 +0200 (2007-06-05)
changeset 23243 a37d3e6e8323
parent 22199 b617ddd200eb
child 23546 c8a1bd9585a0
permissions -rw-r--r--
included Class.thy in the compiling process for Nominal/Examples
wenzelm@20319
     1
(*
wenzelm@20319
     2
    ID:         $Id$
wenzelm@20319
     3
    Author:     Amine Chaieb, TU Muenchen
wenzelm@20319
     4
*)
wenzelm@20319
     5
wenzelm@20319
     6
header {* Generic reflection and reification *}
wenzelm@20319
     7
wenzelm@20319
     8
theory Reflection
wenzelm@20319
     9
imports Main
chaieb@22199
    10
  uses ("reflection.ML")
wenzelm@20319
    11
begin
wenzelm@20319
    12
chaieb@20374
    13
lemma ext2: "(\<forall>x. f x = g x) \<Longrightarrow> f = g"
chaieb@20374
    14
  by (blast intro: ext)
chaieb@22199
    15
chaieb@20374
    16
use "reflection.ML"
chaieb@20374
    17
wenzelm@20319
    18
method_setup reify = {*
wenzelm@20319
    19
  fn src =>
wenzelm@20319
    20
    Method.syntax (Attrib.thms --
wenzelm@20319
    21
      Scan.option (Scan.lift (Args.$$$ "(") |-- Args.term --| Scan.lift (Args.$$$ ")"))) src #>
haftmann@21879
    22
  (fn ((eqs, to), ctxt) => Method.SIMPLE_METHOD' (Reflection.genreify_tac ctxt eqs to))
wenzelm@20319
    23
*} "partial automatic reification"
wenzelm@20319
    24
wenzelm@20319
    25
method_setup reflection = {*
wenzelm@20319
    26
  fn src =>
wenzelm@20319
    27
    Method.syntax (Attrib.thms --
wenzelm@20319
    28
      Scan.option (Scan.lift (Args.$$$ "(") |-- Args.term --| Scan.lift (Args.$$$ ")"))) src #>
haftmann@21879
    29
  (fn ((ths, to), ctxt) => Method.SIMPLE_METHOD' (Reflection.reflection_tac ctxt ths to))
wenzelm@20319
    30
*} "reflection method"
wenzelm@20319
    31
wenzelm@20319
    32
end