[isabelle] Predicate Compiler fails with "No specification for ..."



Hello,



I am trying to replicate something like discussed in
https://lists.cam.ac.uk/mailman/htdig/cl-isabelle-users/2020-November/msg00013.html
(the part of the JinjaThreads theory), i.e. generating code for a
reflexive transitive closure predicate, however the [inductify] option
that I have to use on code_pred currently seems to give me some headaches.

In essence, what I have in my project is something like this:





theory "Scratch"

  imports "HOL-Library.Transitive_Closure_Table" Main

begin



typedef mynat = "{n :: nat. True}" by auto

setup_lifting type_definition_mynat

definition P :: "mynat ⇒ mynat ⇒ bool" where

  "P a b ≡ Rep_mynat a = Suc (Rep_mynat b)"

definition t where "t = (P)^**"



(* Fails with: "No specification for Rep_mynat" *)

code_pred (modes: i ⇒ i ⇒ bool, i ⇒ o ⇒ bool) [inductify] t .



(* The final goal *)

export_code t in SML



end





I have some executable predicate P over which I want to execute the
reflexive transitive closure t.



Now from what I understand (please correct me if I am wrong), the
[inductify] option here is necessary so code_pred understands that this
is actually an inductive predicate by digging into the definitions.

But that also means it will go even deeper and try to inspect Rep_mynat
for example, which fails.

What I intuitively would want it to do is to only unfold the t, but then
consider P an opaque constant.



I have seen that code_pred has quite a few more undocumented options,
but didn't find anything yet that did what I need. Is something like
this possible somehow or am I misunderstanding the inner workings of the
predicate compiler here?



Florian

-- 
Florian Märkl
https://metallic.software




This archive was generated by a fusion of Pipermail (Mailman edition) and MHonArc.