Skip to content

Commit

Permalink
Test for ways in which competing rewrites get applied
Browse files Browse the repository at this point in the history
Desired behaviours taken by observation from de7fb61, chosen
arbitrarily as a point that I happened to have checked out and before
changes in cfa24e2.
  • Loading branch information
mn200 committed Oct 3, 2024
1 parent d17a401 commit 8871e08
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions src/simp/src/selftest.sml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
open HolKernel Parse boolLib simpLib
open testutils boolSimps BackchainingLib

val failcount = ref 0
val _ = diemode := Remember failcount

val _ = Portable.catch_SIGINT()

(* earlier versions of the simplifier would go into an infinite loop on
Expand Down Expand Up @@ -426,12 +429,14 @@ val _ = let
| _ => false
fun test (msg, tac, ing, outgs) =
(tprint msg;
require_msg (testresult outgs) printgoals (VALID tac) ing)
require_msg (testresult outgs) printgoals tac ing)
val T_t = “?x:'a. p”
fun gs c = global_simp_tac c
val fs = full_simp_tac
val gsc = {droptrues=true,elimvars=false,strip=true,oldestfirst=true}
val gsc' = {droptrues=true,elimvars=false,strip=true,oldestfirst=false}
val bss1 = bool_ss ++ rewrites [ASSUME “x = T”]
val bss2 = bss1 ++ rewrites [ASSUME “x = F”]
in
List.app (ignore o test) [
("Abbrev var not rewritten",
Expand Down Expand Up @@ -460,9 +465,26 @@ in
([“x = F”, “y = T”], “p /\ x /\ y”), [([“x = F”, “y = T”], “p /\ x”)]),
("IgnAsm (sub-match)",
asm_simp_tac bool_ss [markerLib.IgnAsm ‘F (* sa *)’],
([“x = F”, “y = T”], “p /\ x /\ y”), [([“x = F”, “y = T”], “p /\ x”)])

([“x = F”, “y = T”], “p /\ x /\ y”), [([“x = F”, “y = T”], “p /\ x”)]),
("Rewrite competition: ASM vs arg",
asm_simp_tac bool_ss [ASSUME “x = T”],
([“x = F”], “P (x:bool):bool”), [([“x = F”], “P F:bool”)]),
("Rewrite competition: ARG1 vs arg2",
asm_simp_tac bool_ss [ASSUME “x = T”, ASSUME “x = F”],
([], “P (x:bool):bool”), [([], “P T:bool”)]),
("Rewrite competition: ASM1 vs asm2",
asm_simp_tac bool_ss [],
([“x=T”, “x=F”], “P (x:bool):bool”), [([“x=T”,“x=F”], “P T:bool”)]),
("Rewrite competition: ss1 vs SS2",
asm_simp_tac bss2 [],
([], “P(x:bool):bool”), [([], “P F:bool”)]),
("Rewrite competition: ARG vs ss",
asm_simp_tac bss1 [ASSUME “x = F”],
([], “P(x:bool):bool”), [([], “P F:bool”)]),
("Rewrite competition: ASM vs ss",
asm_simp_tac bss1 [],
([“x = F”], “P(x:bool):bool”), [([“x = F”], “P F:bool”)])
]
end

val _ = Process.exit Process.success
val _ = exit_count0 failcount

0 comments on commit 8871e08

Please sign in to comment.