Quot/QuotBase.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 10 Feb 2010 20:35:54 +0100
changeset 1125 68b8ebcc5240
parent 1123 41f89d4f9548
permissions -rw-r--r--
cleaned a bit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
     1
(*  Title:      QuotBase.thy
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
     2
    Author:     Cezary Kaliszyk and Christian Urban
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
     3
*)
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
     4
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
     5
theory QuotBase
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
     6
imports Plain ATP_Linkup
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
begin
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
     9
text {*
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
    10
  Basic definition for equivalence relations
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
    11
  that are represented by predicates.
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
    12
*}
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
    13
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
    14
definition
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
    15
  "equivp E \<longleftrightarrow> (\<forall>x y. E x y = (E x = E y))"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
definition
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
    18
  "reflp E \<longleftrightarrow> (\<forall>x. E x x)"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
    20
definition
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
    21
  "symp E \<longleftrightarrow> (\<forall>x y. E x y \<longrightarrow> E y x)"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
definition
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
    24
  "transp E \<longleftrightarrow> (\<forall>x y z. E x y \<and> E y z \<longrightarrow> E x z)"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
    26
lemma equivp_reflp_symp_transp:
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
    27
  shows "equivp E = (reflp E \<and> symp E \<and> transp E)"
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
    28
  unfolding equivp_def reflp_def symp_def transp_def expand_fun_eq
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
    29
  by blast
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
    31
lemma equivp_reflp:
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
    32
  shows "equivp E \<Longrightarrow> E x x"
593
18eac4596ef1 QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 554
diff changeset
    33
  by (simp only: equivp_reflp_symp_transp reflp_def)
18eac4596ef1 QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 554
diff changeset
    34
18eac4596ef1 QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 554
diff changeset
    35
lemma equivp_symp:
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
    36
  shows "equivp E \<Longrightarrow> E x y \<Longrightarrow> E y x"
593
18eac4596ef1 QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 554
diff changeset
    37
  by (metis equivp_reflp_symp_transp symp_def)
18eac4596ef1 QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 554
diff changeset
    38
18eac4596ef1 QuotProd with product_quotient and a 3 respects and preserves lemmas.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 554
diff changeset
    39
lemma equivp_transp:
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
    40
  shows "equivp E \<Longrightarrow> E x y \<Longrightarrow> E y z \<Longrightarrow> E x z"
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
    41
  by (metis equivp_reflp_symp_transp transp_def)
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 188
diff changeset
    42
700
91b079db7380 added Larry's theory; introduced lemma equivpI; added something to the TODO about error messages
Christian Urban <urbanc@in.tum.de>
parents: 697
diff changeset
    43
lemma equivpI:
91b079db7380 added Larry's theory; introduced lemma equivpI; added something to the TODO about error messages
Christian Urban <urbanc@in.tum.de>
parents: 697
diff changeset
    44
  assumes "reflp R" "symp R" "transp R"
91b079db7380 added Larry's theory; introduced lemma equivpI; added something to the TODO about error messages
Christian Urban <urbanc@in.tum.de>
parents: 697
diff changeset
    45
  shows "equivp R"
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
    46
  using assms by (simp add: equivp_reflp_symp_transp)
700
91b079db7380 added Larry's theory; introduced lemma equivpI; added something to the TODO about error messages
Christian Urban <urbanc@in.tum.de>
parents: 697
diff changeset
    47
919
c46b6abad24b cleaned some theorems
Christian Urban <urbanc@in.tum.de>
parents: 913
diff changeset
    48
lemma eq_imp_rel:  
c46b6abad24b cleaned some theorems
Christian Urban <urbanc@in.tum.de>
parents: 913
diff changeset
    49
  shows "equivp R \<Longrightarrow> a = b \<longrightarrow> R a b" 
1116
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
    50
  by (simp add: equivp_reflp)
919
c46b6abad24b cleaned some theorems
Christian Urban <urbanc@in.tum.de>
parents: 913
diff changeset
    51
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    52
lemma identity_equivp:
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    53
  shows "equivp (op =)"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    54
  unfolding equivp_def
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    55
  by auto
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    56
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    57
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
    58
text {* Partial equivalences: not yet used anywhere *}
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
definition
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
    60
  "part_equivp E \<longleftrightarrow> ((\<exists>x. E x x) \<and> (\<forall>x y. E x y = (E x x \<and> E y y \<and> (E x = E y))))"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    62
lemma equivp_implies_part_equivp:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
    63
  assumes a: "equivp E"
541
94deffed619d more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 540
diff changeset
    64
  shows "part_equivp E"
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
    65
  using a 
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
    66
  unfolding equivp_def part_equivp_def
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
    67
  by auto
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
    69
text {* Composition of Relations *}
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
    70
841
8e44ce29f974 added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents: 825
diff changeset
    71
