Quot/quotient_typ.ML
author Christian Urban <urbanc@in.tum.de>
Thu, 31 Dec 2009 23:53:10 +0100
changeset 799 0755f8fd56b3
parent 792 a31cf260eeb3
child 800 71225f4a4635
permissions -rw-r--r--
renamed transfer to transform (Markus)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
762
baac4639ecef avoided global "open"s - replaced by local "open"s
Christian Urban <urbanc@in.tum.de>
parents: 760
diff changeset
     1
signature QUOTIENT_TYPE =
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
     2
sig
787
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
     3
  val quotient_type: ((string list * binding * mixfix) * (typ * term)) list 
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
     4
    -> Proof.context -> Proof.state
789
Christian Urban <urbanc@in.tum.de>
parents: 788
diff changeset
     5
787
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
     6
  val quotient_type_cmd: ((((string list * binding) * mixfix) * string) * string) list 
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
     7
    -> Proof.context -> Proof.state
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
     8
end;
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
762
baac4639ecef avoided global "open"s - replaced by local "open"s
Christian Urban <urbanc@in.tum.de>
parents: 760
diff changeset
    10
structure Quotient_Type: QUOTIENT_TYPE =
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
struct
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
762
baac4639ecef avoided global "open"s - replaced by local "open"s
Christian Urban <urbanc@in.tum.de>
parents: 760
diff changeset
    13
open Quotient_Info;
baac4639ecef avoided global "open"s - replaced by local "open"s
Christian Urban <urbanc@in.tum.de>
parents: 760
diff changeset
    14
760
c1989de100b4 various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents: 725
diff changeset
    15
