src/HOLCF/Ssum.thy
author huffman
Fri, 21 Dec 2007 20:29:32 +0100
changeset 25740 de65baf89106
parent 25131 2c8caac48ade
child 25756 86d4930373a1
permissions -rw-r--r--
changed type definition to make Iwhen and reasoning about chains unnecessary; rearranged sections
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15600
a59f07556a8d fixed filename in header
huffman
parents: 15593
diff changeset
     1
(*  Title:      HOLCF/Ssum.thy
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     2
    ID:         $Id$
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
     3
    Author:     Franz Regensburger and Brian Huffman
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     4
16070
4a83dd540b88 removed LICENCE note -- everything is subject to Isabelle licence as
wenzelm
parents: 16060
diff changeset
     5
Strict sum with typedef.
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     6
*)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     7
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     8
header {* The type of strict sums *}
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
     9
15577
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    10
theory Ssum
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    11
imports Cprod Tr
15577
e16da3068ad6 fix headers
huffman
parents: 15576
diff changeset
    12
begin
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    13
16083
fca38c55c8fa added defaultsort declaration, moved cpair_less to Cprod.thy
huffman
parents: 16070
diff changeset
    14
defaultsort pcpo
fca38c55c8fa added defaultsort declaration, moved cpair_less to Cprod.thy
huffman
parents: 16070
diff changeset
    15
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    16
subsection {* Definition of strict sum type *}
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
    17
17817
405fb812e738 add names to infix declarations
huffman
parents: 16921
diff changeset
    18
pcpodef (Ssum)  ('a, 'b) "++" (infixr "++" 10) = 
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    19
  "{p :: tr \<times> ('a \<times> 'b).
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    20
    (cfst\<cdot>p \<sqsubseteq> TT \<longleftrightarrow> csnd\<cdot>(csnd\<cdot>p) = \<bottom>) \<and>
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    21
    (cfst\<cdot>p \<sqsubseteq> FF \<longleftrightarrow> cfst\<cdot>(csnd\<cdot>p) = \<bottom>)}"
16699
24b494ff8f0f use new pcpodef package
huffman
parents: 16316
diff changeset
    22
by simp
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    23
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    24
syntax (xsymbols)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    25
  "++"		:: "[type, type] => type"	("(_ \<oplus>/ _)" [21, 20] 20)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    26
syntax (HTML output)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    27
  "++"		:: "[type, type] => type"	("(_ \<oplus>/ _)" [21, 20] 20)
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    28
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
    29
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
    30
