src/HOL/BNF_Composition.thy
author traytel
Tue, 16 Feb 2016 22:28:19 +0100
changeset 62324 ae44f16dcea5
parent 61032 b57df8eecad6
child 62777 596baa1a3251
permissions -rw-r--r--
make predicator a first-class bnf citizen
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
     1
(*  Title:      HOL/BNF_Composition.thy
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     2
    Author:     Dmitriy Traytel, TU Muenchen
57698
afef6616cbae header tuning
blanchet
parents: 56166
diff changeset
     3
    Author:     Jasmin Blanchette, TU Muenchen
afef6616cbae header tuning
blanchet
parents: 56166
diff changeset
     4
    Copyright   2012, 2013, 2014
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     5
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     6
Composition of bounded natural functors.
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     7
*)
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
     8
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
     9
section \<open>Composition of Bounded Natural Functors\<close>
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    10
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    11
theory BNF_Composition
55936
f6591f8c629d rationalized imports
traytel
parents: 55935
diff changeset
    12
imports BNF_Def
60918
4ceef1592e8c new command for lifting BNF structure over typedefs
traytel
parents: 60758
diff changeset
    13
keywords
4ceef1592e8c new command for lifting BNF structure over typedefs
traytel
parents: 60758
diff changeset
    14
  "copy_bnf" :: thy_decl and
4ceef1592e8c new command for lifting BNF structure over typedefs
traytel
parents: 60758
diff changeset
    15
  "lift_bnf" :: thy_goal
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    16
begin
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
    17
60918
4ceef1592e8c new command for lifting BNF structure over typedefs
traytel
parents: 60758
diff changeset
    18
lemma ssubst_mem: "\<lbrakk>t = s; s \<in> X\<rbrakk> \<Longrightarrow> t \<in> X"
4ceef1592e8c new command for lifting BNF structure over typedefs
traytel
parents: 60758
diff changeset
    19
  by simp
