src/HOLCF/Cprod.thy
author huffman
Tue Oct 12 06:20:05 2010 -0700 (2010-10-12)
changeset 40006 116e94f9543b
parent 40002 c5b5f7a3a3b1
child 40502 8e92772bc0e8
permissions -rw-r--r--
remove unneeded lemmas from Fun_Cpo.thy
huffman@15600
     1
(*  Title:      HOLCF/Cprod.thy
huffman@15576
     2
    Author:     Franz Regensburger
huffman@15576
     3
*)
huffman@15576
     4
huffman@15576
     5
header {* The cpo of cartesian products *}
huffman@15576
     6
huffman@15577
     7
theory Cprod
huffman@39987
     8
imports Deflation
huffman@15577
     9
begin
huffman@15576
    10
wenzelm@36452
    11
default_sort cpo
huffman@15576
    12
huffman@35900
    13
subsection {* Continuous case function for unit type *}
huffman@16008
    14
wenzelm@25131
    15
definition
wenzelm@25131
    16
  unit_when :: "'a \<rightarrow> unit \<rightarrow> 'a" where
wenzelm@25131
    17
  "unit_when = (\<Lambda> a _. a)"
huffman@16008
    18
huffman@18289
    19
translations
wenzelm@25131
    20
  "\<Lambda>(). t" == "CONST unit_when\<cdot>t"
huffman@18289
    21
huffman@18289
    22
lemma unit_when [simp]: "unit_when\<cdot>a\<cdot>u = a"
huffman@18289
    23
by (simp add: unit_when_def)
huffman@18289
    24
huffman@35926
    25
subsection {* Continuous version of split function *}
huffman@17834
    26
wenzelm@25131
    27
definition
wenzelm@25131
    28
  csplit :: "('a \<rightarrow> 'b \<rightarrow> 'c) \<rightarrow> ('a * 'b) \<rightarrow> 'c" where
huffman@35922
    29
  "csplit = (\<Lambda> f p. f\<cdot>(fst p)\<cdot>(snd p))"
huffman@15576
    30
huffman@15576
    31
translations
huffman@35926
    32
  "\<Lambda>(CONST Pair x y). t" == "CONST csplit\<cdot>(\<Lambda> x y. t)"
huffman@17816
    33
huffman@15576
    34
huffman@15593
    35
subsection {* Convert all lemmas to the continuous versions *}
huffman@15576
    36
huffman@18077
    37
lemma csplit1 [simp]: "csplit\<cdot>f\<cdot>\<bottom> = f\<cdot>\<bottom>\<cdot>\<bottom>"
huffman@18077
    38
by (simp add: csplit_def)
huffman@18077
    39
huffman@33399
    40
lemma csplit_Pair [simp]: "csplit\<cdot>f\<cdot>(x, y) = f\<cdot>x\<cdot>y"
huffman@35922
    41
by (simp add: csplit_def)
huffman@33399
    42
huffman@39985
    43
subsection {* Map operator for product type *}
huffman@39985
    44
huffman@39985
    45
definition
huffman@39985
    46
  cprod_map :: "('a \<rightarrow> 'b) \<rightarrow> ('c \<rightarrow> 'd) \<rightarrow> 'a \<times> 'c \<rightarrow> 'b \<times> 'd"
huffman@39985
    47
where
huffman@39985
    48
  "cprod_map = (\<Lambda> f g p. (f\<cdot>(fst p), g\<cdot>(snd p)))"
huffman@39985
    49
huffman@39985
    50
lemma cprod_map_Pair [simp]: "cprod_map\<cdot>f\<cdot>g\<cdot>(x, y) = (f\<cdot>x, g\<cdot>y)"
huffman@39985
    51
unfolding cprod_map_def by simp
huffman@39985
    52
huffman@39985
    53
lemma cprod_map_ID: "cprod_map\<cdot>ID\<cdot>ID = ID"
huffman@40002
    54
unfolding cfun_eq_iff by auto
huffman@39985
    55
huffman@39985
    56
