src/HOL/HOLCF/Representable.thy
author huffman
Sun, 19 Dec 2010 06:34:41 -0800
changeset 41287 029a6fc1bfb8
parent 41286 3d7685a4a5ff
child 41290 e9c9577d88b5
permissions -rw-r--r--
type 'defl' takes a type parameter again (cf. b525988432e9)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41285
efd23c1d9886 renamed Bifinite.thy to Representable.thy
huffman
parents: 41034
diff changeset
     1
(*  Title:      HOLCF/Representable.thy
25903
5e59af604d4f new theory of bifinite domains
huffman
parents:
diff changeset
     2
    Author:     Brian Huffman
5e59af604d4f new theory of bifinite domains
huffman
parents:
diff changeset
     3
*)
5e59af604d4f new theory of bifinite domains
huffman
parents:
diff changeset
     4
41285
efd23c1d9886 renamed Bifinite.thy to Representable.thy
huffman
parents: 41034
diff changeset
     5
header {* Representable domains *}
25903
5e59af604d4f new theory of bifinite domains
huffman
parents:
diff changeset
     6
41285
efd23c1d9886 renamed Bifinite.thy to Representable.thy
huffman
parents: 41034
diff changeset
     7
theory Representable
40502
8e92772bc0e8 move map functions to new theory file Map_Functions; add theory file Plain_HOLCF
huffman
parents: 40497
diff changeset
     8
imports Algebraic Map_Functions Countable
25903
5e59af604d4f new theory of bifinite domains
huffman
parents:
diff changeset
     9
begin
5e59af604d4f new theory of bifinite domains
huffman
parents:
diff changeset
    10
41285
efd23c1d9886 renamed Bifinite.thy to Representable.thy
huffman
parents: 41034
diff changeset
    11
subsection {* Class of representable domains *}
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    12
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    13
text {*
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    14
  We define a ``domain'' as a pcpo that is isomorphic to some
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    15
  algebraic deflation over the universal domain; this is equivalent
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    16
  to being omega-bifinite.
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
    17
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    18
  A predomain is a cpo that, when lifted, becomes a domain.
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    19
*}
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    20
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
    21
class predomain = cpo +
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
    22
  fixes liftdefl :: "('a::cpo) itself \<Rightarrow> udom defl"
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
    23
  fixes liftemb :: "'a\<^sub>\<bottom> \<rightarrow> udom"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
    24
  fixes liftprj :: "udom \<rightarrow> 'a\<^sub>\<bottom>"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
    25
  assumes predomain_ep: "ep_pair liftemb liftprj"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
    26
  assumes cast_liftdefl: "cast\<cdot>(liftdefl TYPE('a::cpo)) = liftemb oo liftprj"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
    27
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
    28
syntax "_LIFTDEFL" :: "type \<Rightarrow> logic"  ("(1LIFTDEFL/(1'(_')))")
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
    29
translations "LIFTDEFL('t)" \<rightleftharpoons> "CONST liftdefl TYPE('t)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
    30
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    31
class "domain" = predomain + pcpo +
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
    32
  fixes emb :: "'a::cpo \<rightarrow> udom"
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
    33
  fixes prj :: "udom \<rightarrow> 'a::cpo"
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
    34
  fixes defl :: "'a itself \<Rightarrow> udom defl"
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    35
  assumes ep_pair_emb_prj: "ep_pair emb prj"
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
    36
  assumes cast_DEFL: "cast\<cdot>(defl TYPE('a)) = emb oo prj"
31113
15cf300a742f move bifinite instance for product type from Cprod.thy to Bifinite.thy
huffman
parents: 31076
diff changeset
    37
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
    38
syntax "_DEFL" :: "type \<Rightarrow> logic"  ("(1DEFL/(1'(_')))")
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
    39
translations "DEFL('t)" \<rightleftharpoons> "CONST defl TYPE('t)"
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    40
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    41
interpretation "domain": pcpo_ep_pair emb prj
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    42
  unfolding pcpo_ep_pair_def
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    43
  by (rule ep_pair_emb_prj)
33504
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
    44
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    45
lemmas emb_inverse = domain.e_inverse
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    46
lemmas emb_prj_below = domain.e_p_below
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    47
lemmas emb_eq_iff = domain.e_eq_iff
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    48
lemmas emb_strict = domain.e_strict
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
    49
lemmas prj_strict = domain.p_strict
33504
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
    50
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    51
subsection {* Domains are bifinite *}
33587
54f98d225163 add map_map lemmas
huffman
parents: 33504
diff changeset
    52
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    53
lemma approx_chain_ep_cast:
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
    54
  assumes ep: "ep_pair (e::'a::pcpo \<rightarrow> udom) (p::udom \<rightarrow> 'a)"
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    55
  assumes cast_t: "cast\<cdot>t = e oo p"
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
    56
  shows "\<exists>(a::nat \<Rightarrow> 'a::pcpo \<rightarrow> 'a). approx_chain a"
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    57
proof -
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    58
  interpret ep_pair e p by fact
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    59
  obtain Y where Y: "\<forall>i. Y i \<sqsubseteq> Y (Suc i)"
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    60
  and t: "t = (\<Squnion>i. defl_principal (Y i))"
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
    61
    by (rule defl.obtain_principal_chain)
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    62
  def approx \<equiv> "\<lambda>i. (p oo cast\<cdot>(defl_principal (Y i)) oo e) :: 'a \<rightarrow> 'a"
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    63
  have "approx_chain approx"
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    64
  proof (rule approx_chain.intro)
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    65
    show "chain (\<lambda>i. approx i)"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    66
      unfolding approx_def by (simp add: Y)
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    67
    show "(\<Squnion>i. approx i) = ID"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    68
      unfolding approx_def
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    69
      by (simp add: lub_distribs Y t [symmetric] cast_t cfun_eq_iff)
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    70
    show "\<And>i. finite_deflation (approx i)"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    71
      unfolding approx_def
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    72
      apply (rule finite_deflation_p_d_e)
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    73
      apply (rule finite_deflation_cast)
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
    74
      apply (rule defl.compact_principal)
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    75
      apply (rule below_trans [OF monofun_cfun_fun])
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    76
      apply (rule is_ub_thelub, simp add: Y)
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    77
      apply (simp add: lub_distribs Y t [symmetric] cast_t)
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    78
      done
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
    79
  qed
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    80
  thus "\<exists>(a::nat \<Rightarrow> 'a \<rightarrow> 'a). approx_chain a" by - (rule exI)