abbreviation 
8e44ce29f974 added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents: 825
diff changeset
    72
  rel_conj (infixr "OOO" 75)
8e44ce29f974 added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents: 825
diff changeset
    73
where
8e44ce29f974 added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents: 825
diff changeset
    74
  "r1 OOO r2 \<equiv> r1 OO r2 OO r1"
8e44ce29f974 added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents: 825
diff changeset
    75
936
Christian Urban <urbanc@in.tum.de>
parents: 927
diff changeset
    76
lemma eq_comp_r: 
Christian Urban <urbanc@in.tum.de>
parents: 927
diff changeset
    77
  shows "((op =) OOO R) = R"
Christian Urban <urbanc@in.tum.de>
parents: 927
diff changeset
    78
  by (auto simp add: expand_fun_eq)
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    79
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    80
section {* Respects predicate *}
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    81
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    82
definition
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    83
  Respects
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    84
where
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
    85
  "Respects R x \<longleftrightarrow> (R x x)"
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    86
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    87
lemma in_respects:
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    88
  shows "(x \<in> Respects R) = R x x"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    89
  unfolding mem_def Respects_def 
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    90
  by simp
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    91
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    92
section {* Function map and function relation *}
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    93
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    94
definition
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    95
  fun_map (infixr "--->" 55)
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    96
where
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    97
[simp]: "fun_map f g h x = g (h (f x))"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    98
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
    99
definition
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   100
  fun_rel (infixr "===>" 55)
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   101
where
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   102
[simp]: "fun_rel E1 E2 f g = (\<forall>x y. E1 x y \<longrightarrow> E2 (f x) (g y))"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   103
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   104
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   105
lemma fun_map_id:
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   106
  shows "(id ---> id) = id"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   107
  by (simp add: expand_fun_eq id_def)
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   108
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   109
lemma fun_rel_eq:
926
c445b6aeefc9 Removing more eq_reflections.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 921
diff changeset
   110
  shows "((op =) ===> (op =)) = (op =)"
c445b6aeefc9 Removing more eq_reflections.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 921
diff changeset
   111
  by (simp add: expand_fun_eq)
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   112
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   113
lemma fun_rel_id:
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   114
  assumes a: "\<And>x y. R1 x y \<Longrightarrow> R2 (f x) (g y)"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   115
  shows "(R1 ===> R2) f g"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   116
  using a by simp
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   117
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   118
lemma fun_rel_id_asm:
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   119
  assumes a: "\<And>x y. R1 x y \<Longrightarrow> (A \<longrightarrow> R2 (f x) (g y))"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   120
  shows "A \<longrightarrow> (R1 ===> R2) f g"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   121
  using a by auto
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   122
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   123
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   124
section {* Quotient Predicate *}
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   126
definition
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
   127
  "Quotient E Abs Rep \<longleftrightarrow>
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   128
     (\<forall>a. Abs (Rep a) = a) \<and> (\<forall>a. E (Rep a) (Rep a)) \<and>
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   129
     (\<forall>r s. E r s = (E r r \<and> E s s \<and> (Abs r = Abs s)))"
841
8e44ce29f974 added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents: 825
diff changeset
   130
540
c0b13fb70d6d More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 539
diff changeset
   131
lemma Quotient_abs_rep:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   132
  assumes a: "Quotient E Abs Rep"
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   133
  shows "Abs (Rep a) = a"
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   134
  using a 
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   135
  unfolding Quotient_def
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   136
  by simp
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
541
94deffed619d more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 540
diff changeset
   138
lemma Quotient_rep_reflp:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   139
  assumes a: "Quotient E Abs Rep"
541
94deffed619d more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 540
diff changeset
   140
  shows "E (Rep a) (Rep a)"
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   141
  using a 
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   142
  unfolding Quotient_def
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   143
  by blast
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
539
8287fb5b8d7a Cleaning & Renaming coming from QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 537
diff changeset
   145
lemma Quotient_rel:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   146
  assumes a: "Quotient E Abs Rep"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
  shows " E r s = (E r r \<and> E s s \<and> (Abs r = Abs s))"
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   148
  using a 
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   149
  unfolding Quotient_def
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   150
  by blast
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
541
94deffed619d more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 540
diff changeset
   152
lemma Quotient_rel_rep:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   153
  assumes a: "Quotient R Abs Rep"
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   154
  shows "R (Rep a) (Rep b) = (a = b)"
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   155
  using a 
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   156
  unfolding Quotient_def
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   157
  by metis
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
540
c0b13fb70d6d More code cleaning and renaming: moved rsp and prs lemmas from Int to QuotList
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 539
diff changeset
   159
lemma Quotient_rep_abs:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   160
  assumes a: "Quotient R Abs Rep"