lemma cprod_map_map:
huffman@39985
    57
  "cprod_map\<cdot>f1\<cdot>g1\<cdot>(cprod_map\<cdot>f2\<cdot>g2\<cdot>p) =
huffman@39985
    58
    cprod_map\<cdot>(\<Lambda> x. f1\<cdot>(f2\<cdot>x))\<cdot>(\<Lambda> x. g1\<cdot>(g2\<cdot>x))\<cdot>p"
huffman@39985
    59
by (induct p) simp
huffman@39985
    60
huffman@39985
    61
lemma ep_pair_cprod_map:
huffman@39985
    62
  assumes "ep_pair e1 p1" and "ep_pair e2 p2"
huffman@39985
    63
  shows "ep_pair (cprod_map\<cdot>e1\<cdot>e2) (cprod_map\<cdot>p1\<cdot>p2)"
huffman@39985
    64
proof
huffman@39985
    65
  interpret e1p1: ep_pair e1 p1 by fact
huffman@39985
    66
  interpret e2p2: ep_pair e2 p2 by fact
huffman@39985
    67
  fix x show "cprod_map\<cdot>p1\<cdot>p2\<cdot>(cprod_map\<cdot>e1\<cdot>e2\<cdot>x) = x"
huffman@39985
    68
    by (induct x) simp
huffman@39985
    69
  fix y show "cprod_map\<cdot>e1\<cdot>e2\<cdot>(cprod_map\<cdot>p1\<cdot>p2\<cdot>y) \<sqsubseteq> y"
huffman@39985
    70
    by (induct y) (simp add: e1p1.e_p_below e2p2.e_p_below)
huffman@39985
    71
qed
huffman@39985
    72
huffman@39985
    73
lemma deflation_cprod_map:
huffman@39985
    74
  assumes "deflation d1" and "deflation d2"
huffman@39985
    75
  shows "deflation (cprod_map\<cdot>d1\<cdot>d2)"
huffman@39985
    76
proof
huffman@39985
    77
  interpret d1: deflation d1 by fact
huffman@39985
    78
  interpret d2: deflation d2 by fact
huffman@39985
    79
  fix x
huffman@39985
    80
  show "cprod_map\<cdot>d1\<cdot>d2\<cdot>(cprod_map\<cdot>d1\<cdot>d2\<cdot>x) = cprod_map\<cdot>d1\<cdot>d2\<cdot>x"
huffman@39985
    81
    by (induct x) (simp add: d1.idem d2.idem)
huffman@39985
    82
  show "cprod_map\<cdot>d1\<cdot>d2\<cdot>x \<sqsubseteq> x"
huffman@39985
    83
    by (induct x) (simp add: d1.below d2.below)
huffman@39985
    84
qed
huffman@39985
    85
huffman@39985
    86
lemma finite_deflation_cprod_map:
huffman@39985
    87
  assumes "finite_deflation d1" and "finite_deflation d2"
huffman@39985
    88
  shows "finite_deflation (cprod_map\<cdot>d1\<cdot>d2)"
huffman@39985
    89
proof (rule finite_deflation_intro)
huffman@39985
    90
  interpret d1: finite_deflation d1 by fact
huffman@39985
    91
  interpret d2: finite_deflation d2 by fact
huffman@39985
    92
  have "deflation d1" and "deflation d2" by fact+
huffman@39985
    93
  thus "deflation (cprod_map\<cdot>d1\<cdot>d2)" by (rule deflation_cprod_map)
huffman@39985
    94
  have "{p. cprod_map\<cdot>d1\<cdot>d2\<cdot>p = p} \<subseteq> {x. d1\<cdot>x = x} \<times> {y. d2\<cdot>y = y}"
huffman@39985
    95
    by clarsimp
huffman@39985
    96
  thus "finite {p. cprod_map\<cdot>d1\<cdot>d2\<cdot>p = p}"
huffman@39985
    97
    by (rule finite_subset, simp add: d1.finite_fixes d2.finite_fixes)
huffman@39985
    98
qed
huffman@39985
    99
huffman@15576
   100
end