src/HOL/ex/Transitive_Closure_Table_Ex.thy
author wenzelm
Sun, 02 Nov 2014 18:21:45 +0100
changeset 58889 5b7a9633cfa8
parent 58310 91ea607a34d8
child 61343 5b5656a63bd6
permissions -rw-r--r--
modernized header uniformly as section;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
56922
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
     1
(* Author: Stefan Berghofer, Lukas Bulwahn, TU Muenchen *)
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
     2
58889
5b7a9633cfa8 modernized header uniformly as section;
wenzelm
parents: 58310
diff changeset
     3
section {* Simple example for table-based implementation of the reflexive transitive closure *}
56922
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
     4
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
     5
theory Transitive_Closure_Table_Ex
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
     6
imports "~~/src/HOL/Library/Transitive_Closure_Table"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
     7
begin
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
     8
58310
91ea607a34d8 updated news
blanchet
parents: 58249
diff changeset
     9
datatype ty = A | B | C
56922
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    10
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    11
inductive test :: "ty \<Rightarrow> ty \<Rightarrow> bool"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    12
where
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    13
  "test A B"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    14
| "test B A"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    15
| "test B C"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    16
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    17
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    18
text {* Invoking with the predicate compiler and the generic code generator *}
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    19
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    20
code_pred test .
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    21
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    22
values "{x. test\<^sup>*\<^sup>* A C}"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    23
values "{x. test\<^sup>*\<^sup>* C A}"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    24
values "{x. test\<^sup>*\<^sup>* A x}"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    25
values "{x. test\<^sup>*\<^sup>* x C}"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    26
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    27
value "test\<^sup>*\<^sup>* A C"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    28
value "test\<^sup>*\<^sup>* C A"
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    29
d411a81b8356 removed junk from library theory
haftmann
parents:
diff changeset
    30
end