src/HOL/Tools/Lifting/lifting_setup.ML
author wenzelm
Mon, 26 Nov 2012 14:43:28 +0100
changeset 50214 67fb9a168d10
parent 50176 701747176952
child 50231 81a067b188b8
permissions -rw-r--r--
tuned command descriptions;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
     1
(*  Title:      HOL/Tools/Lifting/lifting_setup.ML
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
     2
    Author:     Ondrej Kuncar
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
     3
47352
e0bff2ae939f fix typos
huffman
parents: 47334
diff changeset
     4
Setting up the lifting infrastructure.
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
     5
*)
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
     6
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
     7
signature LIFTING_SETUP =
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
     8
sig
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
     9
  exception SETUP_LIFTING_INFR of string
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    10
47566
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
    11
  val setup_by_quotient: bool -> thm -> thm option -> local_theory -> local_theory
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    12
47566
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
    13
  val setup_by_typedef_thm: bool -> thm -> local_theory -> local_theory
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    14
end;
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    15
47334
4708384e759d fix typo in ML structure name
huffman
parents: 47308
diff changeset
    16
structure Lifting_Setup: LIFTING_SETUP =
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    17
struct
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    18
47698
18202d3d5832 move MRSL to a separate file
kuncar
parents: 47623
diff changeset
    19
open Lifting_Util
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    20
47698
18202d3d5832 move MRSL to a separate file
kuncar
parents: 47623
diff changeset
    21
infix 0 MRSL
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    22
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    23
exception SETUP_LIFTING_INFR of string
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    24
47361
87c0eaf04bad support non-open typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents: 47352
diff changeset
    25
fun define_cr_rel rep_fun lthy =
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    26
  let
47361
87c0eaf04bad support non-open typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents: 47352
diff changeset
    27
    val (qty, rty) = (dest_funT o fastype_of) rep_fun
87c0eaf04bad support non-open typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents: 47352
diff changeset
    28
    val rep_fun_graph = (HOLogic.eq_const rty) $ Bound 1 $ (rep_fun $ Bound 0)
87c0eaf04bad support non-open typedefs; define cr_rel in terms of a rep function for typedefs
kuncar
parents: 47352
diff changeset
    29
    val def_term = Abs ("x", rty, Abs ("y", qty, rep_fun_graph));
50175
b27cf0646080 generate correct correspondence relation name
kuncar
parents: 47982
diff changeset
    30
    val qty_name = (Binding.name o Long_Name.base_name o fst o dest_Type) qty
