src/HOL/Tools/Nitpick/nitpick.ML
changeset 41869 9e367f1c9570
parent 41868 a4fb98eb0edf
child 41871 394eef237bd1
equal deleted inserted replaced
41868:a4fb98eb0edf 41869:9e367f1c9570
   256                    "goal")) [Logic.list_implies (assm_ts, orig_t)]))
   256                    "goal")) [Logic.list_implies (assm_ts, orig_t)]))
   257     val _ = print_v (enclose "Timestamp: " "." o Date.fmt "%H:%M:%S"
   257     val _ = print_v (enclose "Timestamp: " "." o Date.fmt "%H:%M:%S"
   258                      o Date.fromTimeLocal o Time.now)
   258                      o Date.fromTimeLocal o Time.now)
   259     val neg_t = if falsify then Logic.mk_implies (orig_t, @{prop False})
   259     val neg_t = if falsify then Logic.mk_implies (orig_t, @{prop False})
   260                 else orig_t
   260                 else orig_t
       
   261     val conj_ts = neg_t :: assm_ts @ evals @ map_filter fst preconstrs
   261     val tfree_table =
   262     val tfree_table =
   262       if merge_type_vars then
   263       if merge_type_vars then merged_type_var_table_for_terms thy conj_ts
   263         merged_type_var_table_for_terms thy (neg_t :: assm_ts @ evals)
   264       else []
   264       else
   265     val merge_tfrees = merge_type_vars_in_term thy merge_type_vars tfree_table
   265         []
   266     val neg_t = neg_t |> merge_tfrees
   266     val neg_t = merge_type_vars_in_term thy merge_type_vars tfree_table neg_t
   267     val assm_ts = assm_ts |> map merge_tfrees
   267     val assm_ts = map (merge_type_vars_in_term thy merge_type_vars tfree_table)
   268     val evals = evals |> map merge_tfrees
   268                       assm_ts
   269     val preconstrs = preconstrs |> map (apfst (Option.map merge_tfrees))
   269     val evals = map (merge_type_vars_in_term thy merge_type_vars tfree_table)
   270     val conj_ts = neg_t :: assm_ts @ evals @ map_filter fst preconstrs
   270                     evals
       
   271     val original_max_potential = max_potential
   271     val original_max_potential = max_potential
   272     val original_max_genuine = max_genuine
   272     val original_max_genuine = max_genuine
   273     val max_bisim_depth = fold Integer.max bisim_depths ~1
   273     val max_bisim_depth = fold Integer.max bisim_depths ~1
   274     val case_names = case_const_names ctxt stds
   274     val case_names = case_const_names ctxt stds
   275     val (defs, built_in_nondefs, user_nondefs) = all_axioms_of ctxt subst
   275     val (defs, built_in_nondefs, user_nondefs) = all_axioms_of ctxt subst
   297        ersatz_table = ersatz_table, skolems = Unsynchronized.ref [],
   297        ersatz_table = ersatz_table, skolems = Unsynchronized.ref [],
   298        special_funs = Unsynchronized.ref [],
   298        special_funs = Unsynchronized.ref [],
   299        unrolled_preds = Unsynchronized.ref [], wf_cache = Unsynchronized.ref [],
   299        unrolled_preds = Unsynchronized.ref [], wf_cache = Unsynchronized.ref [],
   300        constr_cache = Unsynchronized.ref []}
   300        constr_cache = Unsynchronized.ref []}
   301     val pseudo_frees = []
   301     val pseudo_frees = []
   302     val real_frees = fold Term.add_frees (neg_t :: assm_ts) []
   302     val real_frees = fold Term.add_frees conj_ts []
   303     val _ = null (fold Term.add_tvars (neg_t :: assm_ts) []) orelse
   303     val _ = null (fold Term.add_tvars conj_ts []) orelse
   304             raise NOT_SUPPORTED "schematic type variables"
   304             error "Nitpick cannot handle goals with schematic type variables."
   305     val (nondef_ts, def_ts, preconstr_ts, got_all_mono_user_axioms,
   305     val (nondef_ts, def_ts, preconstr_ts, got_all_mono_user_axioms,
   306          no_poly_user_axioms, binarize) =
   306          no_poly_user_axioms, binarize) =
   307       preprocess_formulas hol_ctxt assm_ts neg_t
   307       preprocess_formulas hol_ctxt assm_ts neg_t
   308     val got_all_user_axioms =
   308     val got_all_user_axioms =
   309       got_all_mono_user_axioms andalso no_poly_user_axioms
   309       got_all_mono_user_axioms andalso no_poly_user_axioms