src/HOL/Tools/Nitpick/nitpick_kodkod.ML
changeset 34982 7b8c366e34a2
parent 34936 c4f04bee79f3
child 35070 96136eb6218f
equal deleted inserted replaced
34981:475aef44d5fb 34982:7b8c366e34a2
     1 (*  Title:      HOL/Tools/Nitpick/nitpick_kodkod.ML
     1 (*  Title:      HOL/Tools/Nitpick/nitpick_kodkod.ML
     2     Author:     Jasmin Blanchette, TU Muenchen
     2     Author:     Jasmin Blanchette, TU Muenchen
     3     Copyright   2008, 2009
     3     Copyright   2008, 2009, 2010
     4 
     4 
     5 Kodkod problem generator part of Kodkod.
     5 Kodkod problem generator part of Kodkod.
     6 *)
     6 *)
     7 
     7 
     8 signature NITPICK_KODKOD =
     8 signature NITPICK_KODKOD =
   283   o built_in_rels_in_formula
   283   o built_in_rels_in_formula
   284 
   284 
   285 (* Proof.context -> bool -> string -> typ -> rep -> string *)
   285 (* Proof.context -> bool -> string -> typ -> rep -> string *)
   286 fun bound_comment ctxt debug nick T R =
   286 fun bound_comment ctxt debug nick T R =
   287   short_name nick ^
   287   short_name nick ^
   288   (if debug then " :: " ^ plain_string_from_yxml (Syntax.string_of_typ ctxt T)
   288   (if debug then " :: " ^ unyxml (Syntax.string_of_typ ctxt T) else "") ^
   289    else "") ^ " : " ^ string_for_rep R
   289   " : " ^ string_for_rep R
   290 
   290 
   291 (* Proof.context -> bool -> nut -> KK.bound *)
   291 (* Proof.context -> bool -> nut -> KK.bound *)
   292 fun bound_for_plain_rel ctxt debug (u as FreeRel (x, T, R, nick)) =
   292 fun bound_for_plain_rel ctxt debug (u as FreeRel (x, T, R, nick)) =
   293     ([(x, bound_comment ctxt debug nick T R)],
   293     ([(x, bound_comment ctxt debug nick T R)],
   294      if nick = @{const_name bisim_iterator_max} then
   294      if nick = @{const_name bisim_iterator_max} then
   752   maps (nfa_transitions_for_sel ext_ctxt kk rel_table dtypes x)
   752   maps (nfa_transitions_for_sel ext_ctxt kk rel_table dtypes x)
   753        (index_seq 0 (num_sels_for_constr_type T))
   753        (index_seq 0 (num_sels_for_constr_type T))
   754 (* extended_context -> kodkod_constrs -> nut NameTable.table -> dtype_spec list
   754 (* extended_context -> kodkod_constrs -> nut NameTable.table -> dtype_spec list
   755    -> dtype_spec -> nfa_entry option *)
   755    -> dtype_spec -> nfa_entry option *)
   756 fun nfa_entry_for_datatype _ _ _ _ ({co = true, ...} : dtype_spec) = NONE
   756 fun nfa_entry_for_datatype _ _ _ _ ({co = true, ...} : dtype_spec) = NONE
   757   | nfa_entry_for_datatype _ _ _ _ {shallow = true, ...} = NONE
   757   | nfa_entry_for_datatype _ _ _ _ {deep = false, ...} = NONE
   758   | nfa_entry_for_datatype ext_ctxt kk rel_table dtypes {typ, constrs, ...} =
   758   | nfa_entry_for_datatype ext_ctxt kk rel_table dtypes {typ, constrs, ...} =
   759     SOME (typ, maps (nfa_transitions_for_constr ext_ctxt kk rel_table dtypes
   759     SOME (typ, maps (nfa_transitions_for_constr ext_ctxt kk rel_table dtypes
   760                      o #const) constrs)
   760                      o #const) constrs)
   761 
   761 
   762 val empty_rel = KK.Product (KK.None, KK.None)
   762 val empty_rel = KK.Product (KK.None, KK.None)
   924        kk_disjoint_sets kk rs]
   924        kk_disjoint_sets kk rs]
   925     end
   925     end
   926 
   926 
   927 (* extended_context -> int -> int Typtab.table -> kodkod_constrs
   927 (* extended_context -> int -> int Typtab.table -> kodkod_constrs
   928    -> nut NameTable.table -> dtype_spec -> KK.formula list *)
   928    -> nut NameTable.table -> dtype_spec -> KK.formula list *)
   929 fun other_axioms_for_datatype _ _ _ _ _ {shallow = true, ...} = []
   929 fun other_axioms_for_datatype _ _ _ _ _ {deep = false, ...} = []
   930   | other_axioms_for_datatype ext_ctxt bits ofs kk rel_table
   930   | other_axioms_for_datatype ext_ctxt bits ofs kk rel_table
   931                               (dtype as {typ, ...}) =
   931                               (dtype as {typ, ...}) =
   932     let val j0 = offset_of_type ofs typ in
   932     let val j0 = offset_of_type ofs typ in
   933       sel_axioms_for_datatype ext_ctxt bits j0 kk rel_table dtype @
   933       sel_axioms_for_datatype ext_ctxt bits j0 kk rel_table dtype @
   934       uniqueness_axioms_for_datatype ext_ctxt kk rel_table dtype @
   934       uniqueness_axioms_for_datatype ext_ctxt kk rel_table dtype @