459
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   161
  shows "R r r \<Longrightarrow> R (Rep (Abs r)) r"
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   162
  using a unfolding Quotient_def
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   163
  by blast
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   165
lemma Quotient_rel_abs:
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   166
  assumes a: "Quotient E Abs Rep"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   167
  shows "E r s \<Longrightarrow> Abs r = Abs s"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   168
  using a unfolding Quotient_def
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   169
  by blast
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   170
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   171
lemma Quotient_symp:
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   172
  assumes a: "Quotient E Abs Rep"
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   173
  shows "symp E"
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   174
  using a unfolding Quotient_def symp_def
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   175
  by metis
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   177
lemma Quotient_transp:
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   178
  assumes a: "Quotient E Abs Rep"
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   179
  shows "transp E"
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   180
  using a unfolding Quotient_def transp_def
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   181
  by metis
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
920
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   183
lemma identity_quotient:
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   184
  shows "Quotient (op =) id id"
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   185
  unfolding Quotient_def id_def
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   186
  by blast
dae99175f584 renamed QuotScript to QuotBase
Christian Urban <urbanc@in.tum.de>
parents: 919
diff changeset
   187
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 536
diff changeset
   188
lemma fun_quotient:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   189
  assumes q1: "Quotient R1 abs1 rep1"
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   190
  and     q2: "Quotient R2 abs2 rep2"
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   191
  shows "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
proof -
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
  have "\<forall>a. (rep1 ---> abs2) ((abs1 ---> rep2) a) = a"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   194
    using q1 q2 
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   195
    unfolding Quotient_def
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   196
    unfolding expand_fun_eq
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   197
    by simp
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
  moreover
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
  have "\<forall>a. (R1 ===> R2) ((abs1 ---> rep2) a) ((abs1 ---> rep2) a)"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   200
    using q1 q2 
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   201
    unfolding Quotient_def
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   202
    by (simp (no_asm)) (metis)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
  moreover
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
  have "\<forall>r s. (R1 ===> R2) r s = ((R1 ===> R2) r r \<and> (R1 ===> R2) s s \<and> 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
        (rep1 ---> abs2) r  = (rep1 ---> abs2) s)"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   206
    unfolding expand_fun_eq
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   207
    apply(auto)
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   208
    using q1 q2 unfolding Quotient_def
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
    apply(metis)
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   210
    using q1 q2 unfolding Quotient_def
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
    apply(metis)
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   212
    using q1 q2 unfolding Quotient_def
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
    apply(metis)
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   214
    using q1 q2 unfolding Quotient_def
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
    apply(metis)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
    done
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
  ultimately
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   218
  show "Quotient (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)"
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   219
    unfolding Quotient_def by blast
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
qed
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   222
lemma abs_o_rep:
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   223
  assumes a: "Quotient R Abs Rep"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   224
  shows "Abs o Rep = id"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   225
  unfolding expand_fun_eq
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   226
  by (simp add: Quotient_abs_rep[OF a])
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
527
9b1ad366827f code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 519
diff changeset
   228
lemma equals_rsp:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   229
  assumes q: "Quotient R Abs Rep"
519
ebfd747b47ab Change equiv_trans2 to EQUALS_RSP, since we can prove it for any quotient type, not only for eqv relations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 516
diff changeset
   230
  and     a: "R xa xb" "R ya yb"
ebfd747b47ab Change equiv_trans2 to EQUALS_RSP, since we can prove it for any quotient type, not only for eqv relations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 516
diff changeset
   231
  shows "R xa ya = R xb yb"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   232
  using a Quotient_symp[OF q] Quotient_transp[OF q] 
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   233
  unfolding symp_def transp_def
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   234
  by blast
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
527
9b1ad366827f code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 519
diff changeset
   236
lemma lambda_prs:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   237
  assumes q1: "Quotient R1 Abs1 Rep1"
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   238
  and     q2: "Quotient R2 Abs2 Rep2"
253
e169a99c6ada Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 252
diff changeset
   239
  shows "(Rep1 ---> Abs2) (\<lambda>x. Rep2 (f (Abs1 x))) = (\<lambda>x. f x)"
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   240
  unfolding expand_fun_eq
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   241
  using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2]
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   242
  by simp
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
527
9b1ad366827f code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 519
diff changeset
   244
lemma lambda_prs1:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   245
  assumes q1: "Quotient R1 Abs1 Rep1"
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   246
  and     q2: "Quotient R2 Abs2 Rep2"
527
9b1ad366827f code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 519
diff changeset
   247
  shows "(Rep1 ---> Abs2) (\<lambda>x. (Abs1 ---> Rep2) f x) = (\<lambda>x. f x)"
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   248
  unfolding expand_fun_eq
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   249
  using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2]
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   250
  by simp
253
e169a99c6ada Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 252
diff changeset
   251
542
fe468f8723fc More cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 541
diff changeset
   252
lemma rep_abs_rsp:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   253
  assumes q: "Quotient R Abs Rep"