subsection {* Definitions of constructors *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    31
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19440
diff changeset
    32
definition
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19440
diff changeset
    33
  sinl :: "'a \<rightarrow> ('a ++ 'b)" where
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    34
  "sinl = (\<Lambda> a. Abs_Ssum <strictify\<cdot>(\<Lambda> _. TT)\<cdot>a, a, \<bottom>>)"
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
    35
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19440
diff changeset
    36
definition
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19440
diff changeset
    37
  sinr :: "'b \<rightarrow> ('a ++ 'b)" where
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    38
  "sinr = (\<Lambda> b. Abs_Ssum <strictify\<cdot>(\<Lambda> _. FF)\<cdot>b, \<bottom>, b>)"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    39
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    40
lemma sinl_Ssum: "<strictify\<cdot>(\<Lambda> _. TT)\<cdot>a, a, \<bottom>> \<in> Ssum"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    41
by (simp add: Ssum_def strictify_conv_if)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    42
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    43
lemma sinr_Ssum: "<strictify\<cdot>(\<Lambda> _. FF)\<cdot>b, \<bottom>, b> \<in> Ssum"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    44
by (simp add: Ssum_def strictify_conv_if)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    45
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    46
lemma sinl_Abs_Ssum: "sinl\<cdot>a = Abs_Ssum <strictify\<cdot>(\<Lambda> _. TT)\<cdot>a, a, \<bottom>>"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    47
by (unfold sinl_def, simp add: cont_Abs_Ssum sinl_Ssum)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    48
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    49
lemma sinr_Abs_Ssum: "sinr\<cdot>b = Abs_Ssum <strictify\<cdot>(\<Lambda> _. FF)\<cdot>b, \<bottom>, b>"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    50
by (unfold sinr_def, simp add: cont_Abs_Ssum sinr_Ssum)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    51
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    52
lemma Rep_Ssum_sinl: "Rep_Ssum (sinl\<cdot>a) = <strictify\<cdot>(\<Lambda> _. TT)\<cdot>a, a, \<bottom>>"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    53
by (simp add: sinl_Abs_Ssum Abs_Ssum_inverse sinl_Ssum)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    54
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    55
lemma Rep_Ssum_sinr: "Rep_Ssum (sinr\<cdot>b) = <strictify\<cdot>(\<Lambda> _. FF)\<cdot>b, \<bottom>, b>"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    56
by (simp add: sinr_Abs_Ssum Abs_Ssum_inverse sinr_Ssum)
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
    57
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
    58
subsection {* Properties of @{term sinl} and @{term sinr} *}
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
    59
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    60
text {* Compactness *}
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
    61
17837
2922be3544f8 added compactness lemmas; cleaned up
huffman
parents: 17817
diff changeset
    62
lemma compact_sinl [simp]: "compact x \<Longrightarrow> compact (sinl\<cdot>x)"
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    63
by (rule compact_Ssum, simp add: Rep_Ssum_sinl strictify_conv_if)
17837
2922be3544f8 added compactness lemmas; cleaned up
huffman
parents: 17817
diff changeset
    64
2922be3544f8 added compactness lemmas; cleaned up
huffman
parents: 17817
diff changeset
    65
lemma compact_sinr [simp]: "compact x \<Longrightarrow> compact (sinr\<cdot>x)"
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    66
by (rule compact_Ssum, simp add: Rep_Ssum_sinr strictify_conv_if)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    67
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    68
text {* Ordering *}
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    69
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    70
lemma sinl_less [simp]: "(sinl\<cdot>x \<sqsubseteq> sinl\<cdot>y) = (x \<sqsubseteq> y)"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    71
by (simp add: less_Ssum_def Rep_Ssum_sinl strictify_conv_if)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    72
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    73
lemma sinr_less [simp]: "(sinr\<cdot>x \<sqsubseteq> sinr\<cdot>y) = (x \<sqsubseteq> y)"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    74
by (simp add: less_Ssum_def Rep_Ssum_sinr strictify_conv_if)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    75
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    76
lemma sinl_less_sinr [simp]: "(sinl\<cdot>x \<sqsubseteq> sinr\<cdot>y) = (x = \<bottom>)"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    77
by (simp add: less_Ssum_def Rep_Ssum_sinl Rep_Ssum_sinr strictify_conv_if)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    78
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    79
lemma sinr_less_sinl [simp]: "(sinr\<cdot>x \<sqsubseteq> sinl\<cdot>y) = (x = \<bottom>)"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    80
by (simp add: less_Ssum_def Rep_Ssum_sinl Rep_Ssum_sinr strictify_conv_if)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    81
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    82
text {* Equality *}
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    83
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    84
lemma sinl_eq [simp]: "(sinl\<cdot>x = sinl\<cdot>y) = (x = y)"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    85
by (simp add: po_eq_conv)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    86
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    87
lemma sinr_eq [simp]: "(sinr\<cdot>x = sinr\<cdot>y) = (x = y)"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    88
by (simp add: po_eq_conv)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    89
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    90
lemma sinl_eq_sinr [simp]: "(sinl\<cdot>x = sinr\<cdot>y) = (x = \<bottom> \<and> y = \<bottom>)"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    91
by (subst po_eq_conv, simp)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    92
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    93
lemma sinr_eq_sinl [simp]: "(sinr\<cdot>x = sinl\<cdot>y) = (x = \<bottom> \<and> y = \<bottom>)"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    94
by (subst po_eq_conv, simp)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    95
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    96
lemma sinl_inject: "sinl\<cdot>x = sinl\<cdot>y \<Longrightarrow> x = y"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    97
by (rule sinl_eq [THEN iffD1])
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    98
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
    99
lemma sinr_inject: "sinr\<cdot>x = sinr\<cdot>y \<Longrightarrow> x = y"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   100
by (rule sinr_eq [THEN iffD1])
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   101
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   102
text {* Strictness *}
17837
2922be3544f8 added compactness lemmas; cleaned up
huffman
parents: 17817
diff changeset
   103
16211
faa9691da2bc changed to use new contI; renamed strict, defined, and inject lemmas
huffman
parents: 16083
diff changeset
   104
lemma sinl_strict [simp]: "sinl\<cdot>\<bottom> = \<bottom>"
16752
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   105
by (simp add: sinl_Abs_Ssum Abs_Ssum_strict cpair_strict)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   106
16211
faa9691da2bc changed to use new contI; renamed strict, defined, and inject lemmas
huffman
parents: 16083
diff changeset
   107
lemma sinr_strict [simp]: "sinr\<cdot>\<bottom> = \<bottom>"
16752
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   108
by (simp add: sinr_Abs_Ssum Abs_Ssum_strict cpair_strict)
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   109
16752
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   110
lemma sinl_defined_iff [simp]: "(sinl\<cdot>x = \<bottom>) = (x = \<bottom>)"
17837
2922be3544f8 added compactness lemmas; cleaned up
huffman
parents: 17817
diff changeset
   111
by (cut_tac sinl_eq [of "x" "\<bottom>"], simp)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   112
16752
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   113
lemma sinr_defined_iff [simp]: "(sinr\<cdot>x = \<bottom>) = (x = \<bottom>)"
17837
2922be3544f8 added compactness lemmas; cleaned up
huffman
parents: 17817
diff changeset
   114
by (cut_tac sinr_eq [of "x" "\<bottom>"], simp)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   115
16752
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   116
lemma sinl_defined [intro!]: "x \<noteq> \<bottom> \<Longrightarrow> sinl\<cdot>x \<noteq> \<bottom>"
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   117
by simp
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   118
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   119
lemma sinr_defined [intro!]: "x \<noteq> \<bottom> \<Longrightarrow> sinr\<cdot>x \<noteq> \<bottom>"
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   120
by simp
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   121
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   122
subsection {* Case analysis *}
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   123
16921
16094ed8ac6b renamed Exh_Ssum1 to Exh_Ssum; cleaned up
huffman
parents: 16823
diff changeset
   124
lemma Exh_Ssum: 
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   125
  "z = \<bottom> \<or> (\<exists>a. z = sinl\<cdot>a \<and> a \<noteq> \<bottom>) \<or> (\<exists>b. z = sinr\<cdot>b \<and> b \<noteq> \<bottom>)"
16752
270ec60cc9e8 added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
huffman
parents: 16742
diff changeset
   126
apply (rule_tac x=z in Abs_Ssum_induct)
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   127
apply (rule_tac p=y in cprodE, rename_tac t x)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   128
apply (rule_tac p=x in cprodE, rename_tac a b)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   129
apply (rule_tac p=t in trE)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   130
apply (rule disjI1)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   131
apply (simp add: Ssum_def cpair_strict Abs_Ssum_strict)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   132
apply (rule disjI2, rule disjI1, rule_tac x=a in exI)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   133
apply (simp add: sinl_Abs_Ssum Ssum_def)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   134
apply (rule disjI2, rule disjI2, rule_tac x=b in exI)
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   135
apply (simp add: sinr_Abs_Ssum Ssum_def)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   136
done
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   137
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   138
lemma ssumE [cases type: ++]:
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   139
  "\<lbrakk>p = \<bottom> \<Longrightarrow> Q;
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   140
   \<And>x. \<lbrakk>p = sinl\<cdot>x; x \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> Q;
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   141
   \<And>y. \<lbrakk>p = sinr\<cdot>y; y \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q"
16921
16094ed8ac6b renamed Exh_Ssum1 to Exh_Ssum; cleaned up
huffman
parents: 16823
diff changeset
   142
by (cut_tac z=p in Exh_Ssum, auto)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   143
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   144
lemma ssumE2:
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   145
  "\<lbrakk>\<And>x. p = sinl\<cdot>x \<Longrightarrow> Q; \<And>y. p = sinr\<cdot>y \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q"
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   146
by (cases p, simp only: sinl_strict [symmetric], simp, simp)
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   147
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   148
lemma less_sinlD: "p \<sqsubseteq> sinl\<cdot>x \<Longrightarrow> \<exists>y. p = sinl\<cdot>y \<and> y \<sqsubseteq> x"
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   149
by (cases p, rule_tac x="\<bottom>" in exI, simp_all)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   150
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   151
lemma less_sinrD: "p \<sqsubseteq> sinr\<cdot>x \<Longrightarrow> \<exists>y. p = sinr\<cdot>y \<and> y \<sqsubseteq> x"
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   152
by (cases p, rule_tac x="\<bottom>" in exI, simp_all)
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   153
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   154
subsection {* Case analysis combinator *}
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   155
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19440
diff changeset
   156
definition
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19440
diff changeset
   157
  sscase :: "('a \<rightarrow> 'c) \<rightarrow> ('b \<rightarrow> 'c) \<rightarrow> ('a ++ 'b) \<rightarrow> 'c" where
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   158
  "sscase = (\<Lambda> f g s. (\<Lambda><t, x, y>. If t then f\<cdot>x else g\<cdot>y fi)\<cdot>(Rep_Ssum s))"
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   159
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   160
translations
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19440
diff changeset
   161
  "case s of CONST sinl\<cdot>x \<Rightarrow> t1 | CONST sinr\<cdot>y \<Rightarrow> t2" == "CONST sscase\<cdot>(\<Lambda> x. t1)\<cdot>(\<Lambda> y. t2)\<cdot>s"
18078
20e5a6440790 change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
huffman
parents: 17837
diff changeset
   162
20e5a6440790 change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
huffman
parents: 17837
diff changeset
   163
translations
25131
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19440
diff changeset
   164
  "\<Lambda>(CONST sinl\<cdot>x). t" == "CONST sscase\<cdot>(\<Lambda> x. t)\<cdot>\<bottom>"
2c8caac48ade modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents: 19440
diff changeset
   165
  "\<Lambda>(CONST sinr\<cdot>y). t" == "CONST sscase\<cdot>\<bottom>\<cdot>(\<Lambda> y. t)"
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   166
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   167
lemma beta_sscase:
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   168
  "sscase\<cdot>f\<cdot>g\<cdot>s = (\<Lambda><t, x, y>. If t then f\<cdot>x else g\<cdot>y fi)\<cdot>(Rep_Ssum s)"
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   169
unfolding sscase_def by (simp add: cont_Rep_Ssum)
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   170
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   171
lemma sscase1 [simp]: "sscase\<cdot>f\<cdot>g\<cdot>\<bottom> = \<bottom>"
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   172
unfolding beta_sscase by (simp add: Rep_Ssum_strict)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   173
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   174
lemma sscase2 [simp]: "x \<noteq> \<bottom> \<Longrightarrow> sscase\<cdot>f\<cdot>g\<cdot>(sinl\<cdot>x) = f\<cdot>x"
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   175
unfolding beta_sscase by (simp add: Rep_Ssum_sinl)
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   176
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   177
lemma sscase3 [simp]: "y \<noteq> \<bottom> \<Longrightarrow> sscase\<cdot>f\<cdot>g\<cdot>(sinr\<cdot>y) = g\<cdot>y"
25740
de65baf89106 changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents: 25131
diff changeset
   178
unfolding beta_sscase by (simp add: Rep_Ssum_sinr)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   179
16060
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   180
lemma sscase4 [simp]: "sscase\<cdot>sinl\<cdot>sinr\<cdot>z = z"
833be7f71ecd Simplified version of strict sum theory, using TypedefPcpo
huffman
parents: 15606
diff changeset
   181
by (rule_tac p=z in ssumE, simp_all)
15593
24d770bbc44a reordered and arranged for document generation, cleaned up some proofs
huffman
parents: 15577
diff changeset
   182
15576
efb95d0d01f7 converted to new-style theories, and combined numbered files
huffman
parents:
diff changeset
   183
end