Domagoj Stolfa
2018-09-04 11:58:47 UTC
Hi all:
I've tried naively writing a function that filters some values in the codomain of an fmap. It resulted in a function that looks a little bit like:
fun filter_types_clause :: "(var, (ty à nat)) fmap â (var, (ty à nat)) fmap" where
"filter_types_clause m = fmfilter
(λx .
(let r = fmlookup m x in
case r of None â False
| Some res â let scp = snd res in
if scp = 2 âš scp = 3
then True
else False))
m"
However, Isabelle wasn't happy with the function and outputted the following error:
exception THM 0 raised (line 86 of "goal.ML"):
Proof failed.
1. âma. fmfilter
(λx. case fmlookup ma x of None â False
| Some res â let scp = snd res in (scp = 2 âš scp = 3 â¶ True) â§ (¬ (scp = 2 âš scp = 3) â¶ False))
ma =
fmfilter
(λx. Let (fmlookup ma x)
(case_option False
(λres. let scp = snd res in (scp = 2 ⚠scp = 3 ⶠTrue) ⧠(¬ (scp = 2 ⚠scp = 3) ⶠFalse))))
ma
(âma. fmfilter
(λx. case fmlookup ma x of None â False
| Some res â let scp = snd res in (scp = 2 âš scp = 3 â¶ True) â§ (¬ (scp = 2 âš scp = 3) â¶ False))
ma =
fmfilter
(λx. Let (fmlookup ma x)
(case_option False
(λres. let scp = snd res in (scp = 2 ⚠scp = 3 ⶠTrue) ⧠(¬ (scp = 2 ⚠scp = 3) ⶠFalse))))
ma) â¹
((âa. Wellfounded.accp filter_types_clause_rel a â¹ â!y. filter_types_clause_graph a y) &&&
(âP x. (âm. x = m â¹ P) â¹ P))
[filter_types_clause_graph â¡ ??.tinyd.filter_types_clause_graph]
Writing the function without the first let, and instead putting the expression (fmlookup m x) in the case expression eliminates the bug. Moreover, writing it as a definition instead of a function in the above form also gets rid of the problem (as it's non-recursive to begin with). After talking to Lars (who also suggested writing it down as a definition instead of a function), we seem to have reached a conclusion that it may be a bug in Finite_Map -- could anyone confirm/reproduce this? The "var" type is a String.literal and "ty" is just a sum type with four constructors, ty_int, ty_array, ty_bool and ty_unit.
The version of Isabelle is 2018 and I've been running it on Mac OS X.
Thanks!
â
Domagoj
I've tried naively writing a function that filters some values in the codomain of an fmap. It resulted in a function that looks a little bit like:
fun filter_types_clause :: "(var, (ty à nat)) fmap â (var, (ty à nat)) fmap" where
"filter_types_clause m = fmfilter
(λx .
(let r = fmlookup m x in
case r of None â False
| Some res â let scp = snd res in
if scp = 2 âš scp = 3
then True
else False))
m"
However, Isabelle wasn't happy with the function and outputted the following error:
exception THM 0 raised (line 86 of "goal.ML"):
Proof failed.
1. âma. fmfilter
(λx. case fmlookup ma x of None â False
| Some res â let scp = snd res in (scp = 2 âš scp = 3 â¶ True) â§ (¬ (scp = 2 âš scp = 3) â¶ False))
ma =
fmfilter
(λx. Let (fmlookup ma x)
(case_option False
(λres. let scp = snd res in (scp = 2 ⚠scp = 3 ⶠTrue) ⧠(¬ (scp = 2 ⚠scp = 3) ⶠFalse))))
ma
(âma. fmfilter
(λx. case fmlookup ma x of None â False
| Some res â let scp = snd res in (scp = 2 âš scp = 3 â¶ True) â§ (¬ (scp = 2 âš scp = 3) â¶ False))
ma =
fmfilter
(λx. Let (fmlookup ma x)
(case_option False
(λres. let scp = snd res in (scp = 2 ⚠scp = 3 ⶠTrue) ⧠(¬ (scp = 2 ⚠scp = 3) ⶠFalse))))
ma) â¹
((âa. Wellfounded.accp filter_types_clause_rel a â¹ â!y. filter_types_clause_graph a y) &&&
(âP x. (âm. x = m â¹ P) â¹ P))
[filter_types_clause_graph â¡ ??.tinyd.filter_types_clause_graph]
Writing the function without the first let, and instead putting the expression (fmlookup m x) in the case expression eliminates the bug. Moreover, writing it as a definition instead of a function in the above form also gets rid of the problem (as it's non-recursive to begin with). After talking to Lars (who also suggested writing it down as a definition instead of a function), we seem to have reached a conclusion that it may be a bug in Finite_Map -- could anyone confirm/reproduce this? The "var" type is a String.literal and "ty" is just a sum type with four constructors, ty_int, ty_array, ty_bool and ty_unit.
The version of Isabelle is 2018 and I've been running it on Mac OS X.
Thanks!
â
Domagoj