459
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   254
  and     a: "R x1 x2"
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   255
  shows "R x1 (Rep (Abs x2))"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   256
  using a Quotient_rel[OF q] Quotient_abs_rep[OF q] Quotient_rep_reflp[OF q]
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   257
  by metis
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   258
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   259
lemma rep_abs_rsp_left:
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   260
  assumes q: "Quotient R Abs Rep"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   261
  and     a: "R x1 x2"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   262
  shows "R (Rep (Abs x1)) x2"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   263
  using a Quotient_rel[OF q] Quotient_abs_rep[OF q] Quotient_rep_reflp[OF q]
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   264
  by metis
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   265
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   266
text{* 
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   267
  In the following theorem R1 can be instantiated with anything,
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   268
  but we know some of the types of the Rep and Abs functions;
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   269
  so by solving Quotient assumptions we can get a unique R1 that
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   270
  will be provable; which is why we need to use apply_rsp and
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   271
  not the primed version *}
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   272
527
9b1ad366827f code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 519
diff changeset
   273
lemma apply_rsp:
841
8e44ce29f974 added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents: 825
diff changeset
   274
  fixes f g::"'a \<Rightarrow> 'c"
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   275
  assumes q: "Quotient R1 Abs1 Rep1"
516
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   276
  and     a: "(R1 ===> R2) f g" "R1 x y"
841
8e44ce29f974 added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents: 825
diff changeset
   277
  shows "R2 (f x) (g y)"
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   278
  using a by simp
516
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   279
527
9b1ad366827f code cleaning and renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 519
diff changeset
   280
lemma apply_rsp':
317
d3c7f6d19c7f Still don't know how to do the proof automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 253
diff changeset
   281
  assumes a: "(R1 ===> R2) f g" "R1 x y"
d3c7f6d19c7f Still don't know how to do the proof automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 253
diff changeset
   282
  shows "R2 (f x) (g y)"
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   283
  using a by simp
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   284
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   285
section {* lemmas for regularisation of ball and bex *}
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   286
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   287
lemma ball_reg_eqv:
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   288
  fixes P :: "'a \<Rightarrow> bool"
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   289
  assumes a: "equivp R"
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   290
  shows "Ball (Respects R) P = (All P)"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   291
  using a 
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   292
  unfolding equivp_def
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   293
  by (auto simp add: in_respects)
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   294
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   295
lemma bex_reg_eqv:
93
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   296
  fixes P :: "'a \<Rightarrow> bool"
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   297
  assumes a: "equivp R"
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   298
  shows "Bex (Respects R) P = (Ex P)"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   299
  using a 
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   300
  unfolding equivp_def
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   301
  by (auto simp add: in_respects)
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   302
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   303
lemma ball_reg_right:
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   304
  assumes a: "\<And>x. R x \<Longrightarrow> P x \<longrightarrow> Q x"
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   305
  shows "All P \<longrightarrow> Ball R Q"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   306
  using a by (metis COMBC_def Collect_def Collect_mem_eq)
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   307
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   308
lemma bex_reg_left:
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   309
  assumes a: "\<And>x. R x \<Longrightarrow> Q x \<longrightarrow> P x"
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   310
  shows "Bex R Q \<longrightarrow> Ex P"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   311
  using a by (metis COMBC_def Collect_def Collect_mem_eq)
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   312
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   313
lemma ball_reg_left:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   314
  assumes a: "equivp R"
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   315
  shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ball (Respects R) Q \<longrightarrow> All P"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   316
  using a by (metis equivp_reflp in_respects)
93
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   317
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   318
lemma bex_reg_right:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   319
  assumes a: "equivp R"
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   320
  shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ex Q \<longrightarrow> Bex (Respects R) P"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   321
  using a by (metis equivp_reflp in_respects)
93
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   322
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   323
lemma ball_reg_eqv_range:
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   324
  fixes P::"'a \<Rightarrow> bool"
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   325
  and x::"'a"
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   326
  assumes a: "equivp R2"
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   327
  shows   "(Ball (Respects (R1 ===> R2)) (\<lambda>f. P (f x)) = All (\<lambda>f. P (f x)))"
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   328
  apply(rule iffI)
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   329
  apply(rule allI)
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   330
  apply(drule_tac x="\<lambda>y. f x" in bspec)
605
120e479ed367 first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
parents: 597
diff changeset
   331
  apply(simp add: in_respects)
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   332
  apply(rule impI)
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   333
  using a equivp_reflp_symp_transp[of "R2"]
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   334
  apply(simp add: reflp_def)
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   335
  apply(simp)
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   336
  apply(simp)
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   337
  done
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   338
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   339
lemma bex_reg_eqv_range:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   340
  assumes a: "equivp R2"
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   341
  shows   "(Bex (Respects (R1 ===> R2)) (\<lambda>f. P (f x)) = Ex (\<lambda>f. P (f x)))"
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   342
  apply(auto)
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   343
  apply(rule_tac x="\<lambda>y. f x" in bexI)
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   344
  apply(simp)
