0

I'm currently trying use Isabelle/HOL's reification tactic. I'm unable to use different interpretation functions below quantifiers/lambdas. The below MWE illustrates this. The important part is the definition of the form function, where the ter call occurs below the . When trying to use the reify tactic I get an Cannot find the atoms equation error. I don't get this error for interpretation functions which only call themselves under quantifiers.

I can't really reformulate my problem to avoid this. Does anybody know how to get reify working for such cases?

theory MWE
imports
  "HOL-Library.Reflection"
begin

datatype Ter = V nat | P Ter Ter
datatype Form = All0 Ter

fun ter :: "Ter ⇒ nat list ⇒ nat"
  where "ter (V n) vs     = vs ! n"
      | "ter (P t1 t2) vs = ter t1 vs + ter t2 vs"

fun form :: "Form ⇒ nat list ⇒ bool"
  where "form (All0 t) vs = (∀ v . ter t (v#vs) = 0)" (* use of different interpretation function below quantifier *)

(*
  I would expect this to reify to:
    form (All0 (P (V 0) (V 0))) []
  instead I get an error :-(
*)
lemma "∀ n :: nat . n + n = 0"
  apply (reify ter.simps form.simps)
  (* proof (prove)
  goal (1 subgoal):
   1. ∀n. n + n = n + n 
  Cannot find the atoms equation *)
  oops



(* As a side note: the following example in src/HOL/ex/Reflection_Examples.thy (line 448, Isabelle2022) seems to be broken? For me, the reify invocation
    doesn't change the goal at all. It uses quantifiers too, but only calls the same interpretation function under quantifiers and also doesn't throw an error,
    so at least for me this seems to be unrelated to my problem.
*)
(*
lemma " ∀x. ∃n. ((Suc n) * length (([(3::int) * x + f t * y - 9 + (- z)] @ []) @ xs) = length xs) ∧ m < 5*n - length (xs @ [2,3,4,x*z + 8 - y]) ⟶ (∃p. ∀q. p ∧ q ⟶ r)"
  apply (reify Irifm.simps Irnat_simps Irlist.simps Irint_simps)
oops
*)

end

0 Answers0