src/HOL/BNF/Tools/ctr_sugar.ML
changeset 54285 578371ba74cc
parent 54265 3e1d230f1c00
child 54386 3514fdfdf59b
equal deleted inserted replaced
54284:0b53378080d9 54285:578371ba74cc
   137 
   137 
   138 fun ctr_sugars_of ctxt =
   138 fun ctr_sugars_of ctxt =
   139   Symtab.fold (cons o transfer_ctr_sugar ctxt o snd) (Data.get (Context.Proof ctxt)) [];
   139   Symtab.fold (cons o transfer_ctr_sugar ctxt o snd) (Data.get (Context.Proof ctxt)) [];
   140 
   140 
   141 fun register_ctr_sugar key ctr_sugar =
   141 fun register_ctr_sugar key ctr_sugar =
   142   Local_Theory.declaration {syntax = false, pervasive = false}
   142   Local_Theory.declaration {syntax = false, pervasive = true}
   143     (fn phi => Data.map (Symtab.default (key, morph_ctr_sugar phi ctr_sugar)));
   143     (fn phi => Data.map (Symtab.default (key, morph_ctr_sugar phi ctr_sugar)));
   144 
   144 
   145 val rep_compat_prefix = "new";
   145 val rep_compat_prefix = "new";
   146 
   146 
   147 val isN = "is_";
   147 val isN = "is_";
   916            case_conv_ifs = case_conv_if_thms};
   916            case_conv_ifs = case_conv_if_thms};
   917       in
   917       in
   918         (ctr_sugar,
   918         (ctr_sugar,
   919          lthy
   919          lthy
   920          |> not rep_compat ?
   920          |> not rep_compat ?
   921             (Local_Theory.declaration {syntax = false, pervasive = false}
   921             (Local_Theory.declaration {syntax = false, pervasive = true}
   922                (fn phi => Case_Translation.register
   922                (fn phi => Case_Translation.register
   923                   (Morphism.term phi casex) (map (Morphism.term phi) ctrs)))
   923                   (Morphism.term phi casex) (map (Morphism.term phi) ctrs)))
   924          |> Local_Theory.notes (anonymous_notes @ notes) |> snd
   924          |> Local_Theory.notes (anonymous_notes @ notes) |> snd
   925          |> register_ctr_sugar fcT_name ctr_sugar)
   925          |> register_ctr_sugar fcT_name ctr_sugar)
   926       end;
   926       end;