542
fe468f8723fc More cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 541
diff changeset
   345
  apply(simp add: Respects_def in_respects)
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   346
  apply(rule impI)
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   347
  using a equivp_reflp_symp_transp[of "R2"]
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   348
  apply(simp add: reflp_def)
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   349
  done
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   350
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   351
lemma all_reg:
96
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   352
  assumes a: "!x :: 'a. (P x --> Q x)"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   353
  and     b: "All P"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   354
  shows "All Q"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   355
  using a b by (metis)
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   356
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   357
lemma ex_reg:
96
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   358
  assumes a: "!x :: 'a. (P x --> Q x)"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   359
  and     b: "Ex P"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   360
  shows "Ex Q"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   361
  using a b by metis
96
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   362
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   363
lemma ball_reg:
96
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   364
  assumes a: "!x :: 'a. (R x --> P x --> Q x)"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   365
  and     b: "Ball R P"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   366
  shows "Ball R Q"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   367
  using a b by (metis COMBC_def Collect_def Collect_mem_eq)
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   368
427
5a3965aa4d80 Cleaned all lemmas about regularisation of Ball and Bex and moved in one place. Second Ball simprox.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 416
diff changeset
   369
lemma bex_reg:
96
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   370
  assumes a: "!x :: 'a. (R x --> P x --> Q x)"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   371
  and     b: "Bex R P"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   372
  shows "Bex R Q"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   373
  using a b by (metis COMBC_def Collect_def Collect_mem_eq)
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   374
432
9c33c0809733 Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 427
diff changeset
   375
lemma ball_all_comm:
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   376
  assumes "\<And>y. (\<forall>x\<in>P. A x y) \<longrightarrow> (\<forall>x. B x y)"
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   377
  shows "(\<forall>x\<in>P. \<forall>y. A x y) \<longrightarrow> (\<forall>x. \<forall>y. B x y)"
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   378
  using assms by auto
432
9c33c0809733 Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 427
diff changeset
   379
9c33c0809733 Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 427
diff changeset
   380
lemma bex_ex_comm:
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   381
  assumes "(\<exists>y. \<exists>x. A x y) \<longrightarrow> (\<exists>y. \<exists>x\<in>P. B x y)"
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   382
  shows "(\<exists>x. \<exists>y. A x y) \<longrightarrow> (\<exists>x\<in>P. \<exists>y. B x y)"
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   383
  using assms by auto
96
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   384
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   385
section {* Bounded abstraction *}
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   386
595
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   387
definition
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   388
  Babs :: "('a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b"
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   389
where
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
   390
  "x \<in> p \<Longrightarrow> Babs p m x = m x"
595
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   391
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   392
lemma babs_rsp:
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   393
  assumes q: "Quotient R1 Abs1 Rep1"
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   394
  and     a: "(R1 ===> R2) f g"
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   395
  shows      "(R1 ===> R2) (Babs (Respects R1) f) (Babs (Respects R1) g)"
1125
68b8ebcc5240 cleaned a bit
Christian Urban <urbanc@in.tum.de>
parents: 1123
diff changeset
   396
  apply (auto simp add: Babs_def in_respects)
595
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   397
  apply (subgoal_tac "x \<in> Respects R1 \<and> y \<in> Respects R1")
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   398
  using a apply (simp add: Babs_def)
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   399
  apply (simp add: in_respects)
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   400
  using Quotient_rel[OF q]
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   401
  by metis
a2f2214dc881 Fix of regularize for babs and proof of babs_rsp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 593
diff changeset
   402
607
a8c3fa5c4015 babs_prs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 605
diff changeset
   403
lemma babs_prs:
a8c3fa5c4015 babs_prs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 605
diff changeset
   404
  assumes q1: "Quotient R1 Abs1 Rep1"
a8c3fa5c4015 babs_prs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 605
diff changeset
   405
  and     q2: "Quotient R2 Abs2 Rep2"
927
04ef4bd3b936 more eq_reflection & other cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 926
diff changeset
   406
  shows "((Rep1 ---> Abs2) (Babs (Respects R1) ((Abs1 ---> Rep2) f))) = f"
04ef4bd3b936 more eq_reflection & other cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 926
diff changeset
   407
  apply (rule ext)
04ef4bd3b936 more eq_reflection & other cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 926
diff changeset
   408
  apply (simp)
607
a8c3fa5c4015 babs_prs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 605
diff changeset
   409
  apply (subgoal_tac "Rep1 x \<in> Respects R1")
a8c3fa5c4015 babs_prs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 605
diff changeset
   410
  apply (simp add: Babs_def Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2])
