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