src/HOLCF/Domain.thy
author wenzelm
Tue, 31 May 2005 11:53:12 +0200
changeset 16121 a80aa66d2271
parent 16070 4a83dd540b88
child 16217 96f0c8546265
permissions -rw-r--r--
tuned;
huffman@15741
     1
(*  Title:      HOLCF/Domain.thy
huffman@15741
     2
    ID:         $Id$
huffman@15741
     3
    Author:     Brian Huffman
huffman@15741
     4
*)
huffman@15741
     5
huffman@15741
     6
header {* Domain package *}
huffman@15741
     7
huffman@15741
     8
theory Domain
huffman@15741
     9
imports Ssum Sprod One Up
huffman@15741
    10
files
huffman@15741
    11
  ("domain/library.ML")
huffman@15741
    12
  ("domain/syntax.ML")
huffman@15741
    13
  ("domain/axioms.ML")
huffman@15741
    14
  ("domain/theorems.ML")
huffman@15741
    15
  ("domain/extender.ML")
huffman@15741
    16
  ("domain/interface.ML")
huffman@15741
    17
begin
huffman@15741
    18
huffman@15741
    19
defaultsort pcpo
huffman@15741
    20
huffman@15741
    21
subsection {* Continuous isomorphisms *}
huffman@15741
    22
huffman@15741
    23
text {* A locale for continuous isomorphisms *}
huffman@15741
    24
huffman@15741
    25
locale iso =
huffman@15741
    26
  fixes abs :: "'a \<rightarrow> 'b"
huffman@15741
    27
  fixes rep :: "'b \<rightarrow> 'a"
huffman@15741
    28
  assumes abs_iso [simp]: "rep\<cdot>(abs\<cdot>x) = x"
huffman@15741
    29
  assumes rep_iso [simp]: "abs\<cdot>(rep\<cdot>y) = y"
huffman@15741
    30
huffman@15741
    31
lemma (in iso) swap: "iso rep abs"
huffman@15741
    32
by (rule iso.intro [OF rep_iso abs_iso])
huffman@15741
    33
huffman@15741
    34
lemma (in iso) abs_strict: "abs\<cdot>\<bottom> = \<bottom>"
huffman@15741
    35
proof -
huffman@15741
    36
  have "\<bottom> \<sqsubseteq> rep\<cdot>\<bottom>" ..
huffman@15741
    37
  hence "abs\<cdot>\<bottom> \<sqsubseteq> abs\<cdot>(rep\<cdot>\<bottom>)" by (rule monofun_cfun_arg)
huffman@15741
    38
  hence "abs\<cdot>\<bottom> \<sqsubseteq> \<bottom>" by simp
huffman@15741
    39
  thus ?thesis by (rule UU_I)
huffman@15741
    40
qed
huffman@15741
    41
huffman@15741
    42
lemma (in iso) rep_strict: "rep\<cdot>\<bottom> = \<bottom>"
huffman@15741
    43
by (rule iso.abs_strict [OF swap])
huffman@15741
    44
huffman@15741
    45
lemma (in iso) abs_defin': "abs\<cdot>z = \<bottom> \<Longrightarrow> z = \<bottom>"
huffman@15741
    46
proof -
huffman@15741
    47
  assume A: "abs\<cdot>z = \<bottom>"
huffman@15741
    48
  have "z = rep\<cdot>(abs\<cdot>z)" by simp
huffman@15741
    49
  also have "\<dots> = rep\<cdot>\<bottom>" by (simp only: A)
huffman@15741
    50
  also note rep_strict
huffman@15741
    51
  finally show "z = \<bottom>" .
huffman@15741
    52
qed
huffman@15741
    53
huffman@15741
    54
lemma (in iso) rep_defin': "rep\<cdot>z = \<bottom> \<Longrightarrow> z = \<bottom>"
huffman@15741
    55