33504
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
    81
qed
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
    82
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    83
instance "domain" \<subseteq> bifinite
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    84
by default (rule approx_chain_ep_cast [OF ep_pair_emb_prj cast_DEFL])
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    85
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    86
instance predomain \<subseteq> profinite
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    87
by default (rule approx_chain_ep_cast [OF predomain_ep cast_liftdefl])
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
    88
40484
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
    89
subsection {* Chains of approx functions *}
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
    90
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
    91
definition u_approx :: "nat \<Rightarrow> udom\<^sub>\<bottom> \<rightarrow> udom\<^sub>\<bottom>"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
    92
  where "u_approx = (\<lambda>i. u_map\<cdot>(udom_approx i))"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
    93
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
    94
definition sfun_approx :: "nat \<Rightarrow> (udom \<rightarrow>! udom) \<rightarrow> (udom \<rightarrow>! udom)"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
    95
  where "sfun_approx = (\<lambda>i. sfun_map\<cdot>(udom_approx i)\<cdot>(udom_approx i))"
40484
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
    96
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
    97
definition prod_approx :: "nat \<Rightarrow> udom \<times> udom \<rightarrow> udom \<times> udom"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
    98
  where "prod_approx = (\<lambda>i. cprod_map\<cdot>(udom_approx i)\<cdot>(udom_approx i))"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
    99
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   100
definition sprod_approx :: "nat \<Rightarrow> udom \<otimes> udom \<rightarrow> udom \<otimes> udom"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   101
  where "sprod_approx = (\<lambda>i. sprod_map\<cdot>(udom_approx i)\<cdot>(udom_approx i))"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   102
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   103
definition ssum_approx :: "nat \<Rightarrow> udom \<oplus> udom \<rightarrow> udom \<oplus> udom"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   104
  where "ssum_approx = (\<lambda>i. ssum_map\<cdot>(udom_approx i)\<cdot>(udom_approx i))"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   105
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   106
lemma approx_chain_lemma1:
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   107
  assumes "m\<cdot>ID = ID"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   108
  assumes "\<And>d. finite_deflation d \<Longrightarrow> finite_deflation (m\<cdot>d)"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   109
  shows "approx_chain (\<lambda>i. m\<cdot>(udom_approx i))"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   110
by (rule approx_chain.intro)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   111
   (simp_all add: lub_distribs finite_deflation_udom_approx assms)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   112
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   113
lemma approx_chain_lemma2:
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   114
  assumes "m\<cdot>ID\<cdot>ID = ID"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   115
  assumes "\<And>a b. \<lbrakk>finite_deflation a; finite_deflation b\<rbrakk>
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   116
    \<Longrightarrow> finite_deflation (m\<cdot>a\<cdot>b)"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   117
  shows "approx_chain (\<lambda>i. m\<cdot>(udom_approx i)\<cdot>(udom_approx i))"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   118
by (rule approx_chain.intro)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   119
   (simp_all add: lub_distribs finite_deflation_udom_approx assms)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   120
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   121
lemma u_approx: "approx_chain u_approx"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   122
using u_map_ID finite_deflation_u_map
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   123
unfolding u_approx_def by (rule approx_chain_lemma1)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   124
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   125
lemma sfun_approx: "approx_chain sfun_approx"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   126
using sfun_map_ID finite_deflation_sfun_map
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   127
unfolding sfun_approx_def by (rule approx_chain_lemma2)
40484
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   128
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   129
lemma prod_approx: "approx_chain prod_approx"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   130
using cprod_map_ID finite_deflation_cprod_map
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   131
unfolding prod_approx_def by (rule approx_chain_lemma2)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   132
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   133
lemma sprod_approx: "approx_chain sprod_approx"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   134
using sprod_map_ID finite_deflation_sprod_map
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   135
unfolding sprod_approx_def by (rule approx_chain_lemma2)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   136
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   137
lemma ssum_approx: "approx_chain ssum_approx"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   138
using ssum_map_ID finite_deflation_ssum_map
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   139
unfolding ssum_approx_def by (rule approx_chain_lemma2)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   140
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   141
subsection {* Type combinators *}
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   142
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
   143
default_sort bifinite
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
   144
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   145
definition
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   146
  defl_fun1 ::
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   147
    "(nat \<Rightarrow> 'a \<rightarrow> 'a) \<Rightarrow> ((udom \<rightarrow> udom) \<rightarrow> ('a \<rightarrow> 'a)) \<Rightarrow> (udom defl \<rightarrow> udom defl)"
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   148
where
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   149
  "defl_fun1 approx f =
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   150
    defl.basis_fun (\<lambda>a.
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   151
      defl_principal (Abs_fin_defl
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   152
        (udom_emb approx oo f\<cdot>(Rep_fin_defl a) oo udom_prj approx)))"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   153
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   154
definition
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   155
  defl_fun2 ::
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   156
    "(nat \<Rightarrow> 'a \<rightarrow> 'a) \<Rightarrow> ((udom \<rightarrow> udom) \<rightarrow> (udom \<rightarrow> udom) \<rightarrow> ('a \<rightarrow> 'a))
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   157
      \<Rightarrow> (udom defl \<rightarrow> udom defl \<rightarrow> udom defl)"
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   158
where
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   159
  "defl_fun2 approx f =
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   160
    defl.basis_fun (\<lambda>a.
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   161
      defl.basis_fun (\<lambda>b.
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   162
        defl_principal (Abs_fin_defl
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   163
          (udom_emb approx oo
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   164
            f\<cdot>(Rep_fin_defl a)\<cdot>(Rep_fin_defl b) oo udom_prj approx))))"
