src/HOL/HOLCF/Domain_Aux.thy
author wenzelm
Wed, 13 Jan 2016 23:07:06 +0100
changeset 62175 8ffc4d0e652d
parent 59028 df7476e79558
child 68383 93a42bd62ede
permissions -rw-r--r--
isabelle update_cartouches -c -t;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42151
4da4fc77664b tuned headers;
wenzelm
parents: 41430
diff changeset
     1
(*  Title:      HOL/HOLCF/Domain_Aux.thy
35652
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
     2
    Author:     Brian Huffman
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
     3
*)
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
     4
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
     5
section \<open>Domain package support\<close>
35652
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
     6
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
     7
theory Domain_Aux
40502
8e92772bc0e8 move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
huffman
parents: 40327
diff changeset
     8
imports Map_Functions Fixrec
35652
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
     9
begin
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
    10
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
    11
subsection \<open>Continuous isomorphisms\<close>
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    12
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
    13
text \<open>A locale for continuous isomorphisms\<close>
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    14
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    15
locale iso =
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    16
  fixes abs :: "'a \<rightarrow> 'b"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    17
  fixes rep :: "'b \<rightarrow> 'a"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    18
  assumes abs_iso [simp]: "rep\<cdot>(abs\<cdot>x) = x"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    19
  assumes rep_iso [simp]: "abs\<cdot>(rep\<cdot>y) = y"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    20
begin
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    21
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    22
lemma swap: "iso rep abs"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    23
  by (rule iso.intro [OF rep_iso abs_iso])
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    24
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    25
lemma abs_below: "(abs\<cdot>x \<sqsubseteq> abs\<cdot>y) = (x \<sqsubseteq> y)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    26
proof
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    27
  assume "abs\<cdot>x \<sqsubseteq> abs\<cdot>y"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    28
  then have "rep\<cdot>(abs\<cdot>x) \<sqsubseteq> rep\<cdot>(abs\<cdot>y)" by (rule monofun_cfun_arg)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    29
  then show "x \<sqsubseteq> y" by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    30
next
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    31
  assume "x \<sqsubseteq> y"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    32
  then show "abs\<cdot>x \<sqsubseteq> abs\<cdot>y" by (rule monofun_cfun_arg)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    33
qed
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    34
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    35
lemma rep_below: "(rep\<cdot>x \<sqsubseteq> rep\<cdot>y) = (x \<sqsubseteq> y)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    36
  by (rule iso.abs_below [OF swap])
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    37
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    38
lemma abs_eq: "(abs\<cdot>x = abs\<cdot>y) = (x = y)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    39
  by (simp add: po_eq_conv abs_below)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    40
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    41
lemma rep_eq: "(rep\<cdot>x = rep\<cdot>y) = (x = y)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    42
  by (rule iso.abs_eq [OF swap])
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    43
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    44
lemma abs_strict: "abs\<cdot>\<bottom> = \<bottom>"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    45
proof -
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    46
  have "\<bottom> \<sqsubseteq> rep\<cdot>\<bottom>" ..
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    47
  then have "abs\<cdot>\<bottom> \<sqsubseteq> abs\<cdot>(rep\<cdot>\<bottom>)" by (rule monofun_cfun_arg)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    48
  then have "abs\<cdot>\<bottom> \<sqsubseteq> \<bottom>" by simp
