314 else |
314 else |
315 let val ts = KK.TupleAtomSeq (epsilon - delta, delta + j0) in |
315 let val ts = KK.TupleAtomSeq (epsilon - delta, delta + j0) in |
316 if R2 = Formula Neut then |
316 if R2 = Formula Neut then |
317 [ts] |> not exclusive ? cons (KK.TupleSet []) |
317 [ts] |> not exclusive ? cons (KK.TupleSet []) |
318 else |
318 else |
319 [KK.TupleSet [], KK.TupleProduct (ts, upper_bound_for_rep R2)] |
319 [KK.TupleSet [], |
|
320 if exclusive andalso T1 = T2 andalso epsilon > delta then |
|
321 index_seq delta (epsilon - delta) |
|
322 |> map (fn j => |
|
323 KK.TupleProduct (KK.TupleSet [Kodkod.Tuple [j + j0]], |
|
324 KK.TupleAtomSeq (j, j0))) |
|
325 |> foldl1 KK.TupleUnion |
|
326 else |
|
327 KK.TupleProduct (ts, upper_bound_for_rep R2)] |
320 end) |
328 end) |
321 end |
329 end |
322 | bound_for_sel_rel _ _ _ u = |
330 | bound_for_sel_rel _ _ _ u = |
323 raise NUT ("Nitpick_Kodkod.bound_for_sel_rel", [u]) |
331 raise NUT ("Nitpick_Kodkod.bound_for_sel_rel", [u]) |
324 |
332 |
942 maps (other_axioms_for_datatype hol_ctxt bits ofs kk rel_table) dtypes |
950 maps (other_axioms_for_datatype hol_ctxt bits ofs kk rel_table) dtypes |
943 |
951 |
944 (* int -> int Typtab.table -> bool -> kodkod_constrs -> nut -> KK.formula *) |
952 (* int -> int Typtab.table -> bool -> kodkod_constrs -> nut -> KK.formula *) |
945 fun kodkod_formula_from_nut bits ofs liberal |
953 fun kodkod_formula_from_nut bits ofs liberal |
946 (kk as {kk_all, kk_exist, kk_formula_let, kk_formula_if, kk_or, kk_not, |
954 (kk as {kk_all, kk_exist, kk_formula_let, kk_formula_if, kk_or, kk_not, |
947 kk_iff, kk_implies, kk_and, kk_subset, kk_rel_eq, kk_no, kk_one, |
955 kk_iff, kk_implies, kk_and, kk_subset, kk_rel_eq, kk_no, |
948 kk_some, kk_rel_let, kk_rel_if, kk_union, kk_difference, |
956 kk_lone, kk_one, kk_some, kk_rel_let, kk_rel_if, kk_union, |
949 kk_intersect, kk_product, kk_join, kk_closure, kk_comprehension, |
957 kk_difference, kk_intersect, kk_product, kk_join, kk_closure, |
950 kk_project, kk_project_seq, kk_not3, kk_nat_less, kk_int_less, |
958 kk_comprehension, kk_project, kk_project_seq, kk_not3, |
951 ...}) u = |
959 kk_nat_less, kk_int_less, ...}) u = |
952 let |
960 let |
953 val main_j0 = offset_of_type ofs bool_T |
961 val main_j0 = offset_of_type ofs bool_T |
954 val bool_j0 = main_j0 |
962 val bool_j0 = main_j0 |
955 val bool_atom_R = Atom (2, main_j0) |
963 val bool_atom_R = Atom (2, main_j0) |
956 val false_atom = KK.Atom bool_j0 |
964 val false_atom = KK.Atom bool_j0 |