33504
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
   165
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   166
lemma cast_defl_fun1:
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   167
  assumes approx: "approx_chain approx"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   168
  assumes f: "\<And>a. finite_deflation a \<Longrightarrow> finite_deflation (f\<cdot>a)"
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   169
  shows "cast\<cdot>(defl_fun1 approx f\<cdot>A) = udom_emb approx oo f\<cdot>(cast\<cdot>A) oo udom_prj approx"
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   170
proof -
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   171
  have 1: "\<And>a. finite_deflation
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   172
        (udom_emb approx oo f\<cdot>(Rep_fin_defl a) oo udom_prj approx)"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   173
    apply (rule ep_pair.finite_deflation_e_d_p)
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
   174
    apply (rule ep_pair_udom [OF approx])
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   175
    apply (rule f, rule finite_deflation_Rep_fin_defl)
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   176
    done
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   177
  show ?thesis
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   178
    by (induct A rule: defl.principal_induct, simp)
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   179
       (simp only: defl_fun1_def
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   180
                   defl.basis_fun_principal
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   181
                   defl.basis_fun_mono
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   182
                   defl.principal_mono
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   183
                   Abs_fin_defl_mono [OF 1 1]
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   184
                   monofun_cfun below_refl
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   185
                   Rep_fin_defl_mono
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   186
                   cast_defl_principal
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   187
                   Abs_fin_defl_inverse [unfolded mem_Collect_eq, OF 1])
33504
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
   188
qed
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
   189
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   190
lemma cast_defl_fun2:
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   191
  assumes approx: "approx_chain approx"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   192
  assumes f: "\<And>a b. finite_deflation a \<Longrightarrow> finite_deflation b \<Longrightarrow>
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   193
                finite_deflation (f\<cdot>a\<cdot>b)"
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   194
  shows "cast\<cdot>(defl_fun2 approx f\<cdot>A\<cdot>B) =
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   195
    udom_emb approx oo f\<cdot>(cast\<cdot>A)\<cdot>(cast\<cdot>B) oo udom_prj approx"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   196
proof -
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   197
  have 1: "\<And>a b. finite_deflation (udom_emb approx oo
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   198
      f\<cdot>(Rep_fin_defl a)\<cdot>(Rep_fin_defl b) oo udom_prj approx)"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   199
    apply (rule ep_pair.finite_deflation_e_d_p)
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   200
    apply (rule ep_pair_udom [OF approx])
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   201
    apply (rule f, (rule finite_deflation_Rep_fin_defl)+)
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   202
    done
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   203
  show ?thesis
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   204
    by (induct A B rule: defl.principal_induct2, simp, simp)
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   205
       (simp only: defl_fun2_def
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   206
                   defl.basis_fun_principal
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   207
                   defl.basis_fun_mono
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   208
                   defl.principal_mono
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   209
                   Abs_fin_defl_mono [OF 1 1]
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   210
                   monofun_cfun below_refl
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   211
                   Rep_fin_defl_mono
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   212
                   cast_defl_principal
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   213
                   Abs_fin_defl_inverse [unfolded mem_Collect_eq, OF 1])
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   214
qed
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   215
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   216
definition u_defl :: "udom defl \<rightarrow> udom defl"
40484
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   217
  where "u_defl = defl_fun1 u_approx u_map"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   218
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   219
definition sfun_defl :: "udom defl \<rightarrow> udom defl \<rightarrow> udom defl"
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   220
  where "sfun_defl = defl_fun2 sfun_approx sfun_map"
40484
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   221
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   222
definition prod_defl :: "udom defl \<rightarrow> udom defl \<rightarrow> udom defl"
40484
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   223
  where "prod_defl = defl_fun2 prod_approx cprod_map"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   224
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   225
definition sprod_defl :: "udom defl \<rightarrow> udom defl \<rightarrow> udom defl"
40484
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   226
  where "sprod_defl = defl_fun2 sprod_approx sprod_map"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   227
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   228
definition ssum_defl :: "udom defl \<rightarrow> udom defl \<rightarrow> udom defl"
40484
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   229
where "ssum_defl = defl_fun2 ssum_approx ssum_map"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   230
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   231
lemma cast_u_defl:
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   232
  "cast\<cdot>(u_defl\<cdot>A) =
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   233
    udom_emb u_approx oo u_map\<cdot>(cast\<cdot>A) oo udom_prj u_approx"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   234
using u_approx finite_deflation_u_map
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   235
unfolding u_defl_def by (rule cast_defl_fun1)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   236
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   237
lemma cast_sfun_defl:
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   238
  "cast\<cdot>(sfun_defl\<cdot>A\<cdot>B) =
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   239
    udom_emb sfun_approx oo sfun_map\<cdot>(cast\<cdot>A)\<cdot>(cast\<cdot>B) oo udom_prj sfun_approx"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   240
using sfun_approx finite_deflation_sfun_map
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   241
unfolding sfun_defl_def by (rule cast_defl_fun2)
40484
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   242
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   243
lemma cast_prod_defl:
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   244
  "cast\<cdot>(prod_defl\<cdot>A\<cdot>B) = udom_emb prod_approx oo
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   245
    cprod_map\<cdot>(cast\<cdot>A)\<cdot>(cast\<cdot>B) oo udom_prj prod_approx"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   246
using prod_approx finite_deflation_cprod_map
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   247
unfolding prod_defl_def by (rule cast_defl_fun2)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   248
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   249
lemma cast_sprod_defl:
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   250
  "cast\<cdot>(sprod_defl\<cdot>A\<cdot>B) =
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   251
    udom_emb sprod_approx oo
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   252
      sprod_map\<cdot>(cast\<cdot>A)\<cdot>(cast\<cdot>B) oo
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   253
        udom_prj sprod_approx"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   254