4ceef1592e8c new command for lifting BNF structure over typedefs
traytel
parents: 60758
diff changeset
    20
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    21
lemma empty_natural: "(\<lambda>_. {}) o f = image g o (\<lambda>_. {})"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    22
  by (rule ext) simp
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    23
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    24
lemma Union_natural: "Union o image (image f) = image f o Union"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    25
  by (rule ext) (auto simp only: comp_apply)
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    26
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    27
lemma in_Union_o_assoc: "x \<in> (Union o gset o gmap) A \<Longrightarrow> x \<in> (Union o (gset o gmap)) A"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    28
  by (unfold comp_assoc)
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    29
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    30
lemma comp_single_set_bd:
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    31
  assumes fbd_Card_order: "Card_order fbd" and
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    32
    fset_bd: "\<And>x. |fset x| \<le>o fbd" and
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    33
    gset_bd: "\<And>x. |gset x| \<le>o gbd"
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51893
diff changeset
    34
  shows "|\<Union>(fset ` gset x)| \<le>o gbd *c fbd"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    35
  apply simp
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    36
  apply (rule ordLeq_transitive)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    37
  apply (rule card_of_UNION_Sigma)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    38
  apply (subst SIGMA_CSUM)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    39
  apply (rule ordLeq_transitive)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    40
  apply (rule card_of_Csum_Times')
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    41
  apply (rule fbd_Card_order)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    42
  apply (rule ballI)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    43
  apply (rule fset_bd)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    44
  apply (rule ordLeq_transitive)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    45
  apply (rule cprod_mono1)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    46
  apply (rule gset_bd)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    47
  apply (rule ordIso_imp_ordLeq)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    48
  apply (rule ordIso_refl)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    49
  apply (rule Card_order_cprod)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    50
  done
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    51
55935
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
    52
lemma csum_dup: "cinfinite r \<Longrightarrow> Card_order r \<Longrightarrow> p +c p' =o r +c r \<Longrightarrow> p +c p' =o r"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    53
  apply (erule ordIso_transitive)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    54
  apply (frule csum_absorb2')
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    55
  apply (erule ordLeq_refl)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    56
  by simp
55935
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
    57
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
    58
lemma cprod_dup: "cinfinite r \<Longrightarrow> Card_order r \<Longrightarrow> p *c p' =o r *c r \<Longrightarrow> p *c p' =o r"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    59
  apply (erule ordIso_transitive)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    60
  apply (rule cprod_infinite)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    61
  by simp
55935
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
    62
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51893
diff changeset
    63
lemma Union_image_insert: "\<Union>(f ` insert a B) = f a \<union> \<Union>(f ` B)"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    64
  by simp
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    65
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51893
diff changeset
    66
lemma Union_image_empty: "A \<union> \<Union>(f ` {}) = A"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    67
  by simp
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    68
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    69
lemma image_o_collect: "collect ((\<lambda>f. image g o f) ` F) = image g o collect F"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    70
  by (rule ext) (auto simp add: collect_def)
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    71
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    72
lemma conj_subset_def: "A \<subseteq> {x. P x \<and> Q x} = (A \<subseteq> {x. P x} \<and> A \<subseteq> {x. Q x})"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    73
  by blast
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    74
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51893
diff changeset
    75
lemma UN_image_subset: "\<Union>(f ` g x) \<subseteq> X = (g x \<subseteq> {x. f x \<subseteq> X})"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    76
  by blast
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    77
52141
eff000cab70f weaker precendence of syntax for big intersection and union on sets
haftmann
parents: 51893
diff changeset
    78
lemma comp_set_bd_Union_o_collect: "|\<Union>\<Union>((\<lambda>f. f x) ` X)| \<le>o hbd \<Longrightarrow> |(Union \<circ> collect X) x| \<le>o hbd"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    79
  by (unfold comp_apply collect_def) simp
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    80
62324
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
    81
lemma Collect_inj: "Collect P = Collect Q \<Longrightarrow> P = Q"
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
    82
  by blast
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
    83
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
    84
lemma Ball_Collect: "Ball A P = (A \<subseteq> (Collect P))"
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
    85
by auto
49312
c874ff5658dc moved theorems closer to where they are used
blanchet
parents: 49309
diff changeset
    86
61032
b57df8eecad6 standardized some occurences of ancient "split" alias
haftmann
parents: 60918
diff changeset
    87
lemma Grp_fst_snd: "(Grp (Collect (case_prod R)) fst)^--1 OO Grp (Collect (case_prod R)) snd = R"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    88
  unfolding Grp_def fun_eq_iff relcompp.simps by auto
51893
596baae88a88 got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents: 49512
diff changeset
    89
596baae88a88 got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents: 49512
diff changeset
    90
lemma OO_Grp_cong: "A = B \<Longrightarrow> (Grp A f)^--1 OO Grp A g = (Grp B f)^--1 OO Grp B g"
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
    91
  by (rule arg_cong)
51893
596baae88a88 got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents: 49512
diff changeset
    92
55803
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
    93
lemma vimage2p_relcompp_mono: "R OO S \<le> T \<Longrightarrow>
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
    94
  vimage2p f g R OO vimage2p g h S \<le> vimage2p f h T"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
    95
  unfolding vimage2p_def by auto
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
    96
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
    97
lemma type_copy_map_cong0: "M (g x) = N (h x) \<Longrightarrow> (f o M o g) x = (f o N o h) x"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
    98
  by auto
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
    99
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   100
lemma type_copy_set_bd: "(\<And>y. |S y| \<le>o bd) \<Longrightarrow> |(S o Rep) x| \<le>o bd"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   101
  by auto
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   102
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   103
lemma vimage2p_cong: "R = S \<Longrightarrow> vimage2p f g R = vimage2p f g S"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   104
  by simp
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   105
62324
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
   106
lemma Ball_comp_iff: "(\<lambda>x. Ball (A x) f) o g = (\<lambda>x. Ball ((A o g) x) f)"
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
   107
  unfolding o_def by auto
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
   108
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
   109
lemma conj_comp_iff: "(\<lambda>x. P x \<and> Q x) o g = (\<lambda>x. (P o g) x \<and> (Q o g) x)"
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
   110
  unfolding o_def by auto
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
   111
55803
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   112
context
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
   113
  fixes Rep Abs
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
   114
  assumes type_copy: "type_definition Rep Abs UNIV"
55803
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   115
begin
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   116
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   117
lemma type_copy_map_id0: "M = id \<Longrightarrow> Abs o M o Rep = id"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   118
  using type_definition.Rep_inverse[OF type_copy] by auto
55811
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   119
55803
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   120
lemma type_copy_map_comp0: "M = M1 o M2 \<Longrightarrow> f o M o g = (f o M1 o Rep) o (Abs o M2 o g)"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   121
  using type_definition.Abs_inverse[OF type_copy UNIV_I] by auto
55811
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   122
55803
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   123
lemma type_copy_set_map0: "S o M = image f o S' \<Longrightarrow> (S o Rep) o (Abs o M o g) = image f o (S' o g)"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   124
  using type_definition.Abs_inverse[OF type_copy UNIV_I] by (auto simp: o_def fun_eq_iff)
55811
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   125
55803
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   126
lemma type_copy_wit: "x \<in> (S o Rep) (Abs y) \<Longrightarrow> x \<in> S y"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   127
  using type_definition.Abs_inverse[OF type_copy UNIV_I] by auto
55811
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   128
55803
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   129
lemma type_copy_vimage2p_Grp_Rep: "vimage2p f Rep (Grp (Collect P) h) =
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   130
    Grp (Collect (\<lambda>x. P (f x))) (Abs o h o f)"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   131
  unfolding vimage2p_def Grp_def fun_eq_iff
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   132
  by (auto simp: type_definition.Abs_inverse[OF type_copy UNIV_I]
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   133
   type_definition.Rep_inverse[OF type_copy] dest: sym)
55811
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   134
55803
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   135
lemma type_copy_vimage2p_Grp_Abs:
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   136
  "\<And>h. vimage2p g Abs (Grp (Collect P) h) = Grp (Collect (\<lambda>x. P (g x))) (Rep o h o g)"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   137
  unfolding vimage2p_def Grp_def fun_eq_iff
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   138
  by (auto simp: type_definition.Abs_inverse[OF type_copy UNIV_I]
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   139
   type_definition.Rep_inverse[OF type_copy] dest: sym)
55811
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   140
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   141
lemma type_copy_ex_RepI: "(\<exists>b. F b) = (\<exists>b. F (Rep b))"
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   142
proof safe
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   143
  fix b assume "F b"
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   144
  show "\<exists>b'. F (Rep b')"
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   145
  proof (rule exI)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 58889
diff changeset
   146
    from \<open>F b\<close> show "F (Rep (Abs b))" using type_definition.Abs_inverse[OF type_copy] by auto
55811
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   147
  qed
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   148
qed blast
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   149
55803
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   150
lemma vimage2p_relcompp_converse:
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   151
  "vimage2p f g (R^--1 OO S) = (vimage2p Rep f R)^--1 OO vimage2p Rep g S"
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   152
  unfolding vimage2p_def relcompp.simps conversep.simps fun_eq_iff image_def
55811
aa1acc25126b load Metis a little later
traytel
parents: 55803
diff changeset
   153
  by (auto simp: type_copy_ex_RepI)
55803
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   154
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   155
end
74d3fe9031d8 joint work with blanchet: intermediate typedef for the input to fp-operations
traytel
parents: 55705
diff changeset
   156
55935
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
   157
bnf DEADID: 'a
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
   158
  map: "id :: 'a \<Rightarrow> 'a"
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
   159
  bd: natLeq
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
   160
  rel: "op = :: 'a \<Rightarrow> 'a \<Rightarrow> bool"
62324
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
   161
  by (auto simp add: natLeq_card_order natLeq_cinfinite)
55935
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
   162
58353
c9f374b64d99 tuned fact visibility
blanchet
parents: 58282
diff changeset
   163
definition id_bnf :: "'a \<Rightarrow> 'a" where
c9f374b64d99 tuned fact visibility
blanchet
parents: 58282
diff changeset
   164
  "id_bnf \<equiv> (\<lambda>x. x)"
55935
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
   165
58181
6d527272f7b2 renamed internal constant
blanchet
parents: 58128
diff changeset
   166
lemma id_bnf_apply: "id_bnf x = x"
6d527272f7b2 renamed internal constant
blanchet
parents: 58128
diff changeset
   167
  unfolding id_bnf_def by simp
56016
8875cdcfc85b unfold intermediate definitions after sealing the bnf
traytel
parents: 55936
diff changeset
   168
55935
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
   169
bnf ID: 'a
58181
6d527272f7b2 renamed internal constant
blanchet
parents: 58128
diff changeset
   170
  map: "id_bnf :: ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b"
55935
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
   171
  sets: "\<lambda>x. {x}"
8f20d09d294e move special BNFs used for composition only to BNF_Comp;
traytel
parents: 55930
diff changeset
   172
  bd: natLeq
58181
6d527272f7b2 renamed internal constant
blanchet
parents: 58128
diff changeset
   173
  rel: "id_bnf :: ('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
62324
ae44f16dcea5 make predicator a first-class bnf citizen
traytel
parents: 61032
diff changeset
   174
  pred: "id_bnf :: ('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool"
58181
6d527272f7b2 renamed internal constant
blanchet
parents: 58128
diff changeset
   175
  unfolding id_bnf_def
58128
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
   176
  apply (auto simp: Grp_def fun_eq_iff relcompp.simps natLeq_card_order natLeq_cinfinite)
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
   177
  apply (rule ordLess_imp_ordLeq[OF finite_ordLess_infinite[OF _ natLeq_Well_order]])
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
   178
  apply (auto simp add: Field_card_of Field_natLeq card_of_well_order_on)[3]
43a1ba26a8cb renamed BNF theories
blanchet
parents: 57698
diff changeset
   179
  done
55854
ee270328a781 make 'typedef' optional, depending on size of original type
blanchet
parents: 55851
diff changeset
   180
58181
6d527272f7b2 renamed internal constant
blanchet
parents: 58128
diff changeset
   181
lemma type_definition_id_bnf_UNIV: "type_definition id_bnf id_bnf UNIV"
6d527272f7b2 renamed internal constant
blanchet
parents: 58128
diff changeset
   182
  unfolding id_bnf_def by unfold_locales auto
55854
ee270328a781 make 'typedef' optional, depending on size of original type
blanchet
parents: 55851
diff changeset
   183
55062
6d3fad6f01c9 made BNF compile after move to HOL
blanchet
parents: 55059
diff changeset
   184
ML_file "Tools/BNF/bnf_comp_tactics.ML"
6d3fad6f01c9 made BNF compile after move to HOL
blanchet
parents: 55059
diff changeset
   185
ML_file "Tools/BNF/bnf_comp.ML"
60918
4ceef1592e8c new command for lifting BNF structure over typedefs
traytel
parents: 60758
diff changeset
   186
ML_file "Tools/BNF/bnf_lift.ML"
49309
f20b24214ac2 split basic BNFs into really basic ones and others, and added Andreas Lochbihler's "option" BNF
blanchet
parents: 49308
diff changeset
   187
58282
48e16d74845b hide DEADID/ID theorems
blanchet
parents: 58181
diff changeset
   188
hide_fact
48e16d74845b hide DEADID/ID theorems
blanchet
parents: 58181
diff changeset
   189
  DEADID.inj_map DEADID.inj_map_strong DEADID.map_comp DEADID.map_cong DEADID.map_cong0
48e16d74845b hide DEADID/ID theorems
blanchet
parents: 58181
diff changeset
   190
  DEADID.map_cong_simp DEADID.map_id DEADID.map_id0 DEADID.map_ident DEADID.map_transfer
48e16d74845b hide DEADID/ID theorems
blanchet
parents: 58181
diff changeset
   191
  DEADID.rel_Grp DEADID.rel_compp DEADID.rel_compp_Grp DEADID.rel_conversep DEADID.rel_eq
48e16d74845b hide DEADID/ID theorems
blanchet
parents: 58181
diff changeset
   192
  DEADID.rel_flip DEADID.rel_map DEADID.rel_mono DEADID.rel_transfer
48e16d74845b hide DEADID/ID theorems
blanchet
parents: 58181
diff changeset
   193
  ID.inj_map ID.inj_map_strong ID.map_comp ID.map_cong ID.map_cong0 ID.map_cong_simp ID.map_id
48e16d74845b hide DEADID/ID theorems
blanchet
parents: 58181
diff changeset
   194
  ID.map_id0 ID.map_ident ID.map_transfer ID.rel_Grp ID.rel_compp ID.rel_compp_Grp ID.rel_conversep
48e16d74845b hide DEADID/ID theorems
blanchet
parents: 58181
diff changeset
   195
  ID.rel_eq ID.rel_flip ID.rel_map ID.rel_mono ID.rel_transfer ID.set_map ID.set_transfer
48e16d74845b hide DEADID/ID theorems
blanchet
parents: 58181
diff changeset
   196
48975
7f79f94a432c added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff changeset
   197
end