a8c3fa5c4015 babs_prs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 605
diff changeset
   411
  apply (simp add: in_respects Quotient_rel_rep[OF q1])
a8c3fa5c4015 babs_prs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 605
diff changeset
   412
  done
a8c3fa5c4015 babs_prs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 605
diff changeset
   413
696
fd718dde1d61 Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 674
diff changeset
   414
lemma babs_simp:
fd718dde1d61 Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 674
diff changeset
   415
  assumes q: "Quotient R1 Abs Rep"
fd718dde1d61 Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 674
diff changeset
   416
  shows "((R1 ===> R2) (Babs (Respects R1) f) (Babs (Respects R1) g)) = ((R1 ===> R2) f g)"
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   417
  apply(rule iffI)
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   418
  apply(simp_all only: babs_rsp[OF q])
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   419
  apply(auto simp add: Babs_def)
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   420
  apply (subgoal_tac "x \<in> Respects R1 \<and> y \<in> Respects R1")
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   421
  apply(metis Babs_def)
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   422
  apply (simp add: in_respects)
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   423
  using Quotient_rel[OF q]
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   424
  by metis
696
fd718dde1d61 Simplification of Babses for regularize; will probably become injection
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 674
diff changeset
   425
841
8e44ce29f974 added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents: 825
diff changeset
   426
(* If a user proves that a particular functional relation 
8e44ce29f974 added an abbreviation for OOO
Christian Urban <urbanc@in.tum.de>
parents: 825
diff changeset
   427
   is an equivalence this may be useful in regularising *)
605
120e479ed367 first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
parents: 597
diff changeset
   428
lemma babs_reg_eqv:
120e479ed367 first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
parents: 597
diff changeset
   429
  shows "equivp R \<Longrightarrow> Babs (Respects R) P = P"
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   430
  by (simp add: expand_fun_eq Babs_def in_respects equivp_reflp)
605
120e479ed367 first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
parents: 597
diff changeset
   431
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   432
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   433
(* 3 lemmas needed for proving repabs_inj *)
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   434
lemma ball_rsp:
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   435
  assumes a: "(R ===> (op =)) f g"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   436
  shows "Ball (Respects R) f = Ball (Respects R) g"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   437
  using a by (simp add: Ball_def in_respects)
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   438
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   439
lemma bex_rsp:
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   440
  assumes a: "(R ===> (op =)) f g"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   441
  shows "(Bex (Respects R) f = Bex (Respects R) g)"
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   442
  using a by (simp add: Bex_def in_respects)
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   443
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   444
lemma bex1_rsp:
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   445
  assumes a: "(R ===> (op =)) f g"
1074
7a42cc191111 Fixes for Bex1 removal.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 980
diff changeset
   446
  shows "Ex1 (\<lambda>x. x \<in> Respects R \<and> f x) = Ex1 (\<lambda>x. x \<in> Respects R \<and> g x)"
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   447
  using a 
1116
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   448
  by (simp add: Ex1_def in_respects) auto
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   449
1116
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   450
(* 2 lemmas needed for cleaning of quantifiers *)
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   451
lemma all_prs:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   452
  assumes a: "Quotient R absf repf"
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   453
  shows "Ball (Respects R) ((absf ---> id) f) = All f"
913
b1f55dd64481 Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 910
diff changeset
   454
  using a unfolding Quotient_def Ball_def in_respects fun_map_def id_apply
1116
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   455
  by metis
162
20f0b148cfe2 eqsubst_tac
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 155
diff changeset
   456
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   457
lemma ex_prs:
528
f51e2b3e3149 Naming changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 527
diff changeset
   458
  assumes a: "Quotient R absf repf"
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   459
  shows "Bex (Respects R) ((absf ---> id) f) = Ex f"
913
b1f55dd64481 Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 910
diff changeset
   460
  using a unfolding Quotient_def Bex_def in_respects fun_map_def id_apply
b1f55dd64481 Changed fun_map and rel_map to definitions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 910
diff changeset
   461
  by metis
171
13aab4c59096 More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 166
diff changeset
   462
980
9d35c6145dd2 Renamed Bexeq to Bex1_rel
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 946
diff changeset
   463