using sprod_approx finite_deflation_sprod_map
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   255
unfolding sprod_defl_def by (rule cast_defl_fun2)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   256
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   257
lemma cast_ssum_defl:
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   258
  "cast\<cdot>(ssum_defl\<cdot>A\<cdot>B) =
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   259
    udom_emb ssum_approx oo ssum_map\<cdot>(cast\<cdot>A)\<cdot>(cast\<cdot>B) oo udom_prj ssum_approx"
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   260
using ssum_approx finite_deflation_ssum_map
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   261
unfolding ssum_defl_def by (rule cast_defl_fun2)
768f7e264e2b reorganize Bifinite.thy; simplify some proofs related to bifinite class instances
huffman
parents: 40086
diff changeset
   262
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
   263
subsection {* Lemma for proving domain instances *}
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   264
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   265
text {*
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
   266
  A class of domains where @{const liftemb}, @{const liftprj},
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   267
  and @{const liftdefl} are all defined in the standard way.
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   268
*}
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   269
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
   270
class liftdomain = "domain" +
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   271
  assumes liftemb_eq: "liftemb = udom_emb u_approx oo u_map\<cdot>emb"
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   272
  assumes liftprj_eq: "liftprj = u_map\<cdot>prj oo udom_prj u_approx"
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   273
  assumes liftdefl_eq: "liftdefl TYPE('a::cpo) = u_defl\<cdot>DEFL('a)"
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   274
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   275
text {* Temporarily relax type constraints. *}
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   276
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   277
setup {*
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   278
  fold Sign.add_const_constraint
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   279
  [ (@{const_name defl}, SOME @{typ "'a::pcpo itself \<Rightarrow> udom defl"})
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   280
  , (@{const_name emb}, SOME @{typ "'a::pcpo \<rightarrow> udom"})
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   281
  , (@{const_name prj}, SOME @{typ "udom \<rightarrow> 'a::pcpo"})
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   282
  , (@{const_name liftdefl}, SOME @{typ "'a::pcpo itself \<Rightarrow> udom defl"})
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   283
  , (@{const_name liftemb}, SOME @{typ "'a::pcpo u \<rightarrow> udom"})
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   284
  , (@{const_name liftprj}, SOME @{typ "udom \<rightarrow> 'a::pcpo u"}) ]
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   285
*}
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   286
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
   287
default_sort pcpo
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
   288
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   289
lemma liftdomain_class_intro:
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   290
  assumes liftemb: "(liftemb :: 'a u \<rightarrow> udom) = udom_emb u_approx oo u_map\<cdot>emb"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   291
  assumes liftprj: "(liftprj :: udom \<rightarrow> 'a u) = u_map\<cdot>prj oo udom_prj u_approx"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   292
  assumes liftdefl: "liftdefl TYPE('a) = u_defl\<cdot>DEFL('a)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   293
  assumes ep_pair: "ep_pair emb (prj :: udom \<rightarrow> 'a)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   294
  assumes cast_defl: "cast\<cdot>DEFL('a) = emb oo (prj :: udom \<rightarrow> 'a)"
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   295
  shows "OFCLASS('a, liftdomain_class)"
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   296
proof
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   297
  show "ep_pair liftemb (liftprj :: udom \<rightarrow> 'a u)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   298
    unfolding liftemb liftprj
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   299
    by (intro ep_pair_comp ep_pair_u_map ep_pair ep_pair_udom u_approx)
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   300
  show "cast\<cdot>LIFTDEFL('a) = liftemb oo (liftprj :: udom \<rightarrow> 'a u)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   301
    unfolding liftemb liftprj liftdefl
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   302
    by (simp add: cfcomp1 cast_u_defl cast_defl u_map_map)
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   303
next
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   304
qed fact+
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   305
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   306
text {* Restore original type constraints. *}
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   307
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   308
setup {*
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   309
  fold Sign.add_const_constraint
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   310
  [ (@{const_name defl}, SOME @{typ "'a::domain itself \<Rightarrow> udom defl"})
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
   311
  , (@{const_name emb}, SOME @{typ "'a::domain \<rightarrow> udom"})
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
   312
  , (@{const_name prj}, SOME @{typ "udom \<rightarrow> 'a::domain"})
41287
029a6fc1bfb8 type 'defl' takes a type parameter again (cf. b525988432e9)
huffman
parents: 41286
diff changeset
   313
  , (@{const_name liftdefl}, SOME @{typ "'a::predomain itself \<Rightarrow> udom defl"})
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   314
  , (@{const_name liftemb}, SOME @{typ "'a::predomain u \<rightarrow> udom"})
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   315
  , (@{const_name liftprj}, SOME @{typ "udom \<rightarrow> 'a::predomain u"}) ]
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   316
*}
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   317
40506
4c5363173f88 section headings
huffman
parents: 40502
diff changeset
   318
subsection {* Class instance proofs *}
4c5363173f88 section headings
huffman
parents: 40502
diff changeset
   319
4c5363173f88 section headings
huffman
parents: 40502
diff changeset
   320
subsubsection {* Universal domain *}
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   321
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   322
instantiation udom :: liftdomain
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   323
begin
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   324
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   325
definition [simp]:
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   326
  "emb = (ID :: udom \<rightarrow> udom)"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   327
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   328
definition [simp]:
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   329
  "prj = (ID :: udom \<rightarrow> udom)"
25903
5e59af604d4f new theory of bifinite domains
huffman
parents:
diff changeset
   330
33504
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
   331
definition
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   332
  "defl (t::udom itself) = (\<Squnion>i. defl_principal (Abs_fin_defl (udom_approx i)))"