41430
1aa23e9f2c87 change some lemma names containing 'UU' to 'bottom'
huffman
parents: 41182
diff changeset
    49
  then show ?thesis by (rule bottomI)
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    50
qed
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    51
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    52
lemma rep_strict: "rep\<cdot>\<bottom> = \<bottom>"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    53
  by (rule iso.abs_strict [OF swap])
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    54
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    55
lemma abs_defin': "abs\<cdot>x = \<bottom> \<Longrightarrow> x = \<bottom>"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    56
proof -
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    57
  have "x = rep\<cdot>(abs\<cdot>x)" by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    58
  also assume "abs\<cdot>x = \<bottom>"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    59
  also note rep_strict
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    60
  finally show "x = \<bottom>" .
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    61
qed
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    62
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    63
lemma rep_defin': "rep\<cdot>z = \<bottom> \<Longrightarrow> z = \<bottom>"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    64
  by (rule iso.abs_defin' [OF swap])
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    65
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    66
lemma abs_defined: "z \<noteq> \<bottom> \<Longrightarrow> abs\<cdot>z \<noteq> \<bottom>"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    67
  by (erule contrapos_nn, erule abs_defin')
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    68
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    69
lemma rep_defined: "z \<noteq> \<bottom> \<Longrightarrow> rep\<cdot>z \<noteq> \<bottom>"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    70
  by (rule iso.abs_defined [OF iso.swap]) (rule iso_axioms)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    71
40321
d065b195ec89 rename lemmas *_defined_iff and *_strict_iff to *_bottom_iff
huffman
parents: 40216
diff changeset
    72
lemma abs_bottom_iff: "(abs\<cdot>x = \<bottom>) = (x = \<bottom>)"
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    73
  by (auto elim: abs_defin' intro: abs_strict)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    74
40321
d065b195ec89 rename lemmas *_defined_iff and *_strict_iff to *_bottom_iff
huffman
parents: 40216
diff changeset
    75
lemma rep_bottom_iff: "(rep\<cdot>x = \<bottom>) = (x = \<bottom>)"
d065b195ec89 rename lemmas *_defined_iff and *_strict_iff to *_bottom_iff
huffman
parents: 40216
diff changeset
    76
  by (rule iso.abs_bottom_iff [OF iso.swap]) (rule iso_axioms)
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    77
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    78
lemma casedist_rule: "rep\<cdot>x = \<bottom> \<or> P \<Longrightarrow> x = \<bottom> \<or> P"
40321
d065b195ec89 rename lemmas *_defined_iff and *_strict_iff to *_bottom_iff
huffman
parents: 40216
diff changeset
    79
  by (simp add: rep_bottom_iff)
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    80
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    81
lemma compact_abs_rev: "compact (abs\<cdot>x) \<Longrightarrow> compact x"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    82
proof (unfold compact_def)
41182
717404c7d59a add notsqsubseteq syntax
huffman
parents: 40774
diff changeset
    83
  assume "adm (\<lambda>y. abs\<cdot>x \<notsqsubseteq> y)"
40327
1dfdbd66093a renamed {Rep,Abs}_CFun to {Rep,Abs}_cfun
huffman
parents: 40321
diff changeset
    84
  with cont_Rep_cfun2
41182
717404c7d59a add notsqsubseteq syntax
huffman
parents: 40774
diff changeset
    85
  have "adm (\<lambda>y. abs\<cdot>x \<notsqsubseteq> abs\<cdot>y)" by (rule adm_subst)
717404c7d59a add notsqsubseteq syntax
huffman
parents: 40774
diff changeset
    86
  then show "adm (\<lambda>y. x \<notsqsubseteq> y)" using abs_below by simp
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    87
qed
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    88
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    89
lemma compact_rep_rev: "compact (rep\<cdot>x) \<Longrightarrow> compact x"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    90
  by (rule iso.compact_abs_rev [OF iso.swap]) (rule iso_axioms)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    91
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    92
lemma compact_abs: "compact x \<Longrightarrow> compact (abs\<cdot>x)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    93
  by (rule compact_rep_rev) simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    94
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    95
lemma compact_rep: "compact x \<Longrightarrow> compact (rep\<cdot>x)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    96
  by (rule iso.compact_abs [OF iso.swap]) (rule iso_axioms)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    97
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    98
lemma iso_swap: "(x = abs\<cdot>y) = (rep\<cdot>x = y)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
    99
proof
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   100
  assume "x = abs\<cdot>y"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   101
  then have "rep\<cdot>x = rep\<cdot>(abs\<cdot>y)" by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   102
  then show "rep\<cdot>x = y" by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   103
next
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   104
  assume "rep\<cdot>x = y"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   105
  then have "abs\<cdot>(rep\<cdot>x) = abs\<cdot>y" by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   106
  then show "x = abs\<cdot>y" by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   107
qed
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   108
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   109
end
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   110
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   111
subsection \<open>Proofs about take functions\<close>
35652
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   112
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   113
text \<open>
35652
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   114
  This section contains lemmas that are used in a module that supports
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   115
  the domain isomorphism package; the module contains proofs related
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   116
  to take functions and the finiteness predicate.
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   117
\<close>
35652
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   118
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   119
lemma deflation_abs_rep:
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   120
  fixes abs and rep and d
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   121
  assumes abs_iso: "\<And>x. rep\<cdot>(abs\<cdot>x) = x"
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   122
  assumes rep_iso: "\<And>y. abs\<cdot>(rep\<cdot>y) = y"
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   123
  shows "deflation d \<Longrightarrow> deflation (abs oo d oo rep)"
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   124
by (rule ep_pair.deflation_e_d_p) (simp add: ep_pair.intro assms)
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   125
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   126
lemma deflation_chain_min:
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   127
  assumes chain: "chain d"
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   128
  assumes defl: "\<And>n. deflation (d n)"
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   129
  shows "d m\<cdot>(d n\<cdot>x) = d (min m n)\<cdot>x"
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   130
proof (rule linorder_le_cases)
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   131
  assume "m \<le> n"
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   132
  with chain have "d m \<sqsubseteq> d n" by (rule chain_mono)
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   133
  then have "d m\<cdot>(d n\<cdot>x) = d m\<cdot>x"
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   134
    by (rule deflation_below_comp1 [OF defl defl])
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   135
  moreover from \<open>m \<le> n\<close> have "min m n = m" by simp
35652
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   136
  ultimately show ?thesis by simp
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   137
next
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   138
  assume "n \<le> m"
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   139
  with chain have "d n \<sqsubseteq> d m" by (rule chain_mono)
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   140
  then have "d m\<cdot>(d n\<cdot>x) = d n\<cdot>x"
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   141
    by (rule deflation_below_comp2 [OF defl defl])
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   142
  moreover from \<open>n \<le> m\<close> have "min m n = n" by simp
35652
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   143
  ultimately show ?thesis by simp
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   144
qed
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   145
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   146
lemma lub_ID_take_lemma:
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   147
  assumes "chain t" and "(\<Squnion>n. t n) = ID"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   148
  assumes "\<And>n. t n\<cdot>x = t n\<cdot>y" shows "x = y"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   149
proof -
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   150
  have "(\<Squnion>n. t n\<cdot>x) = (\<Squnion>n. t n\<cdot>y)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   151
    using assms(3) by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   152
  then have "(\<Squnion>n. t n)\<cdot>x = (\<Squnion>n. t n)\<cdot>y"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   153
    using assms(1) by (simp add: lub_distribs)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   154
  then show "x = y"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   155
    using assms(2) by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   156
qed
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   157
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   158
lemma lub_ID_reach:
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   159
  assumes "chain t" and "(\<Squnion>n. t n) = ID"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   160
  shows "(\<Squnion>n. t n\<cdot>x) = x"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   161
using assms by (simp add: lub_distribs)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   162
35655
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   163
lemma lub_ID_take_induct:
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   164
  assumes "chain t" and "(\<Squnion>n. t n) = ID"
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   165
  assumes "adm P" and "\<And>n. P (t n\<cdot>x)" shows "P x"
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   166
proof -
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   167
  from \<open>chain t\<close> have "chain (\<lambda>n. t n\<cdot>x)" by simp
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   168
  from \<open>adm P\<close> this \<open>\<And>n. P (t n\<cdot>x)\<close> have "P (\<Squnion>n. t n\<cdot>x)" by (rule admD)
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   169
  with \<open>chain t\<close> \<open>(\<Squnion>n. t n) = ID\<close> show "P x" by (simp add: lub_distribs)
35655
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   170
qed
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   171
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   172
subsection \<open>Finiteness\<close>
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   173
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   174
text \<open>
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   175
  Let a ``decisive'' function be a deflation that maps every input to
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   176
  either itself or bottom.  Then if a domain's take functions are all
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   177
  decisive, then all values in the domain are finite.
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   178
\<close>
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   179
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   180
definition
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   181
  decisive :: "('a::pcpo \<rightarrow> 'a) \<Rightarrow> bool"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   182
where
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   183
  "decisive d \<longleftrightarrow> (\<forall>x. d\<cdot>x = x \<or> d\<cdot>x = \<bottom>)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   184
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   185
lemma decisiveI: "(\<And>x. d\<cdot>x = x \<or> d\<cdot>x = \<bottom>) \<Longrightarrow> decisive d"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   186
  unfolding decisive_def by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   187
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   188
lemma decisive_cases:
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   189
  assumes "decisive d" obtains "d\<cdot>x = x" | "d\<cdot>x = \<bottom>"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   190
using assms unfolding decisive_def by auto
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   191
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   192
lemma decisive_bottom: "decisive \<bottom>"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   193
  unfolding decisive_def by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   194
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   195
lemma decisive_ID: "decisive ID"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   196
  unfolding decisive_def by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   197
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   198
lemma decisive_ssum_map:
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   199
  assumes f: "decisive f"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   200
  assumes g: "decisive g"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   201
  shows "decisive (ssum_map\<cdot>f\<cdot>g)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   202
apply (rule decisiveI, rename_tac s)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   203
apply (case_tac s, simp_all)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   204
apply (rule_tac x=x in decisive_cases [OF f], simp_all)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   205
apply (rule_tac x=y in decisive_cases [OF g], simp_all)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   206
done
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   207
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   208
lemma decisive_sprod_map:
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   209
  assumes f: "decisive f"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   210
  assumes g: "decisive g"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   211
  shows "decisive (sprod_map\<cdot>f\<cdot>g)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   212
apply (rule decisiveI, rename_tac s)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   213
apply (case_tac s, simp_all)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   214
apply (rule_tac x=x in decisive_cases [OF f], simp_all)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   215
apply (rule_tac x=y in decisive_cases [OF g], simp_all)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   216
done
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   217
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   218
lemma decisive_abs_rep:
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   219
  fixes abs rep
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   220
  assumes iso: "iso abs rep"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   221
  assumes d: "decisive d"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   222
  shows "decisive (abs oo d oo rep)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   223
apply (rule decisiveI)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   224
apply (rule_tac x="rep\<cdot>x" in decisive_cases [OF d])
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   225
apply (simp add: iso.rep_iso [OF iso])
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   226
apply (simp add: iso.abs_strict [OF iso])
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   227
done
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   228
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   229
lemma lub_ID_finite:
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   230
  assumes chain: "chain d"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   231
  assumes lub: "(\<Squnion>n. d n) = ID"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   232
  assumes decisive: "\<And>n. decisive (d n)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   233
  shows "\<exists>n. d n\<cdot>x = x"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   234
proof -
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   235
  have 1: "chain (\<lambda>n. d n\<cdot>x)" using chain by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   236
  have 2: "(\<Squnion>n. d n\<cdot>x) = x" using chain lub by (rule lub_ID_reach)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   237
  have "\<forall>n. d n\<cdot>x = x \<or> d n\<cdot>x = \<bottom>"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   238
    using decisive unfolding decisive_def by simp
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   239
  hence "range (\<lambda>n. d n\<cdot>x) \<subseteq> {x, \<bottom>}"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   240
    by auto
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   241
  hence "finite (range (\<lambda>n. d n\<cdot>x))"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   242
    by (rule finite_subset, simp)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   243
  with 1 have "finite_chain (\<lambda>n. d n\<cdot>x)"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   244
    by (rule finite_range_imp_finch)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   245
  then have "\<exists>n. (\<Squnion>n. d n\<cdot>x) = d n\<cdot>x"
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   246
    unfolding finite_chain_def by (auto simp add: maxinch_is_thelub)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   247
  with 2 show "\<exists>n. d n\<cdot>x = x" by (auto elim: sym)
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   248
qed
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   249
35655
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   250
lemma lub_ID_finite_take_induct:
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   251
  assumes "chain d" and "(\<Squnion>n. d n) = ID" and "\<And>n. decisive (d n)"
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   252
  shows "(\<And>n. P (d n\<cdot>x)) \<Longrightarrow> P x"
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   253
using lub_ID_finite [OF assms] by metis
e8e4af6da819 generate take_induct lemmas
huffman
parents: 35653
diff changeset
   254
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   255
subsection \<open>Proofs about constructor functions\<close>
40503
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   256
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   257
text \<open>Lemmas for proving nchotomy rule:\<close>
40503
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   258
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   259
lemma ex_one_bottom_iff:
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   260
  "(\<exists>x. P x \<and> x \<noteq> \<bottom>) = P ONE"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   261
by simp
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   262
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   263
lemma ex_up_bottom_iff:
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   264
  "(\<exists>x. P x \<and> x \<noteq> \<bottom>) = (\<exists>x. P (up\<cdot>x))"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   265
by (safe, case_tac x, auto)
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   266
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   267
lemma ex_sprod_bottom_iff:
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   268
 "(\<exists>y. P y \<and> y \<noteq> \<bottom>) =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   269
  (\<exists>x y. (P (:x, y:) \<and> x \<noteq> \<bottom>) \<and> y \<noteq> \<bottom>)"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   270
by (safe, case_tac y, auto)
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   271
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   272
lemma ex_sprod_up_bottom_iff:
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   273
 "(\<exists>y. P y \<and> y \<noteq> \<bottom>) =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   274
  (\<exists>x y. P (:up\<cdot>x, y:) \<and> y \<noteq> \<bottom>)"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   275
by (safe, case_tac y, simp, case_tac x, auto)
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   276
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   277
lemma ex_ssum_bottom_iff:
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   278
 "(\<exists>x. P x \<and> x \<noteq> \<bottom>) =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   279
 ((\<exists>x. P (sinl\<cdot>x) \<and> x \<noteq> \<bottom>) \<or>
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   280
  (\<exists>x. P (sinr\<cdot>x) \<and> x \<noteq> \<bottom>))"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   281
by (safe, case_tac x, auto)
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   282
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   283
lemma exh_start: "p = \<bottom> \<or> (\<exists>x. p = x \<and> x \<noteq> \<bottom>)"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   284
  by auto
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   285
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   286
lemmas ex_bottom_iffs =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   287
   ex_ssum_bottom_iff
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   288
   ex_sprod_up_bottom_iff
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   289
   ex_sprod_bottom_iff
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   290
   ex_up_bottom_iff
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   291
   ex_one_bottom_iff
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   292
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   293
text \<open>Rules for turning nchotomy into exhaust:\<close>
40503
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   294
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   295
lemma exh_casedist0: "\<lbrakk>R; R \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" (* like make_elim *)
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   296
  by auto
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   297
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   298
lemma exh_casedist1: "((P \<or> Q \<Longrightarrow> R) \<Longrightarrow> S) \<equiv> (\<lbrakk>P \<Longrightarrow> R; Q \<Longrightarrow> R\<rbrakk> \<Longrightarrow> S)"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   299
  by rule auto
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   300
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   301
lemma exh_casedist2: "(\<exists>x. P x \<Longrightarrow> Q) \<equiv> (\<And>x. P x \<Longrightarrow> Q)"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   302
  by rule auto
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   303
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   304
lemma exh_casedist3: "(P \<and> Q \<Longrightarrow> R) \<equiv> (P \<Longrightarrow> Q \<Longrightarrow> R)"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   305
  by rule auto
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   306
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   307
lemmas exh_casedists = exh_casedist1 exh_casedist2 exh_casedist3
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   308
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   309
text \<open>Rules for proving constructor properties\<close>
40503
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   310
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   311
lemmas con_strict_rules =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   312
  sinl_strict sinr_strict spair_strict1 spair_strict2
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   313
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   314
lemmas con_bottom_iff_rules =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   315
  sinl_bottom_iff sinr_bottom_iff spair_bottom_iff up_defined ONE_defined
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   316
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   317
lemmas con_below_iff_rules =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   318
  sinl_below sinr_below sinl_below_sinr sinr_below_sinl con_bottom_iff_rules
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   319
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   320
lemmas con_eq_iff_rules =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   321
  sinl_eq sinr_eq sinl_eq_sinr sinr_eq_sinl con_bottom_iff_rules
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   322
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   323
lemmas sel_strict_rules =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   324
  cfcomp2 sscase1 sfst_strict ssnd_strict fup1
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   325
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   326
lemma sel_app_extra_rules:
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   327
  "sscase\<cdot>ID\<cdot>\<bottom>\<cdot>(sinr\<cdot>x) = \<bottom>"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   328
  "sscase\<cdot>ID\<cdot>\<bottom>\<cdot>(sinl\<cdot>x) = x"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   329
  "sscase\<cdot>\<bottom>\<cdot>ID\<cdot>(sinl\<cdot>x) = \<bottom>"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   330
  "sscase\<cdot>\<bottom>\<cdot>ID\<cdot>(sinr\<cdot>x) = x"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   331
  "fup\<cdot>ID\<cdot>(up\<cdot>x) = x"
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   332
by (cases "x = \<bottom>", simp, simp)+
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   333
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   334
lemmas sel_app_rules =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   335
  sel_strict_rules sel_app_extra_rules
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   336
  ssnd_spair sfst_spair up_defined spair_defined
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   337
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   338
lemmas sel_bottom_iff_rules =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   339
  cfcomp2 sfst_bottom_iff ssnd_bottom_iff
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   340
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   341
lemmas take_con_rules =
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   342
  ssum_map_sinl' ssum_map_sinr' sprod_map_spair' u_map_up
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   343
  deflation_strict deflation_ID ID1 cfcomp2
4094d788b904 move stuff from Domain.thy to Domain_Aux.thy
huffman
parents: 40502
diff changeset
   344
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 59028
diff changeset
   345
subsection \<open>ML setup\<close>
35653
f87132febfac move lemmas from Domain.thy to Domain_Aux.thy
huffman
parents: 35652
diff changeset
   346
57945
cacb00a569e0 prefer 'named_theorems' over Named_Thms, with subtle change of semantics due to visual order vs. internal reverse order;
wenzelm
parents: 56511
diff changeset
   347
named_theorems domain_deflation "theorems like deflation a ==> deflation (foo_map$a)"
59028
df7476e79558 named_theorems: multiple args;
wenzelm
parents: 58880
diff changeset
   348
  and domain_map_ID "theorems like foo_map$ID = ID"
57945
cacb00a569e0 prefer 'named_theorems' over Named_Thms, with subtle change of semantics due to visual order vs. internal reverse order;
wenzelm
parents: 56511
diff changeset
   349
48891
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 42151
diff changeset
   350
ML_file "Tools/Domain/domain_take_proofs.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 42151
diff changeset
   351
ML_file "Tools/cont_consts.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 42151
diff changeset
   352
ML_file "Tools/cont_proc.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 42151
diff changeset
   353
ML_file "Tools/Domain/domain_constructors.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 42151
diff changeset
   354
ML_file "Tools/Domain/domain_induction.ML"
35652
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   355
05ca920cd94b move take-proofs stuff into new theory Domain_Aux.thy
huffman
parents:
diff changeset
   356
end