section {* Bex1_rel quantifier *}
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   464
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   465
definition
980
9d35c6145dd2 Renamed Bexeq to Bex1_rel
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 946
diff changeset
   466
  Bex1_rel :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool"
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   467
where
1122
d1eaed018e5d Changes from Makarius's code review + some noticed fixes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1116
diff changeset
   468
  "Bex1_rel R P \<longleftrightarrow> (\<exists>x \<in> Respects R. P x) \<and> (\<forall>x \<in> Respects R. \<forall>y \<in> Respects R. ((P x \<and> P y) \<longrightarrow> (R x y)))"
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   469
1116
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   470
lemma bex1_rel_aux:
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   471
  "\<lbrakk>\<forall>xa ya. R xa ya \<longrightarrow> x xa = y ya; Bex1_rel R x\<rbrakk> \<Longrightarrow> Bex1_rel R y"
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   472
  unfolding Bex1_rel_def
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   473
  apply (erule conjE)+
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   474
  apply (erule bexE)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   475
  apply rule
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   476
  apply (rule_tac x="xa" in bexI)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   477
  apply metis
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   478
  apply metis
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   479
  apply rule+
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   480
  apply (erule_tac x="xaa" in ballE)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   481
  prefer 2
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   482
  apply (metis)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   483
  apply (erule_tac x="ya" in ballE)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   484
  prefer 2
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   485
  apply (metis)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   486
  apply (metis in_respects)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   487
  done
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   488
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   489
lemma bex1_rel_aux2:
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   490
  "\<lbrakk>\<forall>xa ya. R xa ya \<longrightarrow> x xa = y ya; Bex1_rel R y\<rbrakk> \<Longrightarrow> Bex1_rel R x"
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   491
  unfolding Bex1_rel_def
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   492
  apply (erule conjE)+
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   493
  apply (erule bexE)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   494
  apply rule
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   495
  apply (rule_tac x="xa" in bexI)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   496
  apply metis
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   497
  apply metis
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   498
  apply rule+
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   499
  apply (erule_tac x="xaa" in ballE)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   500
  prefer 2
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   501
  apply (metis)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   502
  apply (erule_tac x="ya" in ballE)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   503
  prefer 2
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   504
  apply (metis)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   505
  apply (metis in_respects)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   506
  done
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   507
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   508
lemma bex1_rel_rsp:
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   509
  assumes a: "Quotient R absf repf"
980
9d35c6145dd2 Renamed Bexeq to Bex1_rel
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 946
diff changeset
   510
  shows "((R ===> op =) ===> op =) (Bex1_rel R) (Bex1_rel R)"
1116
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   511
  apply simp
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   512
  apply clarify
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   513
  apply rule
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   514
  apply (simp_all add: bex1_rel_aux bex1_rel_aux2)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   515
  apply (erule bex1_rel_aux2)
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   516
  apply assumption
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   517
  done
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   518
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   519
908
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   520
lemma ex1_prs:
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   521
  assumes a: "Quotient R absf repf"
980
9d35c6145dd2 Renamed Bexeq to Bex1_rel
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 946
diff changeset
   522
  shows "((absf ---> id) ---> id) (Bex1_rel R) f = Ex1 f"
910
b91782991dc8 Automatic cleaning of Bexeq<->Ex1 theorems.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 909
diff changeset
   523
apply simp
980
9d35c6145dd2 Renamed Bexeq to Bex1_rel
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 946
diff changeset
   524
apply (subst Bex1_rel_def)
908
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   525
apply (subst Bex_def)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   526
apply (subst Ex1_def)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   527
apply simp
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   528
apply rule
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   529
 apply (erule conjE)+
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   530
 apply (erule_tac exE)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   531
 apply (erule conjE)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   532
 apply (subgoal_tac "\<forall>y. R y y \<longrightarrow> f (absf y) \<longrightarrow> R x y")
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   533
  apply (rule_tac x="absf x" in exI)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   534
  apply (simp)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   535
  apply rule+
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   536
  using a unfolding Quotient_def
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   537
  apply metis
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   538
 apply rule+
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   539
 apply (erule_tac x="x" in ballE)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   540
  apply (erule_tac x="y" in ballE)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   541
   apply simp
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   542
  apply (simp add: in_respects)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   543
 apply (simp add: in_respects)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   544
apply (erule_tac exE)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   545
 apply rule
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   546
 apply (rule_tac x="repf x" in exI)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   547
 apply (simp only: in_respects)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   548
  apply rule
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   549
 apply (metis Quotient_rel_rep[OF a])
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   550
using a unfolding Quotient_def apply (simp)
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   551
apply rule+
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   552
using a unfolding Quotient_def in_respects
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   553
apply metis
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   554
done
1bf4337919d3 Bexeq definition, Ex1_prs lemma, Bex1_rsp lemma, compiles.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 891
diff changeset
   555
980
9d35c6145dd2 Renamed Bexeq to Bex1_rel
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 946
diff changeset
   556
lemma bex1_bexeq_reg: "(\<exists>!x\<in>Respects R. P x) \<longrightarrow> (Bex1_rel R (\<lambda>x. P x))"
1074
7a42cc191111 Fixes for Bex1 removal.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 980
diff changeset
   557
  apply (simp add: Ex1_def Bex1_rel_def in_respects)
946
46cc6708c3b3 Bex1_Bexeq_regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 936
diff changeset
   558
  apply clarify
46cc6708c3b3 Bex1_Bexeq_regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 936
diff changeset
   559
  apply auto
46cc6708c3b3 Bex1_Bexeq_regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 936
diff changeset
   560
  apply (rule bexI)
46cc6708c3b3 Bex1_Bexeq_regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 936
diff changeset
   561
  apply assumption
46cc6708c3b3 Bex1_Bexeq_regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 936
diff changeset
   562
  apply (simp add: in_respects)
46cc6708c3b3 Bex1_Bexeq_regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 936
diff changeset
   563
  apply (simp add: in_respects)
46cc6708c3b3 Bex1_Bexeq_regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 936
diff changeset
   564
  apply auto
46cc6708c3b3 Bex1_Bexeq_regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 936
diff changeset
   565
  done
46cc6708c3b3 Bex1_Bexeq_regular.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 936
diff changeset
   566
921
dae038c8cd69 properly commented out the "unused lemmas section" and moved actually used lemmas elsewhere; added two minor items to the TODO list
Christian Urban <urbanc@in.tum.de>
parents: 920
diff changeset
   567
section {* Various respects and preserve lemmas *}
697
57944c1ef728 Regularized the hard lemma.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 696
diff changeset
   568
554
8395fc6a6945 Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 546
diff changeset
   569
lemma quot_rel_rsp:
8395fc6a6945 Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 546
diff changeset
   570
  assumes a: "Quotient R Abs Rep"
8395fc6a6945 Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 546
diff changeset
   571
  shows "(R ===> R ===> op =) R R"
8395fc6a6945 Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 546
diff changeset
   572
  apply(rule fun_rel_id)+
8395fc6a6945 Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 546
diff changeset
   573
  apply(rule equals_rsp[OF a])
8395fc6a6945 Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 546
diff changeset
   574
  apply(assumption)+
8395fc6a6945 Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 546
diff changeset
   575
  done
8395fc6a6945 Solutions to IntEx tests.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 546
diff changeset
   576
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   577
lemma o_prs:
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   578
  assumes q1: "Quotient R1 Abs1 Rep1"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   579
  and     q2: "Quotient R2 Abs2 Rep2"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   580
  and     q3: "Quotient R3 Abs3 Rep3"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   581
  shows "(Rep1 ---> Abs3) (((Abs2 ---> Rep3) f) o ((Abs1 ---> Rep2) g)) = f o g"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   582
  using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] Quotient_abs_rep[OF q3]
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   583
  unfolding o_def expand_fun_eq by simp
541
94deffed619d more name cleaning and removing
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 540
diff changeset
   584
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   585
lemma o_rsp:
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   586
  assumes q1: "Quotient R1 Abs1 Rep1"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   587
  and     q2: "Quotient R2 Abs2 Rep2"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   588
  and     q3: "Quotient R3 Abs3 Rep3"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   589
  and     a1: "(R2 ===> R3) f1 f2"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   590
  and     a2: "(R1 ===> R2) g1 g2"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   591
  shows "(R1 ===> R3) (f1 o g1) (f2 o g2)"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   592
  using a1 a2 unfolding o_def expand_fun_eq
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   593
  by (auto)
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   594
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   595
lemma cond_prs:
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   596
  assumes a: "Quotient R absf repf"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   597
  shows "absf (if a then repf b else repf c) = (if a then b else c)"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   598
  using a unfolding Quotient_def by auto
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   599
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   600
lemma if_prs:
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   601
  assumes q: "Quotient R Abs Rep"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   602
  shows "Abs (If a (Rep b) (Rep c)) = If a b c"
1116
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   603
  using Quotient_abs_rep[OF q] by auto
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   604
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   605
(* q not used *)
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   606
lemma if_rsp:
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   607
  assumes q: "Quotient R Abs Rep"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   608
  and     a: "a1 = a2" "R b1 b2" "R c1 c2"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   609
  shows "R (If a1 b1 c1) (If a2 b2 c2)"
1116
3acc7d25627a Some cleaning of proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1074
diff changeset
   610
  using a by auto
721
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   611
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   612
lemma let_prs:
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   613
  assumes q1: "Quotient R1 Abs1 Rep1"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   614
  and     q2: "Quotient R2 Abs2 Rep2"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   615
  shows "Abs2 (Let (Rep1 x) ((Abs1 ---> Rep2) f)) = Let x f"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   616
  using Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2] by auto
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   617
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   618
lemma let_rsp:
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   619
  assumes q1: "Quotient R1 Abs1 Rep1"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   620
  and     a1: "(R1 ===> R2) f g"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   621
  and     a2: "R1 x y"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   622
  shows "R2 ((Let x f)::'c) ((Let y g)::'c)"
19032e71fb1c More name and indentation cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 700
diff changeset
   623
  using apply_rsp[OF q1 a1] a2 by auto
543
d030c8e19465 Cleaning/review of QuotScript.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 542
diff changeset
   624
93
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   625
end
95
8c3a35da4560 Proving the proper RepAbs version
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 93
diff changeset
   626