src/HOLCF/Discrete.thy
author wenzelm
Wed, 03 Nov 2010 21:53:56 +0100
changeset 40335 3e4bb6e7c3ca
parent 40091 1ca61fbd8a79
child 40434 f775e6e0dc99
permissions -rw-r--r--
feeder: treat header as escaped utf8 to allow initial ML text to refer to non-ASCII file/directory names (e.g. "Documents/" on Chinese Ubuntu);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2841
c2508f4ab739 Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff changeset
     1
(*  Title:      HOLCF/Discrete.thy
c2508f4ab739 Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff changeset
     2
    Author:     Tobias Nipkow
c2508f4ab739 Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff changeset
     3
*)
c2508f4ab739 Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff changeset
     4
15578
d364491ba718 add header
huffman
parents: 15555
diff changeset
     5
header {* Discrete cpo types *}
d364491ba718 add header
huffman
parents: 15555
diff changeset
     6
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
     7
theory Discrete
19105
3aabd46340e0 use minimal imports
huffman
parents: 16213
diff changeset
     8
imports Cont
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
     9
begin
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    10
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    11
datatype 'a discr = Discr "'a :: type"
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    12
35900
aa5dfb03eb1e remove LaTeX hyperref warnings by avoiding antiquotations within section headings
huffman
parents: 31076
diff changeset
    13
subsection {* Discrete ordering *}
15590
17f4f5afcd5f added subsection headings, cleaned up some proofs
huffman
parents: 15578
diff changeset
    14
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    15
instantiation discr :: (type) below
25902
c00823ce7288 new-style class instantiation
huffman
parents: 25827
diff changeset
    16
begin
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    17
25902
c00823ce7288 new-style class instantiation
huffman
parents: 25827
diff changeset
    18
definition
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    19
  below_discr_def:
25902
c00823ce7288 new-style class instantiation
huffman
parents: 25827
diff changeset
    20
    "(op \<sqsubseteq> :: 'a discr \<Rightarrow> 'a discr \<Rightarrow> bool) = (op =)"
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    21
26025
ca6876116bb4 instances for class discrete_cpo
huffman
parents: 25921
diff changeset
    22
instance ..
ca6876116bb4 instances for class discrete_cpo
huffman
parents: 25921
diff changeset
    23
end
2841
c2508f4ab739 Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff changeset
    24
35900
aa5dfb03eb1e remove LaTeX hyperref warnings by avoiding antiquotations within section headings
huffman
parents: 31076
diff changeset
    25
subsection {* Discrete cpo class instance *}
aa5dfb03eb1e remove LaTeX hyperref warnings by avoiding antiquotations within section headings
huffman
parents: 31076
diff changeset
    26
26025
ca6876116bb4 instances for class discrete_cpo
huffman
parents: 25921
diff changeset
    27
instance discr :: (type) discrete_cpo
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    28
by intro_classes (simp add: below_discr_def)
25902
c00823ce7288 new-style class instantiation
huffman
parents: 25827
diff changeset
    29
31076
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    30
lemma discr_below_eq [iff]: "((x::('a::type)discr) << y) = (x = y)"
99fe356cbbc2 rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents: 29138
diff changeset
    31
by simp (* FIXME: same discrete_cpo - remove? is [iff] important? *)
25902
c00823ce7288 new-style class instantiation
huffman
parents: 25827
diff changeset
    32
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    33
lemma discr_chain0: 
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    34
 "!!S::nat=>('a::type)discr. chain S ==> S i = S 0"
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    35
apply (unfold chain_def)
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    36
apply (induct_tac "i")
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    37
apply (rule refl)
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    38
apply (erule subst)
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    39
apply (rule sym)
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    40
apply fast
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    41
done
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    42
15639
99ed5113783b cleaned up some proofs
huffman
parents: 15590
diff changeset
    43
lemma discr_chain_range0 [simp]: 
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    44
 "!!S::nat=>('a::type)discr. chain(S) ==> range(S) = {S 0}"
15639
99ed5113783b cleaned up some proofs
huffman
parents: 15590
diff changeset
    45
by (fast elim: discr_chain0)
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    46
35900
aa5dfb03eb1e remove LaTeX hyperref warnings by avoiding antiquotations within section headings
huffman
parents: 31076
diff changeset
    47
subsection {* \emph{undiscr} *}
2841
c2508f4ab739 Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff changeset
    48
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19105
diff changeset
    49
definition
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19105
diff changeset
    50
  undiscr :: "('a::type)discr => 'a" where
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19105
diff changeset
    51
  "undiscr x = (case x of Discr y => y)"
2841
c2508f4ab739 Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff changeset
    52
26025
ca6876116bb4 instances for class discrete_cpo
huffman
parents: 25921
diff changeset
    53
lemma undiscr_Discr [simp]: "undiscr (Discr x) = x"
15590
17f4f5afcd5f added subsection headings, cleaned up some proofs
huffman
parents: 15578
diff changeset
    54
by (simp add: undiscr_def)
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    55
26025
ca6876116bb4 instances for class discrete_cpo
huffman
parents: 25921
diff changeset
    56
lemma Discr_undiscr [simp]: "Discr (undiscr y) = y"
ca6876116bb4 instances for class discrete_cpo
huffman
parents: 25921
diff changeset
    57
by (induct y) simp
ca6876116bb4 instances for class discrete_cpo
huffman
parents: 25921
diff changeset
    58
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    59
lemma discr_chain_f_range0:
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    60
 "!!S::nat=>('a::type)discr. chain(S) ==> range(%i. f(S i)) = {f(S 0)}"
15590
17f4f5afcd5f added subsection headings, cleaned up some proofs
huffman
parents: 15578
diff changeset
    61
by (fast dest: discr_chain0 elim: arg_cong)
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    62
25827
c2adeb1bae5c new instance proofs for classes finite_po, chfin, flat
huffman
parents: 25782
diff changeset
    63
lemma cont_discr [iff]: "cont (%x::('a::type)discr. f x)"
26025
ca6876116bb4 instances for class discrete_cpo
huffman
parents: 25921
diff changeset
    64
by (rule cont_discrete_cpo)
15555
9d4dbd18ff2d converted to new-style theory
huffman
parents: 14981
diff changeset
    65
2841
c2508f4ab739 Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff changeset
    66
end