looking for some solutions? You are welcome.

SOLVED: How to generate code for the existential quantifier

Denis:

Here is a sample theory:

datatype ty = A | B | C

inductive test where
  "test A B"
| "test B C"

inductive test2 where
  "¬(∃z. test x z) ⟹ test2 x"

code_pred [show_modes] test .
code_pred [show_modes] test2 .

values "{x. test2 A}"

The generated code tries to enumerate over ty. And so it fails.

I'm tring to define an executable version of test predicate:

definition "test_ex x ≡ ∃y. test x y"

definition "test_ex_fun x ≡
  Predicate.singleton (λ_. False)
    (Predicate.map (λ_. True) (test_i_o x))"

lemma test_ex_code [code_abbrev, simp]:
  "test_ex_fun = test_ex"
  apply (intro ext)
  unfolding test_ex_def test_ex_fun_def Predicate.singleton_def
  apply (simp split: if_split)

But I can't prove the lemma. Could you suggest a better approach?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent