equal
deleted
inserted
replaced
2117 end |
2117 end |
2118 |
2118 |
2119 fun ap_curry [_] _ t = t |
2119 fun ap_curry [_] _ t = t |
2120 | ap_curry arg_Ts tuple_T t = |
2120 | ap_curry arg_Ts tuple_T t = |
2121 let val n = length arg_Ts in |
2121 let val n = length arg_Ts in |
2122 list_abs (map (pair "c") arg_Ts, |
2122 fold_rev (Term.abs o pair "c") arg_Ts |
2123 incr_boundvars n t |
2123 (incr_boundvars n t $ mk_flat_tuple tuple_T (map Bound (n - 1 downto 0))) |
2124 $ mk_flat_tuple tuple_T (map Bound (n - 1 downto 0))) |
|
2125 end |
2124 end |
2126 |
2125 |
2127 fun num_occs_of_bound_in_term j (t1 $ t2) = |
2126 fun num_occs_of_bound_in_term j (t1 $ t2) = |
2128 op + (pairself (num_occs_of_bound_in_term j) (t1, t2)) |
2127 op + (pairself (num_occs_of_bound_in_term j) (t1, t2)) |
2129 | num_occs_of_bound_in_term j (Abs (_, _, t')) = |
2128 | num_occs_of_bound_in_term j (Abs (_, _, t')) = |
2180 (disjuncts_of body) |
2179 (disjuncts_of body) |
2181 val base_body = nonrecs |> List.foldl s_disj @{const False} |
2180 val base_body = nonrecs |> List.foldl s_disj @{const False} |
2182 val step_body = recs |> map (repair_rec j) |
2181 val step_body = recs |> map (repair_rec j) |
2183 |> List.foldl s_disj @{const False} |
2182 |> List.foldl s_disj @{const False} |
2184 in |
2183 in |
2185 (list_abs (tl xs, incr_bv (~1, j, base_body)) |
2184 (fold_rev Term.abs (tl xs) (incr_bv (~1, j, base_body)) |
2186 |> ap_n_split (length arg_Ts) tuple_T bool_T, |
2185 |> ap_n_split (length arg_Ts) tuple_T bool_T, |
2187 Abs ("y", tuple_T, list_abs (tl xs, step_body) |
2186 Abs ("y", tuple_T, fold_rev Term.abs (tl xs) step_body |
2188 |> ap_n_split (length arg_Ts) tuple_T bool_T)) |
2187 |> ap_n_split (length arg_Ts) tuple_T bool_T)) |
2189 end |
2188 end |
2190 | aux t = |
2189 | aux t = |
2191 raise TERM ("Nitpick_HOL.linear_pred_base_and_step_rhss.aux", [t]) |
2190 raise TERM ("Nitpick_HOL.linear_pred_base_and_step_rhss.aux", [t]) |
2192 in aux end |
2191 in aux end |
2233 $ list_comb (Const step_x, outer_bounds)) |
2232 $ list_comb (Const step_x, outer_bounds)) |
2234 val image_set = |
2233 val image_set = |
2235 image_const $ (rtrancl_const $ step_set) $ base_set |
2234 image_const $ (rtrancl_const $ step_set) $ base_set |
2236 |> predicatify tuple_T |
2235 |> predicatify tuple_T |
2237 in |
2236 in |
2238 list_abs (outer, image_set |> ap_curry tuple_arg_Ts tuple_T) |
2237 fold_rev Term.abs outer (image_set |> ap_curry tuple_arg_Ts tuple_T) |
2239 |> unfold_defs_in_term hol_ctxt |
2238 |> unfold_defs_in_term hol_ctxt |
2240 end |
2239 end |
2241 |
2240 |
2242 fun is_good_starred_linear_pred_type (Type (@{type_name fun}, Ts)) = |
2241 fun is_good_starred_linear_pred_type (Type (@{type_name fun}, Ts)) = |
2243 forall (not o (is_fun_or_set_type orf is_pair_type)) Ts |
2242 forall (not o (is_fun_or_set_type orf is_pair_type)) Ts |