author | Andreas Lochbihler |
Wed, 11 Feb 2015 13:50:11 +0100 | |
changeset 59513 | 6949c8837e90 |
parent 58916 | 229765cc3414 |
child 59726 | 64c2bb331035 |
permissions | -rw-r--r-- |
55059 | 1 |
(* Title: HOL/BNF_Def.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 |
57398 | 3 |
Author: Jasmin Blanchette, TU Muenchen |
57698 | 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 |
Definition 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 |
|
58889 | 9 |
section {* Definition of Bounded Natural Functors *} |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
10 |
|
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
11 |
theory BNF_Def |
57398 | 12 |
imports BNF_Cardinal_Arithmetic Fun_Def_Base |
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
13 |
keywords |
49286 | 14 |
"print_bnfs" :: diag and |
51836
4d6dcd51dd52
renamed "bnf_def" keyword to "bnf" (since it's not a definition, but rather a registration)
blanchet
parents:
49537
diff
changeset
|
15 |
"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 |
|
58104 | 18 |
lemma Collect_splitD: "x \<in> Collect (split A) \<Longrightarrow> A (fst x) (snd x)" |
19 |
by auto |
|
20 |
||
58916 | 21 |
inductive |
22 |
rel_sum :: "('a \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> 'a + 'b \<Rightarrow> 'c + 'd \<Rightarrow> bool" for R1 R2 |
|
58446 | 23 |
where |
58916 | 24 |
"R1 a c \<Longrightarrow> rel_sum R1 R2 (Inl a) (Inl c)" |
25 |
| "R2 b d \<Longrightarrow> rel_sum R1 R2 (Inr b) (Inr d)" |
|
26 |
||
27 |
hide_fact rel_sum_def |
|
58446 | 28 |
|
29 |
definition |
|
57398 | 30 |
rel_fun :: "('a \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('c \<Rightarrow> 'd) \<Rightarrow> bool" |
31 |
where |
|
32 |
"rel_fun A B = (\<lambda>f g. \<forall>x y. A x y \<longrightarrow> B (f x) (g y))" |
|
33 |
||
34 |
lemma rel_funI [intro]: |
|
35 |
assumes "\<And>x y. A x y \<Longrightarrow> B (f x) (g y)" |
|
36 |
shows "rel_fun A B f g" |
|
37 |
using assms by (simp add: rel_fun_def) |
|
38 |
||
39 |
lemma rel_funD: |
|
40 |
assumes "rel_fun A B f g" and "A x y" |
|
41 |
shows "B (f x) (g y)" |
|
42 |
using assms by (simp add: rel_fun_def) |
|
43 |
||
59513 | 44 |
lemma rel_fun_mono: |
45 |
"\<lbrakk> rel_fun X A f g; \<And>x y. Y x y \<longrightarrow> X x y; \<And>x y. A x y \<Longrightarrow> B x y \<rbrakk> \<Longrightarrow> rel_fun Y B f g" |
|
46 |
by(simp add: rel_fun_def) |
|
47 |
||
48 |
lemma rel_fun_mono' [mono]: |
|
49 |
"\<lbrakk> \<And>x y. Y x y \<longrightarrow> X x y; \<And>x y. A x y \<longrightarrow> B x y \<rbrakk> \<Longrightarrow> rel_fun X A f g \<longrightarrow> rel_fun Y B f g" |
|
50 |
by(simp add: rel_fun_def) |
|
51 |
||
58104 | 52 |
definition rel_set :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> 'b set \<Rightarrow> bool" |
53 |
where "rel_set R = (\<lambda>A B. (\<forall>x\<in>A. \<exists>y\<in>B. R x y) \<and> (\<forall>y\<in>B. \<exists>x\<in>A. R x y))" |
|
54 |
||
55 |
lemma rel_setI: |
|
56 |
assumes "\<And>x. x \<in> A \<Longrightarrow> \<exists>y\<in>B. R x y" |
|
57 |
assumes "\<And>y. y \<in> B \<Longrightarrow> \<exists>x\<in>A. R x y" |
|
58 |
shows "rel_set R A B" |
|
59 |
using assms unfolding rel_set_def by simp |
|
60 |
||
61 |
lemma predicate2_transferD: |
|
62 |
"\<lbrakk>rel_fun R1 (rel_fun R2 (op =)) P Q; a \<in> A; b \<in> B; A \<subseteq> {(x, y). R1 x y}; B \<subseteq> {(x, y). R2 x y}\<rbrakk> \<Longrightarrow> |
|
63 |
P (fst a) (fst b) \<longleftrightarrow> Q (snd a) (snd b)" |
|
64 |
unfolding rel_fun_def by (blast dest!: Collect_splitD) |
|
65 |
||
57398 | 66 |
definition collect where |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
67 |
"collect F x = (\<Union>f \<in> F. f x)" |
57398 | 68 |
|
69 |
lemma fstI: "x = (y, z) \<Longrightarrow> fst x = y" |
|
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
70 |
by simp |
57398 | 71 |
|
72 |
lemma sndI: "x = (y, z) \<Longrightarrow> snd x = z" |
|
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
73 |
by simp |
57398 | 74 |
|
75 |
lemma bijI': "\<lbrakk>\<And>x y. (f x = f y) = (x = y); \<And>y. \<exists>x. y = f x\<rbrakk> \<Longrightarrow> bij f" |
|
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
76 |
unfolding bij_def inj_on_def by auto blast |
57398 | 77 |
|
78 |
(* Operator: *) |
|
79 |
definition "Gr A f = {(a, f a) | a. a \<in> A}" |
|
80 |
||
81 |
definition "Grp A f = (\<lambda>a b. b = f a \<and> a \<in> A)" |
|
82 |
||
83 |
definition vimage2p where |
|
84 |
"vimage2p f g R = (\<lambda>x y. R (f x) (g y))" |
|
85 |
||
56635 | 86 |
lemma collect_comp: "collect F \<circ> g = collect ((\<lambda>f. f \<circ> g) ` F)" |
55066 | 87 |
by (rule ext) (auto simp only: comp_apply collect_def) |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
88 |
|
57641
dc59f147b27d
more robust notation BNF_Def.convol, which is private to main HOL, but may cause syntax ambiguities nonetheless (e.g. List.thy);
wenzelm
parents:
57398
diff
changeset
|
89 |
definition convol ("\<langle>(_,/ _)\<rangle>") where |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
90 |
"\<langle>f, g\<rangle> \<equiv> \<lambda>a. (f a, g a)" |
49495 | 91 |
|
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
92 |
lemma fst_convol: "fst \<circ> \<langle>f, g\<rangle> = f" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
93 |
apply(rule ext) |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
94 |
unfolding convol_def by simp |
49495 | 95 |
|
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
96 |
lemma snd_convol: "snd \<circ> \<langle>f, g\<rangle> = g" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
97 |
apply(rule ext) |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
98 |
unfolding convol_def by simp |
49495 | 99 |
|
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
100 |
lemma convol_mem_GrpI: |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
101 |
"x \<in> A \<Longrightarrow> \<langle>id, g\<rangle> x \<in> (Collect (split (Grp A g)))" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
102 |
unfolding convol_def Grp_def by auto |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
103 |
|
49312 | 104 |
definition csquare where |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
105 |
"csquare A f1 f2 p1 p2 \<longleftrightarrow> (\<forall> a \<in> A. f1 (p1 a) = f2 (p2 a))" |
49312 | 106 |
|
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
107 |
lemma eq_alt: "op = = Grp UNIV id" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
108 |
unfolding Grp_def by auto |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
109 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
110 |
lemma leq_conversepI: "R = op = \<Longrightarrow> R \<le> R^--1" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
111 |
by auto |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
112 |
|
54841
af71b753c459
express weak pullback property of bnfs only in terms of the relator
traytel
parents:
54581
diff
changeset
|
113 |
lemma leq_OOI: "R = op = \<Longrightarrow> R \<le> R OO R" |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
114 |
by auto |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
115 |
|
53561 | 116 |
lemma OO_Grp_alt: "(Grp A f)^--1 OO Grp A g = (\<lambda>x y. \<exists>z. z \<in> A \<and> f z = x \<and> g z = y)" |
117 |
unfolding Grp_def by auto |
|
118 |
||
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
119 |
lemma Grp_UNIV_id: "f = id \<Longrightarrow> (Grp UNIV f)^--1 OO Grp UNIV f = Grp UNIV f" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
120 |
unfolding Grp_def by auto |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
121 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
122 |
lemma Grp_UNIV_idI: "x = y \<Longrightarrow> Grp UNIV id x y" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
123 |
unfolding Grp_def by auto |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
124 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
125 |
lemma Grp_mono: "A \<le> B \<Longrightarrow> Grp A f \<le> Grp B f" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
126 |
unfolding Grp_def by auto |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
127 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
128 |
lemma GrpI: "\<lbrakk>f x = y; x \<in> A\<rbrakk> \<Longrightarrow> Grp A f x y" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
129 |
unfolding Grp_def by auto |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
130 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
131 |
lemma GrpE: "Grp A f x y \<Longrightarrow> (\<lbrakk>f x = y; x \<in> A\<rbrakk> \<Longrightarrow> R) \<Longrightarrow> R" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
132 |
unfolding Grp_def by auto |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
133 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
134 |
lemma Collect_split_Grp_eqD: "z \<in> Collect (split (Grp A f)) \<Longrightarrow> (f \<circ> fst) z = snd z" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
135 |
unfolding Grp_def comp_def by auto |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
136 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
137 |
lemma Collect_split_Grp_inD: "z \<in> Collect (split (Grp A f)) \<Longrightarrow> fst z \<in> A" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
138 |
unfolding Grp_def comp_def by auto |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
139 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
140 |
definition "pick_middlep P Q a c = (SOME b. P a b \<and> Q b c)" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
141 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
142 |
lemma pick_middlep: |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
143 |
"(P OO Q) a c \<Longrightarrow> P a (pick_middlep P Q a c) \<and> Q (pick_middlep P Q a c) c" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
144 |
unfolding pick_middlep_def apply(rule someI_ex) by auto |
49312 | 145 |
|
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
146 |
definition fstOp where |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
147 |
"fstOp P Q ac = (fst ac, pick_middlep P Q (fst ac) (snd ac))" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
148 |
|
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
149 |
definition sndOp where |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
150 |
"sndOp P Q ac = (pick_middlep P Q (fst ac) (snd ac), (snd ac))" |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
151 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
152 |
lemma fstOp_in: "ac \<in> Collect (split (P OO Q)) \<Longrightarrow> fstOp P Q ac \<in> Collect (split P)" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
153 |
unfolding fstOp_def mem_Collect_eq |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
154 |
by (subst (asm) surjective_pairing, unfold prod.case) (erule pick_middlep[THEN conjunct1]) |
49312 | 155 |
|
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
156 |
lemma fst_fstOp: "fst bc = (fst \<circ> fstOp P Q) bc" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
157 |
unfolding comp_def fstOp_def by simp |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
158 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
159 |
lemma snd_sndOp: "snd bc = (snd \<circ> sndOp P Q) bc" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
160 |
unfolding comp_def sndOp_def by simp |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
161 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
162 |
lemma sndOp_in: "ac \<in> Collect (split (P OO Q)) \<Longrightarrow> sndOp P Q ac \<in> Collect (split Q)" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
163 |
unfolding sndOp_def mem_Collect_eq |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
164 |
by (subst (asm) surjective_pairing, unfold prod.case) (erule pick_middlep[THEN conjunct2]) |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
165 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
166 |
lemma csquare_fstOp_sndOp: |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
167 |
"csquare (Collect (split (P OO Q))) snd fst (fstOp P Q) (sndOp P Q)" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
168 |
unfolding csquare_def fstOp_def sndOp_def using pick_middlep by simp |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
169 |
|
56635 | 170 |
lemma snd_fst_flip: "snd xy = (fst \<circ> (%(x, y). (y, x))) xy" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
171 |
by (simp split: prod.split) |
49312 | 172 |
|
56635 | 173 |
lemma fst_snd_flip: "fst xy = (snd \<circ> (%(x, y). (y, x))) xy" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
174 |
by (simp split: prod.split) |
49312 | 175 |
|
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
176 |
lemma flip_pred: "A \<subseteq> Collect (split (R ^--1)) \<Longrightarrow> (%(x, y). (y, x)) ` A \<subseteq> Collect (split R)" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
177 |
by auto |
51893
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
178 |
|
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
179 |
lemma Collect_split_mono: "A \<le> B \<Longrightarrow> Collect (split A) \<subseteq> Collect (split B)" |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
180 |
by auto |
596baae88a88
got rid of the set based relator---use (binary) predicate based relator instead
traytel
parents:
51836
diff
changeset
|
181 |
|
51916 | 182 |
lemma Collect_split_mono_strong: |
55163 | 183 |
"\<lbrakk>X = fst ` A; Y = snd ` A; \<forall>a\<in>X. \<forall>b \<in> Y. P a b \<longrightarrow> Q a b; A \<subseteq> Collect (split P)\<rbrakk> \<Longrightarrow> |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
184 |
A \<subseteq> Collect (split Q)" |
51916 | 185 |
by fastforce |
186 |
||
55163 | 187 |
|
51917
f964a9887713
store proper theorems even for fixed points that have no passive live variables
traytel
parents:
51916
diff
changeset
|
188 |
lemma predicate2_eqD: "A = B \<Longrightarrow> A a b \<longleftrightarrow> B a b" |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
189 |
by simp |
49537
fe1deee434b6
generate "rel_as_srel" and "rel_flip" properties
blanchet
parents:
49510
diff
changeset
|
190 |
|
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
191 |
lemma case_sum_o_inj: "case_sum f g \<circ> Inl = f" "case_sum f g \<circ> Inr = g" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
192 |
by auto |
52635
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
51917
diff
changeset
|
193 |
|
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
194 |
lemma map_sum_o_inj: "map_sum f g o Inl = Inl o f" "map_sum f g o Inr = Inr o g" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
195 |
by auto |
57802 | 196 |
|
52635
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
51917
diff
changeset
|
197 |
lemma card_order_csum_cone_cexp_def: |
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
51917
diff
changeset
|
198 |
"card_order r \<Longrightarrow> ( |A1| +c cone) ^c r = |Func UNIV (Inl ` A1 \<union> {Inr ()})|" |
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
51917
diff
changeset
|
199 |
unfolding cexp_def cone_def Field_csum Field_card_of by (auto dest: Field_card_order) |
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
51917
diff
changeset
|
200 |
|
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
51917
diff
changeset
|
201 |
lemma If_the_inv_into_in_Func: |
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
51917
diff
changeset
|
202 |
"\<lbrakk>inj_on g C; C \<subseteq> B \<union> {x}\<rbrakk> \<Longrightarrow> |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
203 |
(\<lambda>i. if i \<in> g ` C then the_inv_into C g i else x) \<in> Func UNIV (B \<union> {x})" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
204 |
unfolding Func_def by (auto dest: the_inv_into_into) |
52635
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
51917
diff
changeset
|
205 |
|
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
51917
diff
changeset
|
206 |
lemma If_the_inv_into_f_f: |
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
207 |
"\<lbrakk>i \<in> C; inj_on g C\<rbrakk> \<Longrightarrow> ((\<lambda>i. if i \<in> g ` C then the_inv_into C g i else x) \<circ> g) i = id i" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
208 |
unfolding Func_def by (auto elim: the_inv_into_f_f) |
52635
4f84b730c489
got rid of in_bd BNF property (derivable from set_bd+map_cong+map_comp+map_id)
traytel
parents:
51917
diff
changeset
|
209 |
|
56635 | 210 |
lemma the_inv_f_o_f_id: "inj f \<Longrightarrow> (the_inv f \<circ> f) z = id z" |
211 |
by (simp add: the_inv_f_f) |
|
212 |
||
52731 | 213 |
lemma vimage2pI: "R (f x) (g y) \<Longrightarrow> vimage2p f g R x y" |
214 |
unfolding vimage2p_def by - |
|
52719
480a3479fa47
transfer rule for map (not yet registered as a transfer rule)
traytel
parents:
52660
diff
changeset
|
215 |
|
55945 | 216 |
lemma rel_fun_iff_leq_vimage2p: "(rel_fun R S) f g = (R \<le> vimage2p f g S)" |
217 |
unfolding rel_fun_def vimage2p_def by auto |
|
52719
480a3479fa47
transfer rule for map (not yet registered as a transfer rule)
traytel
parents:
52660
diff
changeset
|
218 |
|
57641
dc59f147b27d
more robust notation BNF_Def.convol, which is private to main HOL, but may cause syntax ambiguities nonetheless (e.g. List.thy);
wenzelm
parents:
57398
diff
changeset
|
219 |
lemma convol_image_vimage2p: "\<langle>f \<circ> fst, g \<circ> snd\<rangle> ` Collect (split (vimage2p f g R)) \<subseteq> Collect (split R)" |
52731 | 220 |
unfolding vimage2p_def convol_def by auto |
52719
480a3479fa47
transfer rule for map (not yet registered as a transfer rule)
traytel
parents:
52660
diff
changeset
|
221 |
|
54961 | 222 |
lemma vimage2p_Grp: "vimage2p f g P = Grp UNIV f OO P OO (Grp UNIV g)\<inverse>\<inverse>" |
223 |
unfolding vimage2p_def Grp_def by auto |
|
224 |
||
58106 | 225 |
lemma subst_Pair: "P x y \<Longrightarrow> a = (x, y) \<Longrightarrow> P (fst a) (snd a)" |
226 |
by simp |
|
227 |
||
58352
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
228 |
lemma comp_apply_eq: "f (g x) = h (k x) \<Longrightarrow> (f \<circ> g) x = (h \<circ> k) x" |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
229 |
unfolding comp_apply by assumption |
37745650a3f4
register 'prod' and 'sum' as datatypes, to allow N2M through them
blanchet
parents:
58106
diff
changeset
|
230 |
|
57398 | 231 |
ML_file "Tools/BNF/bnf_util.ML" |
232 |
ML_file "Tools/BNF/bnf_tactics.ML" |
|
55062 | 233 |
ML_file "Tools/BNF/bnf_def_tactics.ML" |
234 |
ML_file "Tools/BNF/bnf_def.ML" |
|
49309
f20b24214ac2
split basic BNFs into really basic ones and others, and added Andreas Lochbihler's "option" BNF
blanchet
parents:
49286
diff
changeset
|
235 |
|
48975
7f79f94a432c
added new (co)datatype package + theories of ordinals and cardinals (with Dmitriy and Andrei)
blanchet
parents:
diff
changeset
|
236 |
end |