33808
31169fdc5ae7 add map_ID lemmas
huffman
parents: 33587
diff changeset
   333
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   334
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   335
  "(liftemb :: udom u \<rightarrow> udom) = udom_emb u_approx oo u_map\<cdot>emb"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   336
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   337
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   338
  "(liftprj :: udom \<rightarrow> udom u) = u_map\<cdot>prj oo udom_prj u_approx"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   339
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   340
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   341
  "liftdefl (t::udom itself) = u_defl\<cdot>DEFL(udom)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   342
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   343
instance
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   344
using liftemb_udom_def liftprj_udom_def liftdefl_udom_def
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   345
proof (rule liftdomain_class_intro)
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   346
  show "ep_pair emb (prj :: udom \<rightarrow> udom)"
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   347
    by (simp add: ep_pair.intro)
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   348
  show "cast\<cdot>DEFL(udom) = emb oo (prj :: udom \<rightarrow> udom)"
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   349
    unfolding defl_udom_def
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   350
    apply (subst contlub_cfun_arg)
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   351
    apply (rule chainI)
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   352
    apply (rule defl.principal_mono)
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   353
    apply (simp add: below_fin_defl_def)
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   354
    apply (simp add: Abs_fin_defl_inverse finite_deflation_udom_approx)
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   355
    apply (rule chainE)
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   356
    apply (rule chain_udom_approx)
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   357
    apply (subst cast_defl_principal)
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   358
    apply (simp add: Abs_fin_defl_inverse finite_deflation_udom_approx)
33504
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
   359
    done
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
   360
qed
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
   361
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   362
end
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   363
40506
4c5363173f88 section headings
huffman
parents: 40502
diff changeset
   364
subsubsection {* Lifted cpo *}
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   365
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   366
instantiation u :: (predomain) liftdomain
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   367
begin
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   368
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   369
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   370
  "emb = liftemb"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   371
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   372
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   373
  "prj = liftprj"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   374
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   375
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   376
  "defl (t::'a u itself) = LIFTDEFL('a)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   377
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   378
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   379
  "(liftemb :: 'a u u \<rightarrow> udom) = udom_emb u_approx oo u_map\<cdot>emb"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   380
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   381
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   382
  "(liftprj :: udom \<rightarrow> 'a u u) = u_map\<cdot>prj oo udom_prj u_approx"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   383
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   384
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   385
  "liftdefl (t::'a u itself) = u_defl\<cdot>DEFL('a u)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   386
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   387
instance
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   388
using liftemb_u_def liftprj_u_def liftdefl_u_def
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   389
proof (rule liftdomain_class_intro)
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   390
  show "ep_pair emb (prj :: udom \<rightarrow> 'a u)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   391
    unfolding emb_u_def prj_u_def
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   392
    by (rule predomain_ep)
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   393
  show "cast\<cdot>DEFL('a u) = emb oo (prj :: udom \<rightarrow> 'a u)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   394
    unfolding emb_u_def prj_u_def defl_u_def
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   395
    by (rule cast_liftdefl)
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   396
qed
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   397
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   398
end
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   399
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   400
lemma DEFL_u: "DEFL('a::predomain u) = LIFTDEFL('a)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   401
by (rule defl_u_def)
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   402
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   403
subsubsection {* Strict function space *}
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   404
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   405
instantiation sfun :: ("domain", "domain") liftdomain
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   406
begin
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   407
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   408
definition
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   409
  "emb = udom_emb sfun_approx oo sfun_map\<cdot>prj\<cdot>emb"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   410
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   411
definition
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   412
  "prj = sfun_map\<cdot>emb\<cdot>prj oo udom_prj sfun_approx"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   413
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   414
definition
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   415
  "defl (t::('a \<rightarrow>! 'b) itself) = sfun_defl\<cdot>DEFL('a)\<cdot>DEFL('b)"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   416
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   417
definition
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   418
  "(liftemb :: ('a \<rightarrow>! 'b) u \<rightarrow> udom) = udom_emb u_approx oo u_map\<cdot>emb"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   419
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   420
definition
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   421
  "(liftprj :: udom \<rightarrow> ('a \<rightarrow>! 'b) u) = u_map\<cdot>prj oo udom_prj u_approx"
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   422
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   423
definition
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   424
  "liftdefl (t::('a \<rightarrow>! 'b) itself) = u_defl\<cdot>DEFL('a \<rightarrow>! 'b)"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   425
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   426
instance
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   427
using liftemb_sfun_def liftprj_sfun_def liftdefl_sfun_def
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   428
proof (rule liftdomain_class_intro)
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   429
  show "ep_pair emb (prj :: udom \<rightarrow> 'a \<rightarrow>! 'b)"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   430
    unfolding emb_sfun_def prj_sfun_def
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   431
    using ep_pair_udom [OF sfun_approx]
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   432
    by (intro ep_pair_comp ep_pair_sfun_map ep_pair_emb_prj)
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   433
  show "cast\<cdot>DEFL('a \<rightarrow>! 'b) = emb oo (prj :: udom \<rightarrow> 'a \<rightarrow>! 'b)"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   434
    unfolding emb_sfun_def prj_sfun_def defl_sfun_def cast_sfun_defl
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   435
    by (simp add: cast_DEFL oo_def sfun_eq_iff sfun_map_map)
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   436
qed
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   437
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   438
end
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   439
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   440
lemma DEFL_sfun:
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   441
  "DEFL('a::domain \<rightarrow>! 'b::domain) = sfun_defl\<cdot>DEFL('a)\<cdot>DEFL('b)"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   442
