2375 fun var_types () = |
2375 fun var_types () = |
2376 if is_type_enc_polymorphic type_enc then [tvar_a] |
2376 if is_type_enc_polymorphic type_enc then [tvar_a] |
2377 else fold (ifact_lift add_formula_var_types) (conjs @ facts) [] |
2377 else fold (ifact_lift add_formula_var_types) (conjs @ facts) [] |
2378 fun add_undefined_const T = |
2378 fun add_undefined_const T = |
2379 let |
2379 let |
2380 (* FIXME: make sure type arguments are filtered / clean up code *) |
2380 val name = `(make_fixed_const NONE) \<^const_name>\<open>undefined\<close> |
2381 val (s, s') = |
2381 val ((s, s'), Ts) = |
2382 `(make_fixed_const NONE) \<^const_name>\<open>undefined\<close> |
2382 if is_type_enc_mangling type_enc then |
2383 |> (is_type_enc_mangling type_enc ? mangled_const_name type_enc [T]) |
2383 (mangled_const_name type_enc [T] name, []) |
|
2384 else |
|
2385 (name, [T]) |
2384 in |
2386 in |
2385 Symtab.map_default (s, []) |
2387 Symtab.map_default (s, []) (insert_type thy #3 (s', Ts, T, false, 0, false)) |
2386 (insert_type thy #3 (s', [T], T, false, 0, false)) |
|
2387 end |
2388 end |
2388 fun add_TYPE_const () = |
2389 fun add_TYPE_const () = |
2389 let val (s, s') = TYPE_name in |
2390 let val (s, s') = TYPE_name in |
2390 Symtab.map_default (s, []) |
2391 Symtab.map_default (s, []) |
2391 (insert_type thy #3 |
2392 (insert_type thy #3 |
2398 #> fold add_iterm_syms extra_tms |
2399 #> fold add_iterm_syms extra_tms |
2399 #> (case type_enc of |
2400 #> (case type_enc of |
2400 Native (_, _, Raw_Polymorphic phantoms, _) => |
2401 Native (_, _, Raw_Polymorphic phantoms, _) => |
2401 phantoms = Without_Phantom_Type_Vars ? add_TYPE_const () |
2402 phantoms = Without_Phantom_Type_Vars ? add_TYPE_const () |
2402 | Native _ => I |
2403 | Native _ => I |
2403 | _ => fold add_undefined_const (var_types ()))) |
2404 | _ => |
|
2405 (* Add constants "undefined" as witnesses that the types are inhabited. *) |
|
2406 fold add_undefined_const (var_types ()))) |
2404 end |
2407 end |
2405 |
2408 |
2406 (* We add "bool" in case the helper "True_or_False" is included later. *) |
2409 (* We add "bool" in case the helper "True_or_False" is included later. *) |
2407 fun default_mono level completish = |
2410 fun default_mono level completish = |
2408 {maybe_finite_Ts = [\<^typ>\<open>bool\<close>], |
2411 {maybe_finite_Ts = [\<^typ>\<open>bool\<close>], |