I am trying to derive an instance of proper_interval
for a custom variable
type. However, Isabelle fails to refined a pending goal in the instance proof:
type_synonym name = string
datatype variable = varname: Var name
instantiation variable::ord begin
fun less_eq_variable::"variable ⇒ variable ⇒ bool" where
"less_eq_variable (variable.Var x) (variable.Var y) = (String.implode x ≤ String.implode y)"
fun less_variable::"variable ⇒ variable ⇒ bool" where
"less_variable (variable.Var x) (variable.Var y) = (String.implode x < String.implode y)"
instance proof
qed
end
instantiation variable::proper_interval begin
fun not_adj::"variable ⇒ variable ⇒ bool" where
"not_adj (variable.Var x) (variable.Var y) = (y ≠ (x @ [CHR 0x00]))"
fun proper_interval_variable::"variable proper_interval" where
"proper_interval_variable None None = True"
| "proper_interval_variable None (Some (variable.Var x)) = (x ≠ [])"
| "proper_interval_variable (Some x) None = True"
| "proper_interval_variable (Some x) (Some y) = (less x y ∧ not_adj x y)"
instance proof
show "proper_interval None None = True"
qed
end
Another attempt:
instantiation variable::proper_interval begin
fun proper_interval_variable::"variable proper_interval" where
"proper_interval_variable None None = True"
| "proper_interval_variable None (Some (variable.Var x)) = (x ≠ [])"
| "proper_interval_variable (Some x) None = True"
| "proper_interval_variable (Some (variable.Var x)) (Some (variable.Var y)) =
(less (variable.Var x) (variable.Var y) ∧ y ≠ (x @ [CHR 0x00]))"
instance proof
show "proper_interval None None = True"
qed
end
Does anyone know what I am doing wrong?
show "proper_interval (None::variable option) None = True"
sorry
very typical issue to forget type annotations in the instantiation…
Thank you.
Mathias Fleury said:
very typical issue to forget type annotations in the instantiation…
Is this something you could summarise in a few words so that we can add it here? :)
https://github.com/isabelle-prover/cookbook/blob/master/_data/common_errors.yml
It will then be displayed here:
https://isabelle.systems/cookbook/src/common_errors/
Merged. Now online here:
https://isabelle.systems/cookbook/src/common_errors/
Thanks @David Wang :)
Last updated: Dec 21 2024 at 16:20 UTC