src/HOLCF/Domain.thy
author huffman
Tue, 19 Oct 2010 15:01:51 -0700
changeset 40040 3adb92ee2f22
parent 40039 391746914dba
child 40321 d065b195ec89
permissions -rw-r--r--
rename domain_theorems.ML to domain_induction.ML; rename domain_extender.ML to domain.ML
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
    Author:     Brian Huffman
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
     3
*)
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
     4
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
     5
header {* Domain package *}
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
theory Domain
33800
d625c373b160 Domain.thy imports Representable.thy
huffman
parents: 33504
diff changeset
     8
imports Ssum Sprod Up One Tr Fixrec Representable
30910
a7cc0ef93269 set up domain package in Domain.thy
huffman
parents: 29138
diff changeset
     9
uses
a7cc0ef93269 set up domain package in Domain.thy
huffman
parents: 29138
diff changeset
    10
  ("Tools/cont_consts.ML")
a7cc0ef93269 set up domain package in Domain.thy
huffman
parents: 29138
diff changeset
    11
  ("Tools/cont_proc.ML")
35444
73f645fdd4ff reorganizing domain package code (in progress)
huffman
parents: 35117
diff changeset
    12
  ("Tools/Domain/domain_constructors.ML")
32126
a5042f260440 obey captialized directory names convention
haftmann
parents: 31230
diff changeset
    13
  ("Tools/Domain/domain_axioms.ML")
40040
3adb92ee2f22 rename domain_theorems.ML to domain_induction.ML; rename domain_extender.ML to domain.ML
huffman
parents: 40039
diff changeset
    14
  ("Tools/Domain/domain_induction.ML")
3adb92ee2f22 rename domain_theorems.ML to domain_induction.ML; rename domain_extender.ML to domain.ML
huffman
parents: 40039
diff changeset
    15
  ("Tools/Domain/domain.ML")
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    16
begin
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    17
36452
d37c6eed8117 renamed command 'defaultsort' to 'default_sort';
wenzelm
parents: 36160
diff changeset
    18
default_sort pcpo
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    19
23376
53317a1ec8b2 tuned proofs: avoid implicit prems;
wenzelm
parents: 23152
diff changeset
    20
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    21
subsection {* Casedist *}
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    22
40039
391746914dba simplify some proofs; remove some unused lists of lemmas
huffman
parents: 40026
diff changeset
    23
text {* Lemmas for proving nchotomy rule: *}
391746914dba simplify some proofs; remove some unused lists of lemmas
huffman
parents: 40026
diff changeset
    24
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    25
lemma ex_one_defined_iff:
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    26
  "(\<exists>x. P x \<and> x \<noteq> \<bottom>) = P ONE"
40039
391746914dba simplify some proofs; remove some unused lists of lemmas
huffman
parents: 40026
diff changeset
    27
by simp
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    28
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    29
lemma ex_up_defined_iff:
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    30
  "(\<exists>x. P x \<and> x \<noteq> \<bottom>) = (\<exists>x. P (up\<cdot>x))"
40039
391746914dba simplify some proofs; remove some unused lists of lemmas
huffman
parents: 40026
diff changeset
    31
by (safe, case_tac x, auto)
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    32
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    33
lemma ex_sprod_defined_iff:
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    34
 "(\<exists>y. P y \<and> y \<noteq> \<bottom>) =
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    35
  (\<exists>x y. (P (:x, y:) \<and> x \<noteq> \<bottom>) \<and> y \<noteq> \<bottom>)"
40039
391746914dba simplify some proofs; remove some unused lists of lemmas
huffman
parents: 40026
diff changeset
    36
by (safe, case_tac y, auto)
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    37
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    38
lemma ex_sprod_up_defined_iff:
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    39
 "(\<exists>y. P y \<and> y \<noteq> \<bottom>) =
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    40
  (\<exists>x y. P (:up\<cdot>x, y:) \<and> y \<noteq> \<bottom>)"
40039
391746914dba simplify some proofs; remove some unused lists of lemmas
huffman
parents: 40026
diff changeset
    41
