src/HOL/Tools/Quotient/quotient_def.ML
changeset 46909 3c73a121a387
parent 45929 d7d6c8cfb6f6
child 46949 94aa7b81bcf6
equal deleted inserted replaced
46908:3553cb65c66c 46909:3c73a121a387
    43   in
    43   in
    44     error ("Head of quotient_definition " ^
    44     error ("Head of quotient_definition " ^
    45       quote str ^ " differs from declaration " ^ name ^ pos)
    45       quote str ^ " differs from declaration " ^ name ^ pos)
    46   end
    46   end
    47 
    47 
    48 fun gen_quotient_def prep_vars prep_term (raw_var, (attr, (lhs_raw, rhs_raw))) lthy =
    48 fun gen_quotient_def prep_vars prep_term (raw_var, ((name, atts), (lhs_raw, rhs_raw))) lthy =
    49   let
    49   let
    50     val (vars, ctxt) = prep_vars (the_list raw_var) lthy
    50     val (vars, ctxt) = prep_vars (the_list raw_var) lthy
    51     val T_opt = (case vars of [(_, SOME T, _)] => SOME T | _ => NONE)
    51     val T_opt = (case vars of [(_, SOME T, _)] => SOME T | _ => NONE)
    52     val lhs = prep_term T_opt ctxt lhs_raw
    52     val lhs = prep_term T_opt ctxt lhs_raw
    53     val rhs = prep_term NONE ctxt rhs_raw
    53     val rhs = prep_term NONE ctxt rhs_raw
    67     val absrep_trm = Quotient_Term.absrep_fun lthy Quotient_Term.AbsF (fastype_of rhs, lhs_ty) $ rhs
    67     val absrep_trm = Quotient_Term.absrep_fun lthy Quotient_Term.AbsF (fastype_of rhs, lhs_ty) $ rhs
    68     val prop = Syntax.check_term lthy (Logic.mk_equals (lhs, absrep_trm))
    68     val prop = Syntax.check_term lthy (Logic.mk_equals (lhs, absrep_trm))
    69     val (_, prop') = Local_Defs.cert_def lthy prop
    69     val (_, prop') = Local_Defs.cert_def lthy prop
    70     val (_, newrhs) = Local_Defs.abs_def prop'
    70     val (_, newrhs) = Local_Defs.abs_def prop'
    71 
    71 
    72     val ((trm, (_ , thm)), lthy') = Local_Theory.define (var, (attr, newrhs)) lthy
    72     val ((trm, (_ , thm)), lthy') =
       
    73       Local_Theory.define (var, ((Thm.def_binding_optional (#1 var) name, atts), newrhs)) lthy
    73 
    74 
    74     (* data storage *)
    75     (* data storage *)
    75     val qconst_data = {qconst = trm, rconst = rhs, def = thm}
    76     val qconst_data = {qconst = trm, rconst = rhs, def = thm}
    76 
    77 
    77     val lthy'' = lthy'
    78     val lthy'' = lthy'