equal
deleted
inserted
replaced
331 | do_term T' T t = |
331 | do_term T' T t = |
332 if T = T' then t |
332 if T = T' then t |
333 else raise TYPE ("Nitpick_Model.format_fun.do_term", [T, T'], []) |
333 else raise TYPE ("Nitpick_Model.format_fun.do_term", [T, T'], []) |
334 in if T1' = T1 andalso T2' = T2 then t else do_fun T1' T2' T1 T2 t end |
334 in if T1' = T1 andalso T2' = T2 then t else do_fun T1' T2' T1 T2 t end |
335 |
335 |
336 fun truth_const_sort_key @{const True} = "0" |
336 fun truth_const_sort_key \<^const>\<open>True\<close> = "0" |
337 | truth_const_sort_key @{const False} = "2" |
337 | truth_const_sort_key \<^const>\<open>False\<close> = "2" |
338 | truth_const_sort_key _ = "1" |
338 | truth_const_sort_key _ = "1" |
339 |
339 |
340 fun mk_tuple (Type (\<^type_name>\<open>prod\<close>, [T1, T2])) ts = |
340 fun mk_tuple (Type (\<^type_name>\<open>prod\<close>, [T1, T2])) ts = |
341 HOLogic.mk_prod (mk_tuple T1 ts, |
341 HOLogic.mk_prod (mk_tuple T1 ts, |
342 mk_tuple T2 (List.drop (ts, length (HOLogic.flatten_tupleT T1)))) |
342 mk_tuple T2 (List.drop (ts, length (HOLogic.flatten_tupleT T1)))) |
409 insert_const $ Const (unrep_name, T) $ empty_const |
409 insert_const $ Const (unrep_name, T) $ empty_const |
410 else |
410 else |
411 empty_const |
411 empty_const |
412 | aux ((t1, t2) :: zs) = |
412 | aux ((t1, t2) :: zs) = |
413 aux zs |
413 aux zs |
414 |> t2 <> @{const False} |
414 |> t2 <> \<^const>\<open>False\<close> |
415 ? curry (op $) |
415 ? curry (op $) |
416 (insert_const |
416 (insert_const |
417 $ (t1 |> t2 <> @{const True} |
417 $ (t1 |> t2 <> \<^const>\<open>True\<close> |
418 ? curry (op $) |
418 ? curry (op $) |
419 (Const (maybe_name, T --> T)))) |
419 (Const (maybe_name, T --> T)))) |
420 in |
420 in |
421 if forall (fn (_, t) => t <> @{const True} andalso t <> @{const False}) |
421 if forall (fn (_, t) => t <> \<^const>\<open>True\<close> andalso t <> \<^const>\<open>False\<close>) |
422 tps then |
422 tps then |
423 Const (unknown, set_T) |
423 Const (unknown, set_T) |
424 else |
424 else |
425 aux tps |
425 aux tps |
426 end |
426 end |
514 [j div k2, j mod k2] [k1, k2]) |
514 [j div k2, j mod k2] [k1, k2]) |
515 end |
515 end |
516 | term_for_atom seen \<^typ>\<open>prop\<close> _ j k = |
516 | term_for_atom seen \<^typ>\<open>prop\<close> _ j k = |
517 HOLogic.mk_Trueprop (term_for_atom seen bool_T bool_T j k) |
517 HOLogic.mk_Trueprop (term_for_atom seen bool_T bool_T j k) |
518 | term_for_atom _ \<^typ>\<open>bool\<close> _ j _ = |
518 | term_for_atom _ \<^typ>\<open>bool\<close> _ j _ = |
519 if j = 0 then @{const False} else @{const True} |
519 if j = 0 then \<^const>\<open>False\<close> else \<^const>\<open>True\<close> |
520 | term_for_atom seen T _ j k = |
520 | term_for_atom seen T _ j k = |
521 if T = nat_T then |
521 if T = nat_T then |
522 HOLogic.mk_number nat_T j |
522 HOLogic.mk_number nat_T j |
523 else if T = int_T then |
523 else if T = int_T then |
524 HOLogic.mk_number int_T (int_for_atom (k, 0) j) |
524 HOLogic.mk_number int_T (int_for_atom (k, 0) j) |