by (rule defl_sfun_def)
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   443
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   444
subsubsection {* Continuous function space *}
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   445
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   446
instantiation cfun :: (predomain, "domain") liftdomain
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   447
begin
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   448
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   449
definition
40830
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   450
  "emb = emb oo encode_cfun"
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   451
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   452
definition
40830
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   453
  "prj = decode_cfun oo prj"
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   454
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   455
definition
40830
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   456
  "defl (t::('a \<rightarrow> 'b) itself) = DEFL('a u \<rightarrow>! 'b)"
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   457
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   458
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   459
  "(liftemb :: ('a \<rightarrow> 'b) u \<rightarrow> udom) = udom_emb u_approx oo u_map\<cdot>emb"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   460
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   461
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   462
  "(liftprj :: udom \<rightarrow> ('a \<rightarrow> 'b) u) = u_map\<cdot>prj oo udom_prj u_approx"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   463
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   464
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   465
  "liftdefl (t::('a \<rightarrow> 'b) itself) = u_defl\<cdot>DEFL('a \<rightarrow> 'b)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   466
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   467
instance
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   468
using liftemb_cfun_def liftprj_cfun_def liftdefl_cfun_def
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   469
proof (rule liftdomain_class_intro)
40592
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   470
  have "ep_pair encode_cfun decode_cfun"
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   471
    by (rule ep_pair.intro, simp_all)
f432973ce0f6 move strict function type into main HOLCF; instance cfun :: (predomain, domain) domain
huffman
parents: 40506
diff changeset
   472
  thus "ep_pair emb (prj :: udom \<rightarrow> 'a \<rightarrow> 'b)"
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   473
    unfolding emb_cfun_def prj_cfun_def
40830
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   474
    using ep_pair_emb_prj by (rule ep_pair_comp)
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   475
  show "cast\<cdot>DEFL('a \<rightarrow> 'b) = emb oo (prj :: udom \<rightarrow> 'a \<rightarrow> 'b)"
40830
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   476
    unfolding emb_cfun_def prj_cfun_def defl_cfun_def
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   477
    by (simp add: cast_DEFL cfcomp1)
27402
253a06dfadce reuse proofs from Deflation.thy; clean up proof of finite_range_cfun_lemma
huffman
parents: 27310
diff changeset
   478
qed
25903
5e59af604d4f new theory of bifinite domains
huffman
parents:
diff changeset
   479
39985
310f98585107 move stuff from Algebraic.thy to Bifinite.thy and elsewhere
huffman
parents: 39974
diff changeset
   480
end
33504
b4210cc3ac97 map functions for various types, with ep_pair/deflation/finite_deflation lemmas
huffman
parents: 31113
diff changeset
   481
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   482
lemma DEFL_cfun:
40830
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   483
  "DEFL('a::predomain \<rightarrow> 'b::domain) = DEFL('a u \<rightarrow>! 'b)"
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   484
by (rule defl_cfun_def)
39972
4244ff4f9649 add lemmas finite_deflation_imp_compact, cast_below_cast_iff
Brian Huffman <brianh@cs.pdx.edu>
parents: 37678
diff changeset
   485
40506
4c5363173f88 section headings
huffman
parents: 40502
diff changeset
   486
subsubsection {* Strict product *}
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   487
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
   488
instantiation sprod :: ("domain", "domain") liftdomain
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   489
begin
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   490
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   491
definition
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   492
  "emb = udom_emb sprod_approx oo sprod_map\<cdot>emb\<cdot>emb"
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   493
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   494
definition
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   495
  "prj = sprod_map\<cdot>prj\<cdot>prj oo udom_prj sprod_approx"
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   496
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   497
definition
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   498
  "defl (t::('a \<otimes> 'b) itself) = sprod_defl\<cdot>DEFL('a)\<cdot>DEFL('b)"
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   499
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   500
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   501
  "(liftemb :: ('a \<otimes> 'b) u \<rightarrow> udom) = udom_emb u_approx oo u_map\<cdot>emb"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   502
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   503
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   504
  "(liftprj :: udom \<rightarrow> ('a \<otimes> 'b) u) = u_map\<cdot>prj oo udom_prj u_approx"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   505
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   506
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   507
  "liftdefl (t::('a \<otimes> 'b) itself) = u_defl\<cdot>DEFL('a \<otimes> 'b)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   508
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   509
instance
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   510
using liftemb_sprod_def liftprj_sprod_def liftdefl_sprod_def
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   511
proof (rule liftdomain_class_intro)
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   512
  show "ep_pair emb (prj :: udom \<rightarrow> 'a \<otimes> 'b)"
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   513
    unfolding emb_sprod_def prj_sprod_def
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   514
    using ep_pair_udom [OF sprod_approx]
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   515
    by (intro ep_pair_comp ep_pair_sprod_map ep_pair_emb_prj)
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   516
next
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   517
  show "cast\<cdot>DEFL('a \<otimes> 'b) = emb oo (prj :: udom \<rightarrow> 'a \<otimes> 'b)"
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   518
    unfolding emb_sprod_def prj_sprod_def defl_sprod_def cast_sprod_defl
