Skip to content

Commit 9a1e514

Browse files
ordinarymathmn200
authored andcommitted
fix_IF_NONE_EQUALS_OPTION
This change removes IF_NONE_EQUALS_OPTION from the srw_ss and adds 2 lemmas. if_option_eq is the last two conjuncts + 2 more other useful case splits if_option_neq is added for backward compatiblitity and it preserves good behaviour of IF_NONE_EQUALS_OPTION.
1 parent f6bebf3 commit 9a1e514

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/coretypes/optionScript.sml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,29 @@ val IF_EQUALS_OPTION = store_thm(
329329
SRW_TAC [][]);
330330
val _ = export_rewrites ["IF_EQUALS_OPTION"]
331331

332+
Theorem if_option_eq[simp]:
333+
(((if P then X else SOME x) = NONE) <=> P /\ (X = NONE)) /\
334+
(((if P then SOME x else X) = NONE) <=> ~P /\ (X = NONE)) /\
335+
(((if P then X else NONE) = SOME x) <=> P /\ (X = SOME x)) /\
336+
(((if P then NONE else X) = SOME x) <=> ~P /\ (X = SOME x))
337+
Proof
338+
OPTION_CASES_TAC“X:'a option” THEN SRW_TAC [](option_rws)
339+
QED
340+
341+
Theorem if_option_neq[simp]:
342+
(((if P then X else NONE) ≠ NONE) <=> P /\ (X ≠ NONE)) /\
343+
(((if P then NONE else X) ≠ NONE) <=> ~P /\ (X ≠ NONE))
344+
Proof
345+
OPTION_CASES_TAC“X:'a option” THEN SRW_TAC [](option_rws)
346+
QED
347+
332348
val IF_NONE_EQUALS_OPTION = store_thm(
333349
"IF_NONE_EQUALS_OPTION",
334350
``(((if P then X else NONE) = NONE) <=> (P ==> IS_NONE X)) /\
335351
(((if P then NONE else X) = NONE) <=> (IS_SOME X ==> P)) /\
336352
(((if P then X else NONE) = SOME x) <=> P /\ (X = SOME x)) /\
337353
(((if P then NONE else X) = SOME x) <=> ~P /\ (X = SOME x))``,
338354
OPTION_CASES_TAC“X:'a option” THEN SRW_TAC [](option_rws));
339-
val _ = export_rewrites ["IF_NONE_EQUALS_OPTION"]
340355

341356
(* ----------------------------------------------------------------------
342357
OPTION_MAP theorems

0 commit comments

Comments
 (0)