ProgTutorial/Package/Simple_Inductive_Package.thy
author griff
Tue, 21 Jul 2009 12:11:24 +0200
changeset 270 bfcabed9079e
parent 189 069d525f8f1d
child 244 dc95a56b1953
permissions -rw-r--r--
included an alternative solution for the "rev_sum" example as a comment
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     1
theory Simple_Inductive_Package
164
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
     2
imports Main "../Base"
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
     3
uses "simple_inductive_package.ML"
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     4
begin
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     5
164
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
     6
(*
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
     7
simple_inductive
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
     8
  trcl :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool"
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
     9
where
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    10
  base: "trcl R x x"
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    11
| step: "trcl R x y \<Longrightarrow> R y z \<Longrightarrow> trcl R x z"
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    12
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    13
thm trcl_def
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    14
thm trcl.induct
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    15
thm trcl.intros
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    16
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    17
simple_inductive
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    18
  even and odd
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    19
where
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    20
  even0: "even 0"
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    21
| evenS: "odd n \<Longrightarrow> even (Suc n)"
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    22
| oddS: "even n \<Longrightarrow> odd (Suc n)"
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    23
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    24
thm even_def odd_def
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    25
thm even.induct odd.induct
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    26
thm even0
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    27
thm evenS
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    28
thm oddS
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    29
thm even_odd.intros
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    30
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    31
simple_inductive
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    32
  accpart for r :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    33
where
177
4e2341f6599d polishing
Christian Urban <urbanc@in.tum.de>
parents: 164
diff changeset
    34
  accpartI: "(\<And>y. r y x \<Longrightarrow> accpart r y) \<Longrightarrow> accpart r x"
164
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    35
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    36
thm accpart_def
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    37
thm accpart.induct
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    38
thm accpartI
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    39
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    40
locale rel =
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    41
  fixes r :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    42
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    43
simple_inductive (in rel) accpart'
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    44
where
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    45
  accpartI': "\<And>x. (\<And>y. r y x \<Longrightarrow> accpart' y) \<Longrightarrow> accpart' x"
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    46
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    47
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    48
context rel
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    49
begin
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    50
  thm accpartI'
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    51
  thm accpart'.induct
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    52
end
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    53
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    54
thm rel.accpartI'
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    55
thm rel.accpart'.induct
3f617d7a2691 more work on simple_inductive
Christian Urban <urbanc@in.tum.de>
parents: 159
diff changeset
    56
*)
159
64fa844064fa updated to chages in binding module
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    57
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    58
use_chunks "simple_inductive_package.ML"
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    59
159
64fa844064fa updated to chages in binding module
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    60
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    61
end