src/HOL/BNF/BNF_Comp.thy
author blanchet
Fri, 21 Sep 2012 16:45:06 +0200
changeset 50525 ba50d204095e
parent 50524 src/HOL/Codatatype/BNF_Comp.thy@163914705f8d
child 50527 82d99fe04018
permissions -rw-r--r--
renamed "Codatatype" directory "BNF" (and corresponding session) -- this opens the door to no-nonsense session names like "HOL-BNF-LFP"
blanchet@50524
     1
(*  Title:      HOL/BNF/BNF_Comp.thy
blanchet@49990
     2
    Author:     Dmitriy Traytel, TU Muenchen
blanchet@49990
     3
    Copyright   2012
blanchet@49990
     4
blanchet@49990
     5
Composition of bounded natural functors.
blanchet@49990
     6
*)
blanchet@49990
     7
blanchet@49990
     8
header {* Composition of Bounded Natural Functors *}
blanchet@49990
     9
blanchet@49990
    10
theory BNF_Comp
blanchet@49990
    11
imports Basic_BNFs
blanchet@49990
    12
begin
blanchet@49990
    13
blanchet@50327
    14
lemma empty_natural: "(\<lambda>_. {}) o f = image g o (\<lambda>_. {})"
blanchet@50327
    15
by (rule ext) simp
blanchet@50327
    16
blanchet@50327
    17
lemma Union_natural: "Union o image (image f) = image f o Union"
blanchet@50327
    18
by (rule ext) (auto simp only: o_apply)
blanchet@50327
    19
blanchet@50327
    20
lemma in_Union_o_assoc: "x \<in> (Union o gset o gmap) A \<Longrightarrow> x \<in> (Union o (gset o gmap)) A"
blanchet@50327
    21
by (unfold o_assoc)
blanchet@50327
    22
blanchet@50327
    23
lemma comp_single_set_bd:
blanchet@50327
    24
  assumes fbd_Card_order: "Card_order fbd" and
blanchet@50327
    25
    fset_bd: "\<And>x. |fset x| \<le>o fbd" and
blanchet@50327
    26
    gset_bd: "\<And>x. |gset x| \<le>o gbd"
blanchet@50327
    27
  shows "|\<Union>fset ` gset x| \<le>o gbd *c fbd"
blanchet@50327
    28
apply (subst sym[OF SUP_def])
blanchet@50327
    29
apply (rule ordLeq_transitive)
blanchet@50327
    30
apply (rule card_of_UNION_Sigma)
blanchet@50327
    31
apply (subst SIGMA_CSUM)
blanchet@50327
    32
apply (rule ordLeq_transitive)
blanchet@50327
    33
apply (rule card_of_Csum_Times')
blanchet@50327
    34
apply (rule fbd_Card_order)
blanchet@50327
    35
apply (rule ballI)
blanchet@50327
    36
apply (rule fset_bd)
blanchet@50327
    37
apply (rule ordLeq_transitive)
blanchet@50327
    38
apply (rule cprod_mono1)
blanchet@50327
    39
apply (rule gset_bd)
blanchet@50327
    40
apply (rule ordIso_imp_ordLeq)
blanchet@50327
    41
apply (rule ordIso_refl)
blanchet@50327
    42
apply (rule Card_order_cprod)
blanchet@50327
    43
done
blanchet@50327
    44
blanchet@50327
    45
lemma Union_image_insert: "\<Union>f ` insert a B = f a \<union> \<Union>f ` B"
blanchet@50327
    46
by simp
blanchet@50327
    47
blanchet@50327
    48
lemma Union_image_empty: "A \<union> \<Union>f ` {} = A"
blanchet@50327
    49
by simp
blanchet@50327
    50
blanchet@50327
    51
lemma image_o_collect: "collect ((\<lambda>f. image g o f) ` F) = image g o collect F"
blanchet@50327
    52
by (rule ext) (auto simp add: collect_def)
blanchet@50327
    53
blanchet@50327
    54
lemma conj_subset_def: "A \<subseteq> {x. P x \<and> Q x} = (A \<subseteq> {x. P x} \<and> A \<subseteq> {x. Q x})"
blanchet@50327
    55
by blast
blanchet@50327
    56
blanchet@50327
    57
lemma UN_image_subset: "\<Union>f ` g x \<subseteq> X = (g x \<subseteq> {x. f x \<subseteq> X})"
blanchet@50327
    58
by blast
blanchet@50327
    59
blanchet@50327
    60
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"
blanchet@50327
    61
by (unfold o_apply collect_def SUP_def)
blanchet@50327
    62
blanchet@50327
    63
lemma wpull_cong:
blanchet@50327
    64
"\<lbrakk>A' = A; B1' = B1; B2' = B2; wpull A B1 B2 f1 f2 p1 p2\<rbrakk> \<Longrightarrow> wpull A' B1' B2' f1 f2 p1 p2"
blanchet@50327
    65
by simp
blanchet@50327
    66
blanchet@50327
    67
lemma Id_def': "Id = {(a,b). a = b}"
blanchet@50327
    68
by auto
blanchet@50327
    69
blanchet@50327
    70
lemma Gr_fst_snd: "(Gr R fst)^-1 O Gr R snd = R"
blanchet@50327
    71
unfolding Gr_def by auto
blanchet@50327
    72
blanchet@50327
    73
lemma subst_rel_def: "A = B \<Longrightarrow> (Gr A f)^-1 O Gr A g = (Gr B f)^-1 O Gr B g"
blanchet@50327
    74
by simp
blanchet@50327
    75
blanchet@50327
    76
lemma abs_pred_def: "\<lbrakk>\<And>x y. (x, y) \<in> rel = pred x y\<rbrakk> \<Longrightarrow> rel = Collect (split pred)"
blanchet@50327
    77
by auto
blanchet@50327
    78
blanchet@50327
    79
lemma Collect_split_cong: "Collect (split pred) = Collect (split pred') \<Longrightarrow> pred = pred'"
blanchet@50327
    80
by blast
blanchet@50327
    81
blanchet@50327
    82
lemma pred_def_abs: "rel = Collect (split pred) \<Longrightarrow> pred = (\<lambda>x y. (x, y) \<in> rel)"
blanchet@50327
    83
by auto
blanchet@50327
    84
blanchet@50478
    85
lemma mem_Id_eq_eq: "(\<lambda>x y. (x, y) \<in> Id) = (op =)"
blanchet@50478
    86
by simp
blanchet@50478
    87
blanchet@50324
    88
ML_file "Tools/bnf_comp_tactics.ML"
blanchet@50324
    89
ML_file "Tools/bnf_comp.ML"
blanchet@50324
    90
blanchet@49990
    91
end