Skip to content

Commit

Permalink
Fix a failure to generate sufficient fresh names in one_line_ify
Browse files Browse the repository at this point in the history
Closes #1250
  • Loading branch information
mn200 committed Jun 28, 2024
1 parent 493fc3f commit ee366f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/coretypes/DefnBase.sml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ fun cases_prove case_const_def th k t =
end
else if is_exists (concl th) then
let val (v, bod) = dest_exists (concl th)
val v' = variant (free_vars t) v
val avoids = op_union aconv (free_vars t) (free_vars (concl th))
val v' = variant avoids v
val bod' = subst[v |-> v'] bod
val t_th = recurse (ASSUME bod')
in
Expand Down
15 changes: 15 additions & 0 deletions src/num/theories/selftest.sml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ val colourtests =

val _ = app colourpp_test colourtests

fun good_oneline th =
null (hyp th) andalso
(let val cs = strip_conj (concl th)
in
length cs = 1 andalso is_eq (hd cs)
end)

fun test msg th =
(tprint ("one_line_ify on " ^ msg);
require_msg (check_result good_oneline)
(trace("assumptions", 1) thm_to_string)
(DefnBase.one_line_ify NONE) th)
val _ = test "cv_sub_def" cvTheory.cv_sub_def

open groundEval numeralTheory

val _ = overload_on ("B1", ``BIT1``);
Expand Down Expand Up @@ -124,3 +138,4 @@ val _ = testdot ``4 + 5 + 9`` ``18``;

val _ = testdot ``(\x. x + y) 5`` ``5 + y``;
val _ = testdot ``(\x. x + x + 1) ((\y. y + 10) 4)`` ``29``;

0 comments on commit ee366f3

Please sign in to comment.