src/HOLCF/Pcpodef.thy
author berghofe
Sun, 25 Sep 2005 20:12:59 +0200
changeset 17633 7daaa7fe9c96
parent 16918 d0fdc7b9a33f
child 17812 703005988cfe
permissions -rw-r--r--
Added ExecutableSet.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
     1
(*  Title:      HOLCF/Pcpodef.thy
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
     2
    ID:         $Id$
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
     3
    Author:     Brian Huffman
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
     4
*)
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
     5
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
     6
header {* Subtypes of pcpos *}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
     7
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
     8
theory Pcpodef
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
     9
imports Adm
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    10
uses ("pcpodef_package.ML")
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    11
begin
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    12
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    13
subsection {* Proving a subtype is a partial order *}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    14
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    15
text {*
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    16
  A subtype of a partial order is itself a partial order,
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    17
  if the ordering is defined in the standard way.
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    18
*}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    19
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    20
theorem typedef_po:
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    21
  fixes Abs :: "'a::po \<Rightarrow> 'b::sq_ord"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    22
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    23
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    24
  shows "OFCLASS('b, po_class)"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    25
 apply (intro_classes, unfold less)
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    26
   apply (rule refl_less)
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    27
  apply (rule type_definition.Rep_inject [OF type, THEN iffD1])
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    28
  apply (erule (1) antisym_less)
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    29
 apply (erule (1) trans_less)
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    30
done
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    31
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    32
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    33
subsection {* Proving a subtype is complete *}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    34
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    35
text {*
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    36
  A subtype of a cpo is itself a cpo if the ordering is
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    37
  defined in the standard way, and the defining subset
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    38
  is closed with respect to limits of chains.  A set is
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    39
  closed if and only if membership in the set is an
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    40
  admissible predicate.
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    41
*}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    42
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    43
lemma monofun_Rep:
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    44
  assumes less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    45
  shows "monofun Rep"
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    46
by (rule monofunI, unfold less)
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    47
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    48
lemmas ch2ch_Rep = ch2ch_monofun [OF monofun_Rep]
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    49
lemmas ub2ub_Rep = ub2ub_monofun [OF monofun_Rep]
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    50
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    51
lemma Abs_inverse_lub_Rep:
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    52
  fixes Abs :: "'a::cpo \<Rightarrow> 'b::po"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    53
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    54
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    55
    and adm:  "adm (\<lambda>x. x \<in> A)"
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    56
  shows "chain S \<Longrightarrow> Rep (Abs (\<Squnion>i. Rep (S i))) = (\<Squnion>i. Rep (S i))"
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    57
 apply (rule type_definition.Abs_inverse [OF type])
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    58
 apply (erule admD [OF adm ch2ch_Rep [OF less], rule_format])
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    59
 apply (rule type_definition.Rep [OF type])
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    60
done
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    61
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    62
theorem typedef_lub:
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    63
  fixes Abs :: "'a::cpo \<Rightarrow> 'b::po"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    64
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    65
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    66
    and adm: "adm (\<lambda>x. x \<in> A)"
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    67
  shows "chain S \<Longrightarrow> range S <<| Abs (\<Squnion>i. Rep (S i))"
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    68
 apply (frule ch2ch_Rep [OF less])
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    69
 apply (rule is_lubI)
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    70
  apply (rule ub_rangeI)
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    71
  apply (simp only: less Abs_inverse_lub_Rep [OF type less adm])
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    72
  apply (erule is_ub_thelub)
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    73
 apply (simp only: less Abs_inverse_lub_Rep [OF type less adm])
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    74
 apply (erule is_lub_thelub)
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    75
 apply (erule ub2ub_Rep [OF less])
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    76
done
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    77
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    78
lemmas typedef_thelub = typedef_lub [THEN thelubI, standard]
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    79
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    80
theorem typedef_cpo:
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    81
  fixes Abs :: "'a::cpo \<Rightarrow> 'b::po"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    82
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    83
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    84
    and adm: "adm (\<lambda>x. x \<in> A)"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    85
  shows "OFCLASS('b, cpo_class)"
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    86
proof
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    87
  fix S::"nat \<Rightarrow> 'b" assume "chain S"
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    88
  hence "range S <<| Abs (\<Squnion>i. Rep (S i))"
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    89
    by (rule typedef_lub [OF type less adm])
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    90
  thus "\<exists>x. range S <<| x" ..
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
    91