b27cf0646080 generate correct correspondence relation name
kuncar
parents: 47982
diff changeset
    31
    val cr_rel_name = Binding.prefix_name "cr_" qty_name
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    32
    val (fixed_def_term, lthy') = yield_singleton (Variable.importT_terms) def_term lthy
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    33
    val ((_, (_ , def_thm)), lthy'') =
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    34
      Local_Theory.define ((cr_rel_name, NoSyn), ((Thm.def_binding cr_rel_name, []), fixed_def_term)) lthy'
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    35
  in
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    36
    (def_thm, lthy'')
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    37
  end
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    38
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    39
fun define_code_constr gen_code quot_thm lthy =
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    40
  let
47951
8c8a03765de7 quot_del attribute, it allows us to deregister quotient types
kuncar
parents: 47943
diff changeset
    41
    val abs = quot_thm_abs quot_thm
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    42
    val abs_background = Morphism.term (Local_Theory.target_morphism lthy) abs
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    43
  in
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    44
    if gen_code andalso is_Const abs_background then
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    45
      let
50176
701747176952 simplified code
kuncar
parents: 50175
diff changeset
    46
        val (fixed_abs_background, lthy') = yield_singleton(Variable.importT_terms) abs_background lthy
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    47
      in  
50176
701747176952 simplified code
kuncar
parents: 50175
diff changeset
    48
         Local_Theory.background_theory(Code.add_datatype [dest_Const fixed_abs_background]) lthy'
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    49
      end
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    50
    else
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    51
      lthy
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    52
  end
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    53
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    54
fun define_abs_type gen_code quot_thm lthy =
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    55
  if gen_code andalso Lifting_Def.can_generate_code_cert quot_thm then
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    56
    let
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    57
      val abs_type_thm = quot_thm RS @{thm Quotient_abs_rep}
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    58
      val add_abstype_attribute = 
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    59
          Thm.declaration_attribute (fn thm => Context.mapping (Code.add_abstype thm) I)
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    60
        val add_abstype_attrib = Attrib.internal (K add_abstype_attribute);
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    61
    in
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    62
      lthy
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    63
        |> (snd oo Local_Theory.note) ((Binding.empty, [add_abstype_attrib]), [abs_type_thm])
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    64
    end
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    65
  else
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    66
    lthy
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    67
47379
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    68
fun quot_thm_sanity_check ctxt quot_thm =
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    69
  let
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    70
    val ((_, [quot_thm_fixed]), ctxt') = Variable.importT [quot_thm] ctxt 
47951
8c8a03765de7 quot_del attribute, it allows us to deregister quotient types
kuncar
parents: 47943
diff changeset
    71
    val (rty, qty) = quot_thm_rty_qty quot_thm_fixed
47379
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    72
    val rty_tfreesT = Term.add_tfree_namesT rty []
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    73
    val qty_tfreesT = Term.add_tfree_namesT qty []
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    74
    val extra_rty_tfrees =
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
    75
      case subtract (op =) qty_tfreesT rty_tfreesT of
47379
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    76
        [] => []
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    77
      | extras => [Pretty.block ([Pretty.str "Extra variables in the raw type:",
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    78
                                 Pretty.brk 1] @ 
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    79
                                 ((Pretty.commas o map (Pretty.str o quote)) extras) @
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
    80
                                 [Pretty.str "."])]
47379
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    81
    val not_type_constr = 
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
    82
      case qty of
47379
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    83
         Type _ => []
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    84
         | _ => [Pretty.block [Pretty.str "The quotient type ",
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    85
                                Pretty.quote (Syntax.pretty_typ ctxt' qty),
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    86
                                Pretty.brk 1,
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
    87
                                Pretty.str "is not a type constructor."]]
47379
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    88
    val errs = extra_rty_tfrees @ not_type_constr
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    89
  in
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    90
    if null errs then () else error (cat_lines (["Sanity check of the quotient theorem failed:",""] 
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    91
                                                @ (map Pretty.string_of errs)))
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    92
  end
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    93
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
    94
fun setup_lifting_infr gen_code quot_thm maybe_reflp_thm lthy =
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    95
  let
47379
075d22b3a32f detect incorrect situations; better error messages; sanity check for quot_thm in setup_lifting_infr
kuncar
parents: 47361
diff changeset
    96
    val _ = quot_thm_sanity_check lthy quot_thm
47951
8c8a03765de7 quot_del attribute, it allows us to deregister quotient types
kuncar
parents: 47943
diff changeset
    97
    val (_, qtyp) = quot_thm_rty_qty quot_thm
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    98
    val qty_full_name = (fst o dest_Type) qtyp
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
    99
    val quotients = { quot_thm = quot_thm }
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   100
    fun quot_info phi = Lifting_Info.transform_quotients phi quotients
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   101
    val lthy' = case maybe_reflp_thm of
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   102
      SOME reflp_thm => lthy
47982
7aa35601ff65 prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents: 47951
diff changeset
   103
        |> (snd oo Local_Theory.note) ((Binding.empty, [Lifting_Info.add_reflexivity_rule_attrib]),
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   104
              [reflp_thm])
47982
7aa35601ff65 prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents: 47951
diff changeset
   105
        |> (snd oo Local_Theory.note) ((Binding.empty, [Lifting_Info.add_reflexivity_rule_attrib]),
7aa35601ff65 prove reflexivity also for the quotient composition relation; reflp_preserve renamed to reflexivity_rule
kuncar
parents: 47951
diff changeset
   106
              [[quot_thm, reflp_thm] MRSL @{thm Quotient_to_left_total}])
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   107
        |> define_code_constr gen_code quot_thm
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   108
      | NONE => lthy
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   109
        |> define_abs_type gen_code quot_thm
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   110
  in
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   111
    lthy'
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   112
      |> Local_Theory.declaration {syntax = false, pervasive = true}
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   113
        (fn phi => Lifting_Info.update_quotients qty_full_name (quot_info phi))
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   114
  end
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   115
47852
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   116
(*
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   117
  Sets up the Lifting package by a quotient theorem.
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   118
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   119
  gen_code - flag if an abstract type given by quot_thm should be registred 
47852
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   120
    as an abstract type in the code generator
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   121
  quot_thm - a quotient theorem (Quotient R Abs Rep T)
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   122
  maybe_reflp_thm - a theorem saying that a relation from quot_thm is reflexive
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   123
    (in the form "reflp R")
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   124
*)
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   125
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   126
fun setup_by_quotient gen_code quot_thm maybe_reflp_thm lthy =
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   127
  let
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   128
    val transfer_attr = Attrib.internal (K Transfer.transfer_add)
47951
8c8a03765de7 quot_del attribute, it allows us to deregister quotient types
kuncar
parents: 47943
diff changeset
   129
    val (_, qty) = quot_thm_rty_qty quot_thm
47575
b90cd7016d4f generate abs_induct rules for quotient types
huffman
parents: 47566
diff changeset
   130
    val induct_attr = Attrib.internal (K (Induct.induct_type (fst (dest_Type qty))))
47583
f3f0e06549c2 create thm names correctly
kuncar
parents: 47575
diff changeset
   131
    val qty_name = (Binding.name o Long_Name.base_name o fst o dest_Type) qty
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   132
    fun qualify suffix = Binding.qualified true suffix qty_name
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   133
    val lthy' = case maybe_reflp_thm of
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   134
      SOME reflp_thm => lthy
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   135
        |> (snd oo Local_Theory.note) ((qualify "bi_total", [transfer_attr]), 
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   136
          [[quot_thm, reflp_thm] MRSL @{thm Quotient_bi_total}])
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   137
        |> (snd oo Local_Theory.note) ((qualify "id_abs_transfer", [transfer_attr]), 
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   138
          [[quot_thm, reflp_thm] MRSL @{thm Quotient_id_abs_transfer}])
47575
b90cd7016d4f generate abs_induct rules for quotient types
huffman
parents: 47566
diff changeset
   139
        |> (snd oo Local_Theory.note) ((qualify "abs_induct", [induct_attr]),
b90cd7016d4f generate abs_induct rules for quotient types
huffman
parents: 47566
diff changeset
   140
          [[quot_thm, reflp_thm] MRSL @{thm Quotient_total_abs_induct}])
47889
29212a4bb866 lifting package produces abs_eq_iff rules for total quotients
huffman
parents: 47852
diff changeset
   141
        |> (snd oo Local_Theory.note) ((qualify "abs_eq_iff", []),
29212a4bb866 lifting package produces abs_eq_iff rules for total quotients
huffman
parents: 47852
diff changeset
   142
          [[quot_thm, reflp_thm] MRSL @{thm Quotient_total_abs_eq_iff}])
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   143
      | NONE => lthy
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   144
        |> (snd oo Local_Theory.note) ((qualify "All_transfer", [transfer_attr]), 
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   145
          [quot_thm RS @{thm Quotient_All_transfer}])
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   146
        |> (snd oo Local_Theory.note) ((qualify "Ex_transfer", [transfer_attr]), 
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   147
          [quot_thm RS @{thm Quotient_Ex_transfer}])
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   148
        |> (snd oo Local_Theory.note) ((qualify "forall_transfer", [transfer_attr]), 
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   149
          [quot_thm RS @{thm Quotient_forall_transfer}])
47575
b90cd7016d4f generate abs_induct rules for quotient types
huffman
parents: 47566
diff changeset
   150
        |> (snd oo Local_Theory.note) ((qualify "abs_induct", [induct_attr]),
b90cd7016d4f generate abs_induct rules for quotient types
huffman
parents: 47566
diff changeset
   151
          [quot_thm RS @{thm Quotient_abs_induct}])
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   152
  in
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   153
    lthy'
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   154
      |> (snd oo Local_Theory.note) ((qualify "right_unique", [transfer_attr]), 
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   155
        [quot_thm RS @{thm Quotient_right_unique}])
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   156
      |> (snd oo Local_Theory.note) ((qualify "right_total", [transfer_attr]), 
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   157
        [quot_thm RS @{thm Quotient_right_total}])
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   158
      |> (snd oo Local_Theory.note) ((qualify "rel_eq_transfer", [transfer_attr]), 
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   159
        [quot_thm RS @{thm Quotient_rel_eq_transfer}])
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   160
      |> setup_lifting_infr gen_code quot_thm maybe_reflp_thm
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   161
  end
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   162
47852
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   163
(*
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   164
  Sets up the Lifting package by a typedef theorem.
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   165
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   166
  gen_code - flag if an abstract type given by typedef_thm should be registred 
47852
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   167
    as an abstract type in the code generator
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   168
  typedef_thm - a typedef theorem (type_definition Rep Abs S)
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   169
*)
0c3b8d036a5c documentation of the Lifting package on the ML level & tuned
kuncar
parents: 47779
diff changeset
   170
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   171
fun setup_by_typedef_thm gen_code typedef_thm lthy =
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   172
  let
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   173
    val transfer_attr = Attrib.internal (K Transfer.transfer_add)
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   174
    val (_ $ rep_fun $ _ $ typedef_set) = (HOLogic.dest_Trueprop o prop_of) typedef_thm
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   175
    val (T_def, lthy') = define_cr_rel rep_fun lthy
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   176
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   177
    val quot_thm = case typedef_set of
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   178
      Const ("Orderings.top_class.top", _) => 
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   179
        [typedef_thm, T_def] MRSL @{thm UNIV_typedef_to_Quotient}
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   180
      | Const (@{const_name "Collect"}, _) $ Abs (_, _, _) => 
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   181
        [typedef_thm, T_def] MRSL @{thm open_typedef_to_Quotient}
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   182
      | _ => 
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   183
        [typedef_thm, T_def] MRSL @{thm typedef_to_Quotient}
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   184
47951
8c8a03765de7 quot_del attribute, it allows us to deregister quotient types
kuncar
parents: 47943
diff changeset
   185
    val (_, qty) = quot_thm_rty_qty quot_thm
47583
f3f0e06549c2 create thm names correctly
kuncar
parents: 47575
diff changeset
   186
    val qty_name = (Binding.name o Long_Name.base_name o fst o dest_Type) qty
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   187
    fun qualify suffix = Binding.qualified true suffix qty_name
47623
01e4fdf9d748 setup_lifting preprocesses forall_transfer rule by unfolding mem_Collect_eq
huffman
parents: 47608
diff changeset
   188
    val simplify = Raw_Simplifier.rewrite_rule [mk_meta_eq @{thm mem_Collect_eq}]
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   189
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   190
    val (maybe_reflp_thm, lthy'') = case typedef_set of
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   191
      Const ("Orderings.top_class.top", _) => 
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   192
        let
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   193
          val equivp_thm = typedef_thm RS @{thm UNIV_typedef_to_equivp}
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   194
          val reflp_thm = equivp_thm RS @{thm equivp_reflp2}
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   195
        in
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   196
          lthy'
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   197
            |> (snd oo Local_Theory.note) ((qualify "bi_total", [transfer_attr]), 
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   198
              [[quot_thm, reflp_thm] MRSL @{thm Quotient_bi_total}])
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   199
            |> (snd oo Local_Theory.note) ((qualify "id_abs_transfer", [transfer_attr]), 
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   200
              [[quot_thm, reflp_thm] MRSL @{thm Quotient_id_abs_transfer}])
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   201
            |> pair (SOME reflp_thm)
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   202
        end
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   203
      | _ => lthy'
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   204
        |> (snd oo Local_Theory.note) ((qualify "All_transfer", [transfer_attr]), 
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   205
          [[typedef_thm, T_def] MRSL @{thm typedef_All_transfer}])
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   206
        |> (snd oo Local_Theory.note) ((qualify "Ex_transfer", [transfer_attr]), 
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   207
          [[typedef_thm, T_def] MRSL @{thm typedef_Ex_transfer}])
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   208
        |> (snd oo Local_Theory.note) ((qualify "forall_transfer", [transfer_attr]), 
47623
01e4fdf9d748 setup_lifting preprocesses forall_transfer rule by unfolding mem_Collect_eq
huffman
parents: 47608
diff changeset
   209
          [simplify ([typedef_thm, T_def] MRSL @{thm typedef_forall_transfer})])
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   210
        |> pair NONE
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   211
  in
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   212
    lthy''
47943
c09326cedb41 note Quotient theorem for typedefs in setup_lifting
kuncar
parents: 47937
diff changeset
   213
      |> (snd oo Local_Theory.note) ((Binding.prefix_name "Quotient_" qty_name, []), 
c09326cedb41 note Quotient theorem for typedefs in setup_lifting
kuncar
parents: 47937
diff changeset
   214
        [quot_thm])
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   215
      |> (snd oo Local_Theory.note) ((qualify "bi_unique", [transfer_attr]), 
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   216
        [[typedef_thm, T_def] MRSL @{thm typedef_bi_unique}])
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   217
      |> (snd oo Local_Theory.note) ((qualify "rep_transfer", [transfer_attr]), 
47535
0f94b02fda1c lifting_setup generates transfer rule for rep of typedefs
huffman
parents: 47534
diff changeset
   218
        [[typedef_thm, T_def] MRSL @{thm typedef_rep_transfer}])
47545
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   219
      |> (snd oo Local_Theory.note) ((qualify "right_unique", [transfer_attr]), 
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   220
        [[quot_thm] MRSL @{thm Quotient_right_unique}])
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   221
      |> (snd oo Local_Theory.note) ((qualify "right_total", [transfer_attr]), 
a2850a16e30f Lifting: generate more thms & note them & tuned
kuncar
parents: 47535
diff changeset
   222
        [[quot_thm] MRSL @{thm Quotient_right_total}])
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   223
      |> setup_lifting_infr gen_code quot_thm maybe_reflp_thm
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   224
  end
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   225
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   226
fun setup_lifting_cmd gen_code xthm opt_reflp_xthm lthy =
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   227
  let 
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   228
    val input_thm = singleton (Attrib.eval_thms lthy) xthm
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   229
    val input_term = (HOLogic.dest_Trueprop o prop_of) input_thm
47566
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   230
      handle TERM _ => error "Unsupported type of a theorem. Only Quotient or type_definition are supported."
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   231
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   232
    fun sanity_check_reflp_thm reflp_thm = 
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   233
      let
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   234
        val reflp_tm = (HOLogic.dest_Trueprop o prop_of) reflp_thm
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   235
          handle TERM _ => error "Invalid form of the reflexivity theorem. Use \"reflp R\"."
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   236
      in
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   237
        case reflp_tm of
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   238
          Const (@{const_name reflp}, _) $ _ => ()
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   239
          | _ => error "Invalid form of the reflexivity theorem. Use \"reflp R\"."
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   240
      end
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   241
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   242
    fun setup_quotient () = 
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   243
      case opt_reflp_xthm of
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   244
        SOME reflp_xthm => 
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   245
          let
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   246
            val reflp_thm = singleton (Attrib.eval_thms lthy) reflp_xthm
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   247
            val _ = sanity_check_reflp_thm reflp_thm
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   248
          in
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   249
            setup_by_quotient gen_code input_thm (SOME reflp_thm) lthy
47566
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   250
          end
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   251
        | NONE => setup_by_quotient gen_code input_thm NONE lthy
47566
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   252
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   253
    fun setup_typedef () = 
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   254
      case opt_reflp_xthm of
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   255
        SOME _ => error "The reflexivity theorem cannot be specified if the type_definition theorem is used."
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   256
        | NONE => setup_by_typedef_thm gen_code input_thm lthy
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   257
  in
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   258
    case input_term of
47566
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   259
      (Const (@{const_name Quotient}, _) $ _ $ _ $ _ $ _) => setup_quotient ()
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   260
      | (Const (@{const_name type_definition}, _) $ _ $ _ $ _) => setup_typedef ()
47521
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   261
      | _ => error "Unsupported type of a theorem. Only Quotient or type_definition are supported."
69f95ac85c3d tuned the setup of lifting; generate transfer rules for typedef and Quotient thms
kuncar
parents: 47379
diff changeset
   262
  end
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   263
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   264
val opt_gen_code =
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   265
  Scan.optional (@{keyword "("} |-- Parse.!!! ((Parse.reserved "no_code" >> K false) --| @{keyword ")"})) true
47566
c201a1fe0a81 setup_lifting: no_code switch and supoport for quotient theorems
kuncar
parents: 47545
diff changeset
   266
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   267
val _ = 
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   268
  Outer_Syntax.local_theory @{command_spec "setup_lifting"}
50214
67fb9a168d10 tuned command descriptions;
wenzelm
parents: 50176
diff changeset
   269
    "setup lifting infrastructure" 
47937
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   270
      (opt_gen_code -- Parse_Spec.xthm -- Scan.option Parse_Spec.xthm >> 
70375fa2679d generate abs_eq, use it as a code equation for total quotients; no_abs_code renamed to no_code; added no_code for quotient_type command
kuncar
parents: 47936
diff changeset
   271
        (fn ((gen_code, xthm), opt_reflp_xthm) => setup_lifting_cmd gen_code xthm opt_reflp_xthm))
47308
9caab698dbe4 new package Lifting - initial commit
kuncar
parents:
diff changeset
   272
end;