40002
c5b5f7a3a3b1 new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
huffman
parents: 39989
diff changeset
   519
    by (simp add: cast_DEFL oo_def cfun_eq_iff sprod_map_map)
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   520
qed
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   521
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   522
end
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   523
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   524
lemma DEFL_sprod:
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
   525
  "DEFL('a::domain \<otimes> 'b::domain) = sprod_defl\<cdot>DEFL('a)\<cdot>DEFL('b)"
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   526
by (rule defl_sprod_def)
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   527
40830
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   528
subsubsection {* Cartesian product *}
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   529
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   530
instantiation prod :: (predomain, predomain) predomain
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   531
begin
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   532
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   533
definition
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   534
  "liftemb = emb oo encode_prod_u"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   535
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   536
definition
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   537
  "liftprj = decode_prod_u oo prj"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   538
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   539
definition
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   540
  "liftdefl (t::('a \<times> 'b) itself) = DEFL('a\<^sub>\<bottom> \<otimes> 'b\<^sub>\<bottom>)"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   541
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   542
instance proof
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   543
  have "ep_pair encode_prod_u decode_prod_u"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   544
    by (rule ep_pair.intro, simp_all)
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   545
  thus "ep_pair liftemb (liftprj :: udom \<rightarrow> ('a \<times> 'b) u)"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   546
    unfolding liftemb_prod_def liftprj_prod_def
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   547
    using ep_pair_emb_prj by (rule ep_pair_comp)
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   548
  show "cast\<cdot>LIFTDEFL('a \<times> 'b) = liftemb oo (liftprj :: udom \<rightarrow> ('a \<times> 'b) u)"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   549
    unfolding liftemb_prod_def liftprj_prod_def liftdefl_prod_def
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   550
    by (simp add: cast_DEFL cfcomp1)
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   551
qed
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   552
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   553
end
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   554
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   555
instantiation prod :: ("domain", "domain") "domain"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   556
begin
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   557
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   558
definition
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   559
  "emb = udom_emb prod_approx oo cprod_map\<cdot>emb\<cdot>emb"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   560
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   561
definition
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   562
  "prj = cprod_map\<cdot>prj\<cdot>prj oo udom_prj prod_approx"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   563
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   564
definition
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   565
  "defl (t::('a \<times> 'b) itself) = prod_defl\<cdot>DEFL('a)\<cdot>DEFL('b)"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   566
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   567
instance proof
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   568
  show "ep_pair emb (prj :: udom \<rightarrow> 'a \<times> 'b)"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   569
    unfolding emb_prod_def prj_prod_def
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   570
    using ep_pair_udom [OF prod_approx]
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   571
    by (intro ep_pair_comp ep_pair_cprod_map ep_pair_emb_prj)
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   572
next
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   573
  show "cast\<cdot>DEFL('a \<times> 'b) = emb oo (prj :: udom \<rightarrow> 'a \<times> 'b)"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   574
    unfolding emb_prod_def prj_prod_def defl_prod_def cast_prod_defl
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   575
    by (simp add: cast_DEFL oo_def cfun_eq_iff cprod_map_map)
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   576
qed
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   577
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   578
end
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   579
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   580
lemma DEFL_prod:
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   581
  "DEFL('a::domain \<times> 'b::domain) = prod_defl\<cdot>DEFL('a)\<cdot>DEFL('b)"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   582
by (rule defl_prod_def)
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   583
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   584
lemma LIFTDEFL_prod:
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   585
  "LIFTDEFL('a::predomain \<times> 'b::predomain) = DEFL('a u \<otimes> 'b u)"
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   586
by (rule liftdefl_prod_def)
158d18502378 simplify predomain instances
huffman
parents: 40774
diff changeset
   587
41034
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   588
subsubsection {* Unit type *}
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   589
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   590
instantiation unit :: liftdomain
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   591
begin
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   592
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   593
definition
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   594
  "emb = (\<bottom> :: unit \<rightarrow> udom)"
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   595
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   596
definition
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   597
  "prj = (\<bottom> :: udom \<rightarrow> unit)"
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   598
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   599
definition
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   600
  "defl (t::unit itself) = \<bottom>"
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   601
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   602
definition
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   603
  "(liftemb :: unit u \<rightarrow> udom) = udom_emb u_approx oo u_map\<cdot>emb"
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   604
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   605
definition
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   606
  "(liftprj :: udom \<rightarrow> unit u) = u_map\<cdot>prj oo udom_prj u_approx"
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   607
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   608
definition
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   609
  "liftdefl (t::unit itself) = u_defl\<cdot>DEFL(unit)"
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   610
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   611
instance
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   612
using liftemb_unit_def liftprj_unit_def liftdefl_unit_def
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   613
proof (rule liftdomain_class_intro)
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   614
  show "ep_pair emb (prj :: udom \<rightarrow> unit)"
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   615
    unfolding emb_unit_def prj_unit_def
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   616
    by (simp add: ep_pair.intro)
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   617
next
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   618
  show "cast\<cdot>DEFL(unit) = emb oo (prj :: udom \<rightarrow> unit)"
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   619
    unfolding emb_unit_def prj_unit_def defl_unit_def by simp
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   620
qed
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   621
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   622
end
ce5d9e73fb98 instance unit :: domain
huffman
parents: 40830
diff changeset
   623
40506
4c5363173f88 section headings
huffman
parents: 40502
diff changeset
   624
subsubsection {* Discrete cpo *}
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   625
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   626
instantiation discr :: (countable) predomain
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   627
begin
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   628
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   629
definition
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
   630
  "(liftemb :: 'a discr u \<rightarrow> udom) = udom_emb discr_approx"
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   631
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   632
definition
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
   633
  "(liftprj :: udom \<rightarrow> 'a discr u) = udom_prj discr_approx"
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   634
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   635
definition
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   636
  "liftdefl (t::'a discr itself) =