by (safe, case_tac y, simp, case_tac x, auto)
15741
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 ex_ssum_defined_iff:
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    44
 "(\<exists>x. P x \<and> x \<noteq> \<bottom>) =
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    45
 ((\<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
    46
  (\<exists>x. P (sinr\<cdot>x) \<and> x \<noteq> \<bottom>))"
40039
391746914dba simplify some proofs; remove some unused lists of lemmas
huffman
parents: 40026
diff changeset
    47
by (safe, case_tac x, auto)
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    48
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    49
lemma exh_start: "p = \<bottom> \<or> (\<exists>x. p = x \<and> x \<noteq> \<bottom>)"
23376
53317a1ec8b2 tuned proofs: avoid implicit prems;
wenzelm
parents: 23152
diff changeset
    50
  by auto
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    51
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    52
lemmas ex_defined_iffs =
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    53
   ex_ssum_defined_iff
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    54
   ex_sprod_up_defined_iff
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    55
   ex_sprod_defined_iff
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    56
   ex_up_defined_iff
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    57
   ex_one_defined_iff
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    58
40039
391746914dba simplify some proofs; remove some unused lists of lemmas
huffman
parents: 40026
diff changeset
    59
text {* Rules for turning nchotomy into exhaust: *}
15741
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 exh_casedist0: "\<lbrakk>R; R \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" (* like make_elim *)
23376
53317a1ec8b2 tuned proofs: avoid implicit prems;
wenzelm
parents: 23152
diff changeset
    62
  by auto
15741
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 exh_casedist1: "((P \<or> Q \<Longrightarrow> R) \<Longrightarrow> S) \<equiv> (\<lbrakk>P \<Longrightarrow> R; Q \<Longrightarrow> R\<rbrakk> \<Longrightarrow> S)"
23376
53317a1ec8b2 tuned proofs: avoid implicit prems;
wenzelm
parents: 23152
diff changeset
    65
  by rule auto
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    66
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    67
lemma exh_casedist2: "(\<exists>x. P x \<Longrightarrow> Q) \<equiv> (\<And>x. P x \<Longrightarrow> Q)"
23376
53317a1ec8b2 tuned proofs: avoid implicit prems;
wenzelm
parents: 23152
diff changeset
    68
  by rule auto
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    69
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    70
lemma exh_casedist3: "(P \<and> Q \<Longrightarrow> R) \<equiv> (P \<Longrightarrow> Q \<Longrightarrow> R)"
23376
53317a1ec8b2 tuned proofs: avoid implicit prems;
wenzelm
parents: 23152
diff changeset
    71
  by rule auto
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    72
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    73
lemmas exh_casedists = exh_casedist1 exh_casedist2 exh_casedist3
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
    74
30910
a7cc0ef93269 set up domain package in Domain.thy
huffman
parents: 29138
diff changeset
    75
a7cc0ef93269 set up domain package in Domain.thy
huffman
parents: 29138
diff changeset
    76
subsection {* Installing the domain package *}
a7cc0ef93269 set up domain package in Domain.thy
huffman
parents: 29138
diff changeset
    77
30911
7809cbaa1b61 domain package: simplify internal proofs of con_rews
huffman
parents: 30910
diff changeset
    78
lemmas con_strict_rules =
7809cbaa1b61 domain package: simplify internal proofs of con_rews
huffman
parents: 30910
diff changeset
    79
  sinl_strict sinr_strict spair_strict1 spair_strict2
7809cbaa1b61 domain package: simplify internal proofs of con_rews
huffman
parents: 30910
diff changeset
    80
7809cbaa1b61 domain package: simplify internal proofs of con_rews
huffman
parents: 30910
diff changeset
    81
lemmas con_defined_iff_rules =
7809cbaa1b61 domain package: simplify internal proofs of con_rews
huffman
parents: 30910
diff changeset
    82
  sinl_defined_iff sinr_defined_iff spair_strict_iff up_defined ONE_defined
7809cbaa1b61 domain package: simplify internal proofs of con_rews
huffman
parents: 30910
diff changeset
    83
35117
eeec2a320a77 change generated lemmas dist_eqs and dist_les to iff-style
huffman
parents: 33800
diff changeset
    84
lemmas con_below_iff_rules =
eeec2a320a77 change generated lemmas dist_eqs and dist_les to iff-style
huffman
parents: 33800
diff changeset
    85
  sinl_below sinr_below sinl_below_sinr sinr_below_sinl con_defined_iff_rules
eeec2a320a77 change generated lemmas dist_eqs and dist_les to iff-style
huffman
parents: 33800
diff changeset
    86
eeec2a320a77 change generated lemmas dist_eqs and dist_les to iff-style
huffman
parents: 33800
diff changeset
    87
lemmas con_eq_iff_rules =
eeec2a320a77 change generated lemmas dist_eqs and dist_les to iff-style
huffman
parents: 33800
diff changeset
    88
  sinl_eq sinr_eq sinl_eq_sinr sinr_eq_sinl con_defined_iff_rules
eeec2a320a77 change generated lemmas dist_eqs and dist_les to iff-style
huffman
parents: 33800
diff changeset
    89
35446
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
    90
lemmas sel_strict_rules =
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
    91
  cfcomp2 sscase1 sfst_strict ssnd_strict fup1
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
    92
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
    93
lemma sel_app_extra_rules:
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
    94
  "sscase\<cdot>ID\<cdot>\<bottom>\<cdot>(sinr\<cdot>x) = \<bottom>"
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
    95
  "sscase\<cdot>ID\<cdot>\<bottom>\<cdot>(sinl\<cdot>x) = x"
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
    96
  "sscase\<cdot>\<bottom>\<cdot>ID\<cdot>(sinl\<cdot>x) = \<bottom>"
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
    97
  "sscase\<cdot>\<bottom>\<cdot>ID\<cdot>(sinr\<cdot>x) = x"
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
    98
  "fup\<cdot>ID\<cdot>(up\<cdot>x) = x"
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
    99
by (cases "x = \<bottom>", simp, simp)+
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
   100
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
   101
lemmas sel_app_rules =
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
   102
  sel_strict_rules sel_app_extra_rules
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
   103
  ssnd_spair sfst_spair up_defined spair_defined
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
   104
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
   105
lemmas sel_defined_iff_rules =
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
   106
  cfcomp2 sfst_defined_iff ssnd_defined_iff
b719dad322fa rewrite domain package code for selector functions
huffman
parents: 35444
diff changeset
   107
35494
45c9a8278faf domain package no longer generates copy functions; all proofs use take functions instead
huffman
parents: 35457
diff changeset
   108
lemmas take_con_rules =
36160
f84fa49a0b69 add rule deflation_ID to proof script for take + constructor rules
huffman
parents: 35653
diff changeset
   109
  ssum_map_sinl' ssum_map_sinr' sprod_map_spair' u_map_up
f84fa49a0b69 add rule deflation_ID to proof script for take + constructor rules
huffman
parents: 35653
diff changeset
   110
  deflation_strict deflation_ID ID1 cfcomp2
35494
45c9a8278faf domain package no longer generates copy functions; all proofs use take functions instead
huffman
parents: 35457
diff changeset
   111
30910
a7cc0ef93269 set up domain package in Domain.thy
huffman
parents: 29138
diff changeset
   112
use "Tools/cont_consts.ML"
a7cc0ef93269 set up domain package in Domain.thy
huffman
parents: 29138
diff changeset
   113
use "Tools/cont_proc.ML"
32126
a5042f260440 obey captialized directory names convention
haftmann
parents: 31230
diff changeset
   114
use "Tools/Domain/domain_axioms.ML"
35457
d63655b88369 move proofs of casedist into domain_constructors.ML
huffman
parents: 35446
diff changeset
   115
use "Tools/Domain/domain_constructors.ML"
40040
3adb92ee2f22 rename domain_theorems.ML to domain_induction.ML; rename domain_extender.ML to domain.ML
huffman
parents: 40039
diff changeset
   116
use "Tools/Domain/domain_induction.ML"
3adb92ee2f22 rename domain_theorems.ML to domain_induction.ML; rename domain_extender.ML to domain.ML
huffman
parents: 40039
diff changeset
   117
use "Tools/Domain/domain.ML"
30910
a7cc0ef93269 set up domain package in Domain.thy
huffman
parents: 29138
diff changeset
   118
15741
29a78517543f New file for theorems used by the domain package
huffman
parents:
diff changeset
   119
end