qed
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    92
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    93
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    94
subsubsection {* Continuity of @{term Rep} and @{term Abs} *}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    95
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    96
text {* For any sub-cpo, the @{term Rep} function is continuous. *}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    97
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    98
theorem typedef_cont_Rep:
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
    99
  fixes Abs :: "'a::cpo \<Rightarrow> 'b::cpo"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   100
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   101
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   102
    and adm: "adm (\<lambda>x. x \<in> A)"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   103
  shows "cont Rep"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   104
 apply (rule contI)
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   105
 apply (simp only: typedef_thelub [OF type less adm])
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   106
 apply (simp only: Abs_inverse_lub_Rep [OF type less adm])
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   107
 apply (rule thelubE [OF _ refl])
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   108
 apply (erule ch2ch_Rep [OF less])
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   109
done
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   110
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   111
text {*
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   112
  For a sub-cpo, we can make the @{term Abs} function continuous
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   113
  only if we restrict its domain to the defining subset by
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   114
  composing it with another continuous function.
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   115
*}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   116
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   117
theorem typedef_is_lubI:
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   118
  assumes less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   119
  shows "range (\<lambda>i. Rep (S i)) <<| Rep x \<Longrightarrow> range S <<| x"
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   120
 apply (rule is_lubI)
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   121
  apply (rule ub_rangeI)
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   122
  apply (subst less)
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   123
  apply (erule is_ub_lub)
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   124
 apply (subst less)
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   125
 apply (erule is_lub_lub)
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   126
 apply (erule ub2ub_Rep [OF less])
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   127
done
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   128
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   129
theorem typedef_cont_Abs:
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   130
  fixes Abs :: "'a::cpo \<Rightarrow> 'b::cpo"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   131
  fixes f :: "'c::cpo \<Rightarrow> 'a::cpo"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   132
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   133
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   134
    and adm: "adm (\<lambda>x. x \<in> A)" (* not used *)
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   135
    and f_in_A: "\<And>x. f x \<in> A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   136
    and cont_f: "cont f"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   137
  shows "cont (\<lambda>x. Abs (f x))"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   138
 apply (rule contI)
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   139
 apply (rule typedef_is_lubI [OF less])
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   140
 apply (simp only: type_definition.Abs_inverse [OF type f_in_A])
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   141
 apply (erule cont_f [THEN contE])
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   142
done
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   143
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   144
subsection {* Proving a subtype is pointed *}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   145
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   146
text {*
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   147
  A subtype of a cpo has a least element if and only if
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   148
  the defining subset has a least element.
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   149
*}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   150
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   151
theorem typedef_pcpo_generic:
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   152
  fixes Abs :: "'a::cpo \<Rightarrow> 'b::cpo"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   153
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   154
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   155
    and z_in_A: "z \<in> A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   156
    and z_least: "\<And>x. x \<in> A \<Longrightarrow> z \<sqsubseteq> x"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   157
  shows "OFCLASS('b, pcpo_class)"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   158
 apply (intro_classes)
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   159
 apply (rule_tac x="Abs z" in exI, rule allI)
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   160
 apply (unfold less)
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   161
 apply (subst type_definition.Abs_inverse [OF type z_in_A])
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   162
 apply (rule z_least [OF type_definition.Rep [OF type]])
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   163
done
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   164
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   165
text {*
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   166
  As a special case, a subtype of a pcpo has a least element
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   167
  if the defining subset contains @{term \<bottom>}.
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   168
*}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   169
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   170
theorem typedef_pcpo:
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   171
  fixes Abs :: "'a::pcpo \<Rightarrow> 'b::cpo"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   172
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   173
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   174
    and UU_in_A: "\<bottom> \<in> A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   175
  shows "OFCLASS('b, pcpo_class)"
16918
d0fdc7b9a33f cleaned up; renamed some theorems
huffman
parents: 16738
diff changeset
   176
by (rule typedef_pcpo_generic [OF type less UU_in_A], rule minimal)
16697
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   177
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   178
subsubsection {* Strictness of @{term Rep} and @{term Abs} *}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   179
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   180
text {*
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   181
  For a sub-pcpo where @{term \<bottom>} is a member of the defining
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   182
  subset, @{term Rep} and @{term Abs} are both strict.
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   183
*}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   184
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   185
theorem typedef_Abs_strict:
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   186
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   187
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   188
    and UU_in_A: "\<bottom> \<in> A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   189
  shows "Abs \<bottom> = \<bottom>"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   190
 apply (rule UU_I, unfold less)
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   191
 apply (simp add: type_definition.Abs_inverse [OF type UU_in_A])
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   192
done
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   193
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   194
theorem typedef_Rep_strict:
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   195
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   196
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   197
    and UU_in_A: "\<bottom> \<in> A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   198
  shows "Rep \<bottom> = \<bottom>"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   199
 apply (rule typedef_Abs_strict [OF type less UU_in_A, THEN subst])
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   200
 apply (rule type_definition.Abs_inverse [OF type UU_in_A])
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   201
done
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   202
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   203
theorem typedef_Abs_defined:
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   204
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   205
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   206
    and UU_in_A: "\<bottom> \<in> A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   207
  shows "\<lbrakk>x \<noteq> \<bottom>; x \<in> A\<rbrakk> \<Longrightarrow> Abs x \<noteq> \<bottom>"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   208
 apply (rule typedef_Abs_strict [OF type less UU_in_A, THEN subst])
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   209
 apply (simp add: type_definition.Abs_inject [OF type] UU_in_A)
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   210
done
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   211
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   212
theorem typedef_Rep_defined:
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   213
  assumes type: "type_definition Rep Abs A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   214
    and less: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   215
    and UU_in_A: "\<bottom> \<in> A"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   216
  shows "x \<noteq> \<bottom> \<Longrightarrow> Rep x \<noteq> \<bottom>"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   217
 apply (rule typedef_Rep_strict [OF type less UU_in_A, THEN subst])
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   218
 apply (simp add: type_definition.Rep_inject [OF type])
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   219
done
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   220
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   221
subsection {* HOLCF type definition package *}
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   222
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   223
use "pcpodef_package.ML"
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   224
007f4caab6c1 renamed from TypedefPcpo.thy;
huffman
parents:
diff changeset
   225
end