41286
3d7685a4a5ff reintroduce 'bifinite' class, now with existentially-quantified approx function (cf. b525988432e9)
huffman
parents: 41285
diff changeset
   637
    (\<Squnion>i. defl_principal (Abs_fin_defl (liftemb oo discr_approx i oo (liftprj::udom \<rightarrow> 'a discr u))))"
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   638
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   639
instance proof
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   640
  show "ep_pair liftemb (liftprj :: udom \<rightarrow> 'a discr u)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   641
    unfolding liftemb_discr_def liftprj_discr_def
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   642
    by (rule ep_pair_udom [OF discr_approx])
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   643
  show "cast\<cdot>LIFTDEFL('a discr) = liftemb oo (liftprj :: udom \<rightarrow> 'a discr u)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   644
    unfolding liftemb_discr_def liftprj_discr_def liftdefl_discr_def
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   645
    apply (subst contlub_cfun_arg)
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   646
    apply (rule chainI)
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   647
    apply (rule defl.principal_mono)
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   648
    apply (simp add: below_fin_defl_def)
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   649
    apply (simp add: Abs_fin_defl_inverse
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   650
        ep_pair.finite_deflation_e_d_p [OF ep_pair_udom [OF discr_approx]]
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   651
        approx_chain.finite_deflation_approx [OF discr_approx])
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   652
    apply (intro monofun_cfun below_refl)
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   653
    apply (rule chainE)
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   654
    apply (rule chain_discr_approx)
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   655
    apply (subst cast_defl_principal)
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   656
    apply (simp add: Abs_fin_defl_inverse
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   657
        ep_pair.finite_deflation_e_d_p [OF ep_pair_udom [OF discr_approx]]
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   658
        approx_chain.finite_deflation_approx [OF discr_approx])
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   659
    apply (simp add: lub_distribs)
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   660
    done
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   661
qed
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   662
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   663
end
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   664
40506
4c5363173f88 section headings
huffman
parents: 40502
diff changeset
   665
subsubsection {* Strict sum *}
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   666
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
   667
instantiation ssum :: ("domain", "domain") liftdomain
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   668
begin
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   669
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   670
definition
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   671
  "emb = udom_emb ssum_approx oo ssum_map\<cdot>emb\<cdot>emb"
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   672
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   673
definition
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   674
  "prj = ssum_map\<cdot>prj\<cdot>prj oo udom_prj ssum_approx"
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   675
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   676
definition
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   677
  "defl (t::('a \<oplus> 'b) itself) = ssum_defl\<cdot>DEFL('a)\<cdot>DEFL('b)"
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   678
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   679
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   680
  "(liftemb :: ('a \<oplus> 'b) u \<rightarrow> udom) = udom_emb u_approx oo u_map\<cdot>emb"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   681
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   682
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   683
  "(liftprj :: udom \<rightarrow> ('a \<oplus> 'b) u) = u_map\<cdot>prj oo udom_prj u_approx"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   684
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   685
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   686
  "liftdefl (t::('a \<oplus> 'b) itself) = u_defl\<cdot>DEFL('a \<oplus> 'b)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   687
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   688
instance
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   689
using liftemb_ssum_def liftprj_ssum_def liftdefl_ssum_def
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   690
proof (rule liftdomain_class_intro)
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   691
  show "ep_pair emb (prj :: udom \<rightarrow> 'a \<oplus> 'b)"
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   692
    unfolding emb_ssum_def prj_ssum_def
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   693
    using ep_pair_udom [OF ssum_approx]
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   694
    by (intro ep_pair_comp ep_pair_ssum_map ep_pair_emb_prj)
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   695
  show "cast\<cdot>DEFL('a \<oplus> 'b) = emb oo (prj :: udom \<rightarrow> 'a \<oplus> 'b)"
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   696
    unfolding emb_ssum_def prj_ssum_def defl_ssum_def cast_ssum_defl
40002
c5b5f7a3a3b1 new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
huffman
parents: 39989
diff changeset
   697
    by (simp add: cast_DEFL oo_def cfun_eq_iff ssum_map_map)
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   698
qed
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   699
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   700
end
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   701
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   702
lemma DEFL_ssum:
40497
d2e876d6da8c rename class 'bifinite' to 'domain'
huffman
parents: 40494
diff changeset
   703
  "DEFL('a::domain \<oplus> 'b::domain) = ssum_defl\<cdot>DEFL('a)\<cdot>DEFL('b)"
39989
ad60d7311f43 renamed type and constant 'sfp' to 'defl'; replaced syntax SFP('a) with DEFL('a)
huffman
parents: 39987
diff changeset
   704
by (rule defl_ssum_def)
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   705
40506
4c5363173f88 section headings
huffman
parents: 40502
diff changeset
   706
subsubsection {* Lifted HOL type *}
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   707
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   708
instantiation lift :: (countable) liftdomain
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   709
begin
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   710
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   711
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   712
  "emb = emb oo (\<Lambda> x. Rep_lift x)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   713
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   714
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   715
  "prj = (\<Lambda> y. Abs_lift y) oo prj"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   716
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   717
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   718
  "defl (t::'a lift itself) = DEFL('a discr u)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   719
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   720
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   721
  "(liftemb :: 'a lift u \<rightarrow> udom) = udom_emb u_approx oo u_map\<cdot>emb"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   722
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   723
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   724
  "(liftprj :: udom \<rightarrow> 'a lift u) = u_map\<cdot>prj oo udom_prj u_approx"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   725
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   726
definition
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   727
  "liftdefl (t::'a lift itself) = u_defl\<cdot>DEFL('a lift)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   728
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   729
instance
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   730
using liftemb_lift_def liftprj_lift_def liftdefl_lift_def
40494
db8a09daba7b add class liftdomain, for bifinite domains where DEFL('a u) = u_defl('a)
huffman
parents: 40493
diff changeset
   731
proof (rule liftdomain_class_intro)
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   732
  note [simp] = cont_Rep_lift cont_Abs_lift Rep_lift_inverse Abs_lift_inverse
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   733
  have "ep_pair (\<Lambda>(x::'a lift). Rep_lift x) (\<Lambda> y. Abs_lift y)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   734
    by (simp add: ep_pair_def)
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   735
  thus "ep_pair emb (prj :: udom \<rightarrow> 'a lift)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   736
    unfolding emb_lift_def prj_lift_def
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   737
    using ep_pair_emb_prj by (rule ep_pair_comp)
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   738
  show "cast\<cdot>DEFL('a lift) = emb oo (prj :: udom \<rightarrow> 'a lift)"
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   739
    unfolding emb_lift_def prj_lift_def defl_lift_def cast_DEFL
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   740
    by (simp add: cfcomp1)
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   741
qed
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   742
39987
8c2f449af35a move all bifinite class instances to Bifinite.thy
huffman
parents: 39986
diff changeset
   743
end
40491
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   744
6de5839e2fb3 add 'predomain' class: unpointed version of bifinite
huffman
parents: 40484
diff changeset
   745
end