(* wrappers for define, note, Attrib.internal and theorem_i *)
135
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    16
fun define (name, mx, rhs) lthy =
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    17
let
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    18
  val ((rhs, (_ , thm)), lthy') =
331
345c422b1cb5 updated to Isabelle 22nd November
Christian Urban <urbanc@in.tum.de>
parents: 329
diff changeset
    19
     Local_Theory.define ((name, mx), (Attrib.empty_binding, rhs)) lthy
135
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    20
in
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    21
  ((rhs, thm), lthy')
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    22
end
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    23
503
d2c9a72e52e0 first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents: 447
diff changeset
    24
fun note (name, thm, attrs) lthy =
135
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    25
let
503
d2c9a72e52e0 first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents: 447
diff changeset
    26
  val ((_,[thm']), lthy') = Local_Theory.note ((name, attrs), [thm]) lthy
135
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    27
in
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    28
  (thm', lthy')
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    29
end
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    30
760
c1989de100b4 various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents: 725
diff changeset
    31
fun intern_attr at = Attrib.internal (K at)
582
a082e2d138ab added a theorem list for equivalence theorems
Christian Urban <urbanc@in.tum.de>
parents: 529
diff changeset
    32
203
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
    33
fun theorem after_qed goals ctxt =
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
    34
let
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
    35
  val goals' = map (rpair []) goals
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
    36
  fun after_qed' thms = after_qed (the_single thms)
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
    37
in 
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
    38
  Proof.theorem_i NONE after_qed' [goals'] ctxt
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
    39
end
135
6f0d14ba096c started to write code for storing data about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 130
diff changeset
    40
130
8e8ba210f0f7 moved the map-info and fun-info section to quotient.ML
Christian Urban <urbanc@in.tum.de>
parents: 128
diff changeset
    41
790
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
    42
(********************************)
329
5d06e1dba69a slight tuning
Christian Urban <urbanc@in.tum.de>
parents: 321
diff changeset
    43
(* definition of quotient types *)
5d06e1dba69a slight tuning
Christian Urban <urbanc@in.tum.de>
parents: 321
diff changeset
    44
(********************************)
130
8e8ba210f0f7 moved the map-info and fun-info section to quotient.ML
Christian Urban <urbanc@in.tum.de>
parents: 128
diff changeset
    45
780
a24e26f5488c explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
parents: 766
diff changeset
    46
val mem_def1 = @{lemma "y : S ==> S y" by (simp add: mem_def)}
a24e26f5488c explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
parents: 766
diff changeset
    47
val mem_def2 = @{lemma "S y ==> y : S" by (simp add: mem_def)}
a24e26f5488c explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
parents: 766
diff changeset
    48
79
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
    49
(* constructs the term lambda (c::rty => bool). EX (x::rty). c = rel x *)
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
fun typedef_term rel rty lthy =
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
let
79
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
    52
  val [x, c] = [("x", rty), ("c", HOLogic.mk_setT rty)]
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
               |> Variable.variant_frees lthy [rel]
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
               |> map Free
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
in
790
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
    56
  lambda c (HOLogic.exists_const rty $
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
    57
     lambda x (HOLogic.mk_eq (c, (rel $ x))))
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
end
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
790
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
    60
788
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
    61
(* makes the new type definitions and proves non-emptyness *)
787
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
    62
fun typedef_make (vs, qty_name, mx, rel, rty) lthy =
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
let
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
  val typedef_tac =
792
Christian Urban <urbanc@in.tum.de>
parents: 790
diff changeset
    65
     EVERY1 (map rtac [@{thm exI}, mem_def2, @{thm exI}, @{thm refl}])
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
in
319
0ae9d9e66cb7 updated to new Isabelle
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
    67
  Local_Theory.theory_result
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
    (Typedef.add_typedef false NONE
787
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
    69
       (qty_name, vs, mx)
790
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
    70
          (typedef_term rel rty lthy)
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
    71
             NONE typedef_tac) lthy
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
end
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
790
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
    74
781
f3a24012e9d8 renamed QUOT_TYPE to Quot_Type
Christian Urban <urbanc@in.tum.de>
parents: 780
diff changeset
    75
(* tactic to prove the Quot_Type theorem for the new type *)
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
fun typedef_quot_type_tac equiv_thm (typedef_info: Typedef.info) =
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
let
780
a24e26f5488c explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
parents: 766
diff changeset
    78
  val rep_thm = (#Rep typedef_info) RS mem_def1
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
  val rep_inv = #Rep_inverse typedef_info
780
a24e26f5488c explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
parents: 766
diff changeset
    80
  val abs_inv = mem_def2 RS (#Abs_inverse typedef_info)
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
  val rep_inj = #Rep_inject typedef_info
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
in
781
f3a24012e9d8 renamed QUOT_TYPE to Quot_Type
Christian Urban <urbanc@in.tum.de>
parents: 780
diff changeset
    83
  (rtac @{thm Quot_Type.intro} THEN' 
780
a24e26f5488c explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
parents: 766
diff changeset
    84
   RANGE [rtac equiv_thm,
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
          rtac rep_thm,
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
          rtac rep_inv,
792
Christian Urban <urbanc@in.tum.de>
parents: 790
diff changeset
    87
          EVERY' (map rtac [abs_inv, @{thm exI}, @{thm refl}]),
780
a24e26f5488c explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
parents: 766
diff changeset
    88
          rtac rep_inj]) 1
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
end
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
790
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
    91
781
f3a24012e9d8 renamed QUOT_TYPE to Quot_Type
Christian Urban <urbanc@in.tum.de>
parents: 780
diff changeset
    92
(* proves the Quot_Type theorem *)
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
fun typedef_quot_type_thm (rel, abs, rep, equiv_thm, typedef_info) lthy =
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
let
781
f3a24012e9d8 renamed QUOT_TYPE to Quot_Type
Christian Urban <urbanc@in.tum.de>
parents: 780
diff changeset
    95
  val quot_type_const = Const (@{const_name "Quot_Type"}, dummyT)
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
  val goal = HOLogic.mk_Trueprop (quot_type_const $ rel $ abs $ rep)
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
             |> Syntax.check_term lthy
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
in
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
  Goal.prove lthy [] [] goal
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
    (K (typedef_quot_type_tac equiv_thm typedef_info))
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
end
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
(* proves the quotient theorem *)
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
fun typedef_quotient_thm (rel, abs, rep, abs_def, rep_def, quot_type_thm) lthy =
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
let
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 503
diff changeset
   106
  val quotient_const = Const (@{const_name "Quotient"}, dummyT)
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
  val goal = HOLogic.mk_Trueprop (quotient_const $ rel $ abs $ rep)
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
             |> Syntax.check_term lthy
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
  val typedef_quotient_thm_tac =
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
    EVERY1 [K (rewrite_goals_tac [abs_def, rep_def]),
781
f3a24012e9d8 renamed QUOT_TYPE to Quot_Type
Christian Urban <urbanc@in.tum.de>
parents: 780
diff changeset
   112
            rtac @{thm Quot_Type.Quotient},
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
            rtac quot_type_thm]
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
in
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
  Goal.prove lthy [] [] goal
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
    (K typedef_quotient_thm_tac)
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
end
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
790
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
   119
760
c1989de100b4 various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents: 725
diff changeset
   120
(* main function for constructing a quotient type *)
787
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
   121
fun mk_typedef_main (((vs, qty_name, mx), (rty, rel)), equiv_thm) lthy =
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
let
760
c1989de100b4 various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents: 725
diff changeset
   123
  (* generates the typedef *)
787
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
   124
  val ((qty_full_name, typedef_info), lthy1) = typedef_make (vs, qty_name, mx, rel, rty) lthy
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
760
c1989de100b4 various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
parents: 725
diff changeset
   126
  (* abs and rep functions from the typedef *)
782
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   127
  val Abs_ty = #abs_type typedef_info
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   128
  val Rep_ty = #rep_type typedef_info
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   129
  val Abs_name = #Abs_name typedef_info
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   130
  val Rep_name = #Rep_name typedef_info
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   131
  val Abs_const = Const (Abs_name, Rep_ty --> Abs_ty)
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   132
  val Rep_const = Const (Rep_name, Abs_ty --> Rep_ty)
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
792
Christian Urban <urbanc@in.tum.de>
parents: 790
diff changeset
   134
  (* more useful abs and rep definitions *)
782
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   135
  val abs_const = Const (@{const_name "Quot_Type.abs"}, dummyT )
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   136
  val rep_const = Const (@{const_name "Quot_Type.rep"}, dummyT )
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   137
  val abs_trm = Syntax.check_term lthy1 (abs_const $ rel $ Abs_const)
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   138
  val rep_trm = Syntax.check_term lthy1 (rep_const $ Rep_const)
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   139
  val abs_name = Binding.prefix_name "abs_" qty_name
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   140
  val rep_name = Binding.prefix_name "rep_" qty_name
781
f3a24012e9d8 renamed QUOT_TYPE to Quot_Type
Christian Urban <urbanc@in.tum.de>
parents: 780
diff changeset
   141
782
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   142
  val ((abs, abs_def), lthy2) = define (abs_name, NoSyn, abs_trm) lthy1
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   143
  val ((rep, rep_def), lthy3) = define (rep_name, NoSyn, rep_trm) lthy2
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
780
a24e26f5488c explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
parents: 766
diff changeset
   145
  (* quot_type theorem - needed below *)
782
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   146
  val quot_thm = typedef_quot_type_thm (rel, Abs_const, Rep_const, equiv_thm, typedef_info) lthy3
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
780
a24e26f5488c explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
parents: 766
diff changeset
   148
  (* quotient theorem *)  
782
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   149
  val quotient_thm = typedef_quotient_thm (rel, abs, rep, abs_def, rep_def, quot_thm) lthy3
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 503
diff changeset
   150
  val quotient_thm_name = Binding.prefix_name "Quotient_" qty_name
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
782
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   152
  (* name equivalence theorem *)
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   153
  val equiv_thm_name = Binding.suffix_name "_equivp" qty_name
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   154
182
c7eff9882bd8 added data-storage about the quotients
Christian Urban <urbanc@in.tum.de>
parents: 170
diff changeset
   155
  (* storing the quot-info *)
783
06e17083e90b modified mk_resp_arg so that the user can give terms as equivalence relations, not just constants
Christian Urban <urbanc@in.tum.de>
parents: 782
diff changeset
   156
  (* FIXME: VarifyT should not be used - at the moment it allows matching against the types. *)
799
0755f8fd56b3 renamed transfer to transform (Markus)
Christian Urban <urbanc@in.tum.de>
parents: 792
diff changeset
   157
  fun qinfo phi = transform_quotdata phi
786
d6407afb913c used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents: 783
diff changeset
   158
                    {qtyp = Logic.varifyT Abs_ty, rtyp = Logic.varifyT rty, 
d6407afb913c used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents: 783
diff changeset
   159
                     equiv_rel = map_types Logic.varifyT rel, equiv_thm = equiv_thm}
d6407afb913c used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents: 783
diff changeset
   160
  val lthy4 = Local_Theory.declaration true
d6407afb913c used Local_Theory.declaration for storing quotdata
Christian Urban <urbanc@in.tum.de>
parents: 783
diff changeset
   161
                (fn phi => quotdata_update_gen qty_full_name (qinfo phi)) lthy3  
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
in
781
f3a24012e9d8 renamed QUOT_TYPE to Quot_Type
Christian Urban <urbanc@in.tum.de>
parents: 780
diff changeset
   163
  lthy4
780
a24e26f5488c explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
parents: 766
diff changeset
   164
  |> note (quotient_thm_name, quotient_thm, [intern_attr quotient_rules_add])
782
86c7ed9f354f cleaed a bit function mk_typedef_main
Christian Urban <urbanc@in.tum.de>
parents: 781
diff changeset
   165
  ||>> note (equiv_thm_name, equiv_thm, [intern_attr equiv_rules_add])
71
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
end
35be65791f1d exported parts of QuotMain into a separate ML-file
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
790
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
   168
788
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   169
(* sanity checks of the quotient type specifications *)
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   170
fun sanity_check ((vs, qty_name, _), (rty, rel)) =
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   171
let
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   172
  val rty_tfreesT = map fst (Term.add_tfreesT rty [])
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   173
  val rel_tfrees = map fst (Term.add_tfrees rel [])
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   174
  val rel_frees = map fst (Term.add_frees rel [])
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   175
  val rel_vars = Term.add_vars rel []
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   176
  val rel_tvars = Term.add_tvars rel []
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   177
  val qty_str = (Binding.str_of qty_name) ^ ": "
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   178
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   179
  val illegal_rel_vars =
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   180
    if null rel_vars andalso null rel_tvars then []
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   181
    else [qty_str ^ "illegal schematic variable(s) in the relation."]
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   182
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   183
  val dup_vs =
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   184
    (case duplicates (op =) vs of 
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   185
       [] => []
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   186
     | dups => [qty_str ^ "duplicate type variable(s) on the lhs: " ^ commas_quote dups])
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   187
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   188
  val extra_rty_tfrees =
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   189
    (case subtract (op =) vs rty_tfreesT of 
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   190
       [] => []
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   191
     | extras => [qty_str ^ "extra type variable(s) on the lhs: " ^ commas_quote extras])
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   192
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   193
  val extra_rel_tfrees =
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   194
    (case subtract (op =) vs rel_tfrees of 
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   195
       [] => []
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   196
     | extras => [qty_str ^ "extra type variable(s) in the relation: " ^ commas_quote extras])
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   197
 
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   198
  val illegal_rel_frees =
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   199
    (case rel_frees of 
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   200
      [] => []
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   201
    | xs => [qty_str ^ "illegal variable(s) in the relation: " ^ commas_quote xs])
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   202
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   203
  val errs = illegal_rel_vars @ dup_vs @ extra_rty_tfrees @ extra_rel_tfrees @ illegal_rel_frees
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   204
in
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   205
  if null errs then () else error (cat_lines errs)
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   206
end
130
8e8ba210f0f7 moved the map-info and fun-info section to quotient.ML
Christian Urban <urbanc@in.tum.de>
parents: 128
diff changeset
   207
790
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
   208
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
   209
(******************************)
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   210
(* interface and syntax setup *)
790
3a48ffcf0f9a generalised absrep function; needs consolidation
Christian Urban <urbanc@in.tum.de>
parents: 789
diff changeset
   211
(******************************)
75
5fe163543bb8 started some strange functions
Christian Urban <urbanc@in.tum.de>
parents: 71
diff changeset
   212
788
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   213
(* the ML-interface takes a list of 5-tuples consisting of  *)
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   214
(*                                                          *)
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   215
(* - the name of the quotient type                          *)
788
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   216
(* - its free type variables (first argument)               *)
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   217
(* - its mixfix annotation                                  *)
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   218
(* - the type to be quotient                                *)
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   219
(* - the relation according to which the type is quotient   *)
130
8e8ba210f0f7 moved the map-info and fun-info section to quotient.ML
Christian Urban <urbanc@in.tum.de>
parents: 128
diff changeset
   220
290
a0be84b0c707 removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
parents: 264
diff changeset
   221
fun quotient_type quot_list lthy = 
79
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
   222
let
185
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 182
diff changeset
   223
  fun mk_goal (rty, rel) =
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   224
  let
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 503
diff changeset
   225
    val equivp_ty = ([rty, rty] ---> @{typ bool}) --> @{typ bool}
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   226
  in 
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 503
diff changeset
   227
    HOLogic.mk_Trueprop (Const (@{const_name equivp}, equivp_ty) $ rel)
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   228
  end
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   229
185
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 182
diff changeset
   230
  val goals = map (mk_goal o snd) quot_list
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   231
              
79
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
   232
  fun after_qed thms lthy =
203
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   233
    fold_map mk_typedef_main (quot_list ~~ thms) lthy |> snd
788
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   234
789
Christian Urban <urbanc@in.tum.de>
parents: 788
diff changeset
   235
  (* sanity check *)  
788
0b60d8416ec5 added sanity checks for quotient_type
Christian Urban <urbanc@in.tum.de>
parents: 787
diff changeset
   236
  val _ = map sanity_check quot_list 
79
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
   237
in
203
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   238
  theorem after_qed goals lthy
79
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
   239
end
205
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
   240
           
290
a0be84b0c707 removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
parents: 264
diff changeset
   241
fun quotient_type_cmd spec lthy = 
205
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
   242
let
787
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
   243
  fun parse_spec ((((vs, qty_name), mx), rty_str), rel_str) =
205
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
   244
  let
293
653460d3e849 tuned the code in quotient and quotient_def
Christian Urban <urbanc@in.tum.de>
parents: 290
diff changeset
   245
    val rty = Syntax.read_typ lthy rty_str
653460d3e849 tuned the code in quotient and quotient_def
Christian Urban <urbanc@in.tum.de>
parents: 290
diff changeset
   246
    val rel = Syntax.read_term lthy rel_str 
205
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
   247
  in
787
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
   248
    ((vs, qty_name, mx), (rty, rel))
205
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
   249
  end
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
   250
in
290
a0be84b0c707 removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
parents: 264
diff changeset
   251
  quotient_type (map parse_spec spec) lthy
205
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
   252
end
79
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
   253
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   254
val quotspec_parser = 
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   255
    OuterParse.and_list1
787
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
   256
     ((OuterParse.type_args -- OuterParse.binding) -- 
5cf83fa5b36c made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
parents: 786
diff changeset
   257
        OuterParse.opt_infix -- (OuterParse.$$$ "=" |-- OuterParse.typ) -- 
127
b054cf6bd179 the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
parents: 82
diff changeset
   258
         (OuterParse.$$$ "/" |-- OuterParse.term))
75
5fe163543bb8 started some strange functions
Christian Urban <urbanc@in.tum.de>
parents: 71
diff changeset
   259
79
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
   260
val _ = OuterKeyword.keyword "/"
75
5fe163543bb8 started some strange functions
Christian Urban <urbanc@in.tum.de>
parents: 71
diff changeset
   261
79
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
   262
val _ = 
766
df053507edba renamed "quotient" command to "quotient_type"; needs new keyword file to be installed
Christian Urban <urbanc@in.tum.de>
parents: 762
diff changeset
   263
    OuterSyntax.local_theory_to_proof "quotient_type" 
df053507edba renamed "quotient" command to "quotient_type"; needs new keyword file to be installed
Christian Urban <urbanc@in.tum.de>
parents: 762
diff changeset
   264
      "quotient type definitions (require equivalence proofs)"
290
a0be84b0c707 removed typing information from get_fun in quotient_def; *potentially* dangerous
Christian Urban <urbanc@in.tum.de>
parents: 264
diff changeset
   265
         OuterKeyword.thy_goal (quotspec_parser >> quotient_type_cmd)
79
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
   266
c0c41fefeb06 added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
parents: 75
diff changeset
   267
end; (* structure *)