merged
authorwenzelm
Tue, 14 Dec 2021 21:13:07 +0100
changeset 74939 d4d3dec0970a
parent 74929 a292605f12ef (diff)
parent 74938 f76bf7b5baed (current diff)
child 74940 fe1d22487427
merged
--- a/src/HOL/Tools/ATP/atp_problem_generate.ML	Tue Dec 14 21:12:33 2021 +0100
+++ b/src/HOL/Tools/ATP/atp_problem_generate.ML	Tue Dec 14 21:13:07 2021 +0100
@@ -2939,8 +2939,7 @@
           fact_min_weight + (fact_max_weight - fact_min_weight) * Real.fromInt j
                             / Real.fromInt num_facts
       in
-        map_index (apfst weight_of) facts
-        |> fold (uncurry add_line_weights)
+        fold_index (fn (i, fact) => add_line_weights (weight_of i) fact) facts
       end
     val get = these o AList.lookup (op =) problem
   in
--- a/src/HOL/Tools/Sledgehammer/sledgehammer_mash.ML	Tue Dec 14 21:12:33 2021 +0100
+++ b/src/HOL/Tools/Sledgehammer/sledgehammer_mash.ML	Tue Dec 14 21:13:07 2021 +0100
@@ -195,8 +195,8 @@
 fun smooth_weight_of_fact rank = Math.pow (1.3, 15.5 - 0.2 * Real.fromInt rank) + 15.0 (* FUDGE *)
 fun steep_weight_of_fact rank = Math.pow (0.62, log2 (Real.fromInt (rank + 1))) (* FUDGE *)
 
-fun weight_facts_smoothly facts = facts ~~ map smooth_weight_of_fact (0 upto length facts - 1)
-fun weight_facts_steeply facts = facts ~~ map steep_weight_of_fact (0 upto length facts - 1)
+fun weight_facts_smoothly facts = map_index (swap o apfst smooth_weight_of_fact) facts
+fun weight_facts_steeply facts = map_index (swap o apfst steep_weight_of_fact) facts
 
 fun sort_array_suffix cmp needed a =
   let
--- a/src/HOL/Tools/Sledgehammer/sledgehammer_prover_atp.ML	Tue Dec 14 21:12:33 2021 +0100
+++ b/src/HOL/Tools/Sledgehammer/sledgehammer_prover_atp.ML	Tue Dec 14 21:13:07 2021 +0100
@@ -99,8 +99,7 @@
   transform_elim_prop
   #> (has_bound_or_var_of_type (is_type_surely_finite ctxt) orf is_exhaustive_finite)
 
-fun get_slices slice slices =
-  (0 upto length slices - 1) ~~ slices |> not slice ? (List.last #> single)
+fun get_slices slice slices = map_index I slices |> not slice ? (List.last #> single)
 
 fun get_facts_of_filter _ [(_, facts)] = facts
   | get_facts_of_filter fact_filter factss =