by (rule iso.abs_defin' [OF swap])
huffman@15741
    56
huffman@15741
    57
lemma (in iso) abs_defined: "z \<noteq> \<bottom> \<Longrightarrow> abs\<cdot>z \<noteq> \<bottom>"
huffman@15741
    58
by (erule contrapos_nn, erule abs_defin')
huffman@15741
    59
huffman@15741
    60
lemma (in iso) rep_defined: "z \<noteq> \<bottom> \<Longrightarrow> rep\<cdot>z \<noteq> \<bottom>"
huffman@15741
    61
by (erule contrapos_nn, erule rep_defin')
huffman@15741
    62
huffman@15741
    63
lemma (in iso) iso_swap: "(x = abs\<cdot>y) = (rep\<cdot>x = y)"
huffman@15741
    64
proof
huffman@15741
    65
  assume "x = abs\<cdot>y"
huffman@15741
    66
  hence "rep\<cdot>x = rep\<cdot>(abs\<cdot>y)" by simp
huffman@15741
    67
  thus "rep\<cdot>x = y" by simp
huffman@15741
    68
next
huffman@15741
    69
  assume "rep\<cdot>x = y"
huffman@15741
    70
  hence "abs\<cdot>(rep\<cdot>x) = abs\<cdot>y" by simp
huffman@15741
    71
  thus "x = abs\<cdot>y" by simp
huffman@15741
    72
qed
huffman@15741
    73
huffman@15741
    74
subsection {* Casedist *}
huffman@15741
    75
huffman@15741
    76
lemma ex_one_defined_iff:
huffman@15741
    77
  "(\<exists>x. P x \<and> x \<noteq> \<bottom>) = P ONE"
huffman@15741
    78
 apply safe
huffman@15741
    79
  apply (rule_tac p=x in oneE)
huffman@15741
    80
   apply simp
huffman@15741
    81
  apply simp
huffman@15741
    82
 apply force
huffman@15741
    83
done
huffman@15741
    84
huffman@15741
    85
lemma ex_up_defined_iff:
huffman@15741
    86
  "(\<exists>x. P x \<and> x \<noteq> \<bottom>) = (\<exists>x. P (up\<cdot>x))"
huffman@15741
    87
 apply safe
huffman@15741
    88
  apply (rule_tac p=x in upE1)
huffman@15741
    89
   apply simp
huffman@15741
    90
  apply fast
huffman@15741
    91
 apply (force intro!: defined_up)
huffman@15741
    92
done
huffman@15741
    93
huffman@15741
    94
lemma ex_sprod_defined_iff:
huffman@15741
    95
 "(\<exists>y. P y \<and> y \<noteq> \<bottom>) =
huffman@15741
    96
  (\<exists>x y. (P (:x, y:) \<and> x \<noteq> \<bottom>) \<and> y \<noteq> \<bottom>)"
huffman@15741
    97
 apply safe
huffman@15741
    98
  apply (rule_tac p=y in sprodE)
huffman@15741
    99
   apply simp
huffman@15741
   100
  apply fast
huffman@15741
   101
 apply (force intro!: defined_spair)
huffman@15741
   102
done
huffman@15741
   103
huffman@15741
   104
lemma ex_sprod_up_defined_iff:
huffman@15741
   105
 "(\<exists>y. P y \<and> y \<noteq> \<bottom>) =
huffman@15741
   106
  (\<exists>x y. P (:up\<cdot>x, y:) \<and> y \<noteq> \<bottom>)"
huffman@15741
   107
 apply safe
huffman@15741
   108
  apply (rule_tac p=y in sprodE)
huffman@15741
   109
   apply simp
huffman@15741
   110
  apply (rule_tac p=x in upE1)
huffman@15741
   111
   apply simp
huffman@15741
   112
  apply fast
huffman@15741
   113
 apply (force intro!: defined_spair)
huffman@15741
   114
done
huffman@15741
   115
huffman@15741
   116
lemma ex_ssum_defined_iff:
huffman@15741
   117
 "(\<exists>x. P x \<and> x \<noteq> \<bottom>) =
huffman@15741
   118
 ((\<exists>x. P (sinl\<cdot>x) \<and> x \<noteq> \<bottom>) \<or>
huffman@15741
   119
  (\<exists>x. P (sinr\<cdot>x) \<and> x \<noteq> \<bottom>))"
huffman@15741
   120
 apply (rule iffI)
huffman@15741
   121
  apply (erule exE)
huffman@15741
   122
  apply (erule conjE)
huffman@15741
   123
  apply (rule_tac p=x in ssumE)
huffman@15741
   124
    apply simp
huffman@15741
   125
   apply (rule disjI1, fast)
huffman@15741
   126
  apply (rule disjI2, fast)
huffman@15741
   127
 apply (erule disjE)
huffman@15741
   128
  apply (force intro: defined_sinl)
huffman@15741
   129
 apply (force intro: defined_sinr)
huffman@15741
   130
done
huffman@15741
   131
huffman@15741
   132
lemma exh_start: "p = \<bottom> \<or> (\<exists>x. p = x \<and> x \<noteq> \<bottom>)"
huffman@15741
   133
by auto
huffman@15741
   134
huffman@15741
   135
lemmas ex_defined_iffs =
huffman@15741
   136
   ex_ssum_defined_iff
huffman@15741
   137
   ex_sprod_up_defined_iff
huffman@15741
   138
   ex_sprod_defined_iff
huffman@15741
   139
   ex_up_defined_iff
huffman@15741
   140
   ex_one_defined_iff
huffman@15741
   141
huffman@15741
   142
text {* Rules for turning exh into casedist *}
huffman@15741
   143
huffman@15741
   144
lemma exh_casedist0: "\<lbrakk>R; R \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" (* like make_elim *)
huffman@15741
   145
by auto
huffman@15741
   146
huffman@15741
   147
lemma exh_casedist1: "((P \<or> Q \<Longrightarrow> R) \<Longrightarrow> S) \<equiv> (\<lbrakk>P \<Longrightarrow> R; Q \<Longrightarrow> R\<rbrakk> \<Longrightarrow> S)"
huffman@15741
   148
by rule auto
huffman@15741
   149
huffman@15741
   150
lemma exh_casedist2: "(\<exists>x. P x \<Longrightarrow> Q) \<equiv> (\<And>x. P x \<Longrightarrow> Q)"
huffman@15741
   151
by rule auto
huffman@15741
   152
huffman@15741
   153
lemma exh_casedist3: "(P \<and> Q \<Longrightarrow> R) \<equiv> (P \<Longrightarrow> Q \<Longrightarrow> R)"
huffman@15741
   154
by rule auto
huffman@15741
   155
huffman@15741
   156
lemmas exh_casedists = exh_casedist1 exh_casedist2 exh_casedist3
huffman@15741
   157
huffman@15741
   158
huffman@15741
   159
subsection {* Setting up the package *}
huffman@15741
   160
wenzelm@16121
   161
ML {*
huffman@15741
   162
val iso_intro       = thm "iso.intro";
huffman@15741
   163
val iso_abs_iso     = thm "iso.abs_iso";
huffman@15741
   164
val iso_rep_iso     = thm "iso.rep_iso";
huffman@15741
   165
val iso_abs_strict  = thm "iso.abs_strict";
huffman@15741
   166
val iso_rep_strict  = thm "iso.rep_strict";
huffman@15741
   167
val iso_abs_defin'  = thm "iso.abs_defin'";
huffman@15741
   168
val iso_rep_defin'  = thm "iso.rep_defin'";
huffman@15741
   169
val iso_abs_defined = thm "iso.abs_defined";
huffman@15741
   170
val iso_rep_defined = thm "iso.rep_defined";
huffman@15741
   171
val iso_iso_swap    = thm "iso.iso_swap";
huffman@15741
   172
huffman@15741
   173
val exh_start = thm "exh_start";
huffman@15741
   174
val ex_defined_iffs = thms "ex_defined_iffs";
huffman@15741
   175
val exh_casedist0 = thm "exh_casedist0";
huffman@15741
   176
val exh_casedists = thms "exh_casedists";
huffman@15741
   177
*}
huffman@15741
   178
huffman@15741
   179
end