src/HOL/ex/Transitive_Closure_Table_Ex.thy
author wenzelm
Mon, 06 Oct 2014 17:26:30 +0200
changeset 58593 51adee3ace7b
parent 58310 91ea607a34d8
child 58889 5b7a9633cfa8
permissions -rw-r--r--
documentation of @{cite} and cite_macro;

(* Author: Stefan Berghofer, Lukas Bulwahn, TU Muenchen *)

header {* Simple example for table-based implementation of the reflexive transitive closure *}

theory Transitive_Closure_Table_Ex
imports "~~/src/HOL/Library/Transitive_Closure_Table"
begin

datatype ty = A | B | C

inductive test :: "ty \<Rightarrow> ty \<Rightarrow> bool"
where
  "test A B"
| "test B A"
| "test B C"


text {* Invoking with the predicate compiler and the generic code generator *}

code_pred test .

values "{x. test\<^sup>*\<^sup>* A C}"
values "{x. test\<^sup>*\<^sup>* C A}"
values "{x. test\<^sup>*\<^sup>* A x}"
values "{x. test\<^sup>*\<^sup>* x C}"

value "test\<^sup>*\<^sup>* A C"
value "test\<^sup>*\<^sup>* C A"

end