QuotScript.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Fri, 04 Dec 2009 10:12:17 +0100
changeset 516 bed81795848c
parent 515 b00a9b58264d
child 519 ebfd747b47ab
permissions -rw-r--r--
Using APPLY_RSP1; again a little bit faster.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory QuotScript
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
imports Main
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
definition 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
  "EQUIV E \<equiv> \<forall>x y. E x y = (E x = E y)" 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
definition
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
  "REFL E \<equiv> \<forall>x. E x x"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
definition 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
  "SYM E \<equiv> \<forall>x y. E x y \<longrightarrow> E y x"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
definition
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
  "TRANS E \<equiv> \<forall>x y z. E x y \<and> E y z \<longrightarrow> E x z"
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
lemma EQUIV_REFL_SYM_TRANS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
  shows "EQUIV E = (REFL E \<and> SYM E \<and> TRANS E)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
unfolding EQUIV_def REFL_def SYM_def TRANS_def expand_fun_eq
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
by (blast)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 188
diff changeset
    22
lemma EQUIV_REFL:
416
3f3927f793d4 Removing arguments of tactics: absrep, rel_refl, reps_same are computed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 396
diff changeset
    23
  shows "EQUIV E \<Longrightarrow> (\<And>x. E x x)"
3f3927f793d4 Removing arguments of tactics: absrep, rel_refl, reps_same are computed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 396
diff changeset
    24
  by (simp add: EQUIV_REFL_SYM_TRANS REFL_def)
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 188
diff changeset
    25
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
definition
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  "PART_EQUIV E \<equiv> (\<exists>x. E x x) \<and> (\<forall>x y. E x y = (E x x \<and> E y y \<and> (E x = E y)))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
lemma EQUIV_IMP_PART_EQUIV:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
  assumes a: "EQUIV E"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
  shows "PART_EQUIV E"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
using a unfolding EQUIV_def PART_EQUIV_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
by auto
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
definition
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  "QUOTIENT E Abs Rep \<equiv> (\<forall>a. Abs (Rep a) = a) \<and> 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
                        (\<forall>a. E (Rep a) (Rep a)) \<and> 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
                        (\<forall>r s. E r s = (E r r \<and> E s s \<and> (Abs r = Abs s)))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
lemma QUOTIENT_ABS_REP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
  assumes a: "QUOTIENT E Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
  shows "Abs (Rep a) = a" 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
using a unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
by simp
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
lemma QUOTIENT_REP_REFL:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
  assumes a: "QUOTIENT E Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  shows "E (Rep a) (Rep a)" 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
using a unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
by blast
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
lemma QUOTIENT_REL:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  assumes a: "QUOTIENT E Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
  shows " E r s = (E r r \<and> E s s \<and> (Abs r = Abs s))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
using a unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
by blast
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
lemma QUOTIENT_REL_ABS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
  assumes a: "QUOTIENT E Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
  shows "E r s \<Longrightarrow> Abs r = Abs s"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
using a unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
by blast
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
lemma QUOTIENT_REL_ABS_EQ:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
  assumes a: "QUOTIENT E Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
  shows "E r r \<Longrightarrow> E s s \<Longrightarrow> E r s = (Abs r = Abs s)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
using a unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
by blast
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
lemma QUOTIENT_REL_REP:
459
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
    71
  assumes a: "QUOTIENT R Abs Rep"
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
    72
  shows "R (Rep a) (Rep b) = (a = b)"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
using a unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
by metis
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
lemma QUOTIENT_REP_ABS:
459
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
    77
  assumes a: "QUOTIENT R Abs Rep"
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
    78
  shows "R r r \<Longrightarrow> R (Rep (Abs r)) r"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
using a unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
by blast
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
lemma IDENTITY_EQUIV:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
  shows "EQUIV (op =)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
unfolding EQUIV_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
by auto
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
lemma IDENTITY_QUOTIENT:
126
9cb8f9a59402 Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 113
diff changeset
    88
  shows "QUOTIENT (op =) id id"
9cb8f9a59402 Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 113
diff changeset
    89
unfolding QUOTIENT_def id_def
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
by blast
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
lemma QUOTIENT_SYM:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
  assumes a: "QUOTIENT E Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
  shows "SYM E"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
using a unfolding QUOTIENT_def SYM_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
by metis
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
lemma QUOTIENT_TRANS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
  assumes a: "QUOTIENT E Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
  shows "TRANS E"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
using a unfolding QUOTIENT_def TRANS_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
by metis
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
fun
93
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   105
  prod_rel
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   106
where
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   107
  "prod_rel r1 r2 = (\<lambda>(a,b) (c,d). r1 a c \<and> r2 b d)"
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   108
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   109
fun
112
0d6d37d0589d Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 96
diff changeset
   110
  fun_map
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
where
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
  "fun_map f g h x = g (h (f x))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
112
0d6d37d0589d Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 96
diff changeset
   114
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
abbreviation
112
0d6d37d0589d Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 96
diff changeset
   116
  fun_map_syn (infixr "--->" 55)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
where
112
0d6d37d0589d Progressing with the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 96
diff changeset
   118
  "f ---> g \<equiv> fun_map f g"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
lemma FUN_MAP_I:
126
9cb8f9a59402 Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 113
diff changeset
   121
  shows "(id ---> id) = id"
9cb8f9a59402 Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 113
diff changeset
   122
by (simp add: expand_fun_eq id_def)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
lemma IN_FUN:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
  shows "x \<in> ((f ---> g) s) = g (f x \<in> s)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
by (simp add: mem_def)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
fun
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
  FUN_REL 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
where
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
  "FUN_REL E1 E2 f g = (\<forall>x y. E1 x y \<longrightarrow> E2 (f x) (g y))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
abbreviation
228
268a727b0f10 disambiguate ===> syntax
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 217
diff changeset
   134
  FUN_REL_syn (infixr "===>" 55)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
where
228
268a727b0f10 disambiguate ===> syntax
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 217
diff changeset
   136
  "E1 ===> E2 \<equiv> FUN_REL E1 E2"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
lemma FUN_REL_EQ:
511
28bb34eeedc5 Changing = to \<equiv> in case if we want to use simp.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 459
diff changeset
   139
  "(op =) ===> (op =) \<equiv> (op =)"
515
b00a9b58264d Fixes after big merge.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 511
diff changeset
   140
by (rule eq_reflection) (simp add: expand_fun_eq)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
lemma FUN_QUOTIENT:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
  assumes q1: "QUOTIENT R1 abs1 rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
  and     q2: "QUOTIENT R2 abs2 rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
  shows "QUOTIENT (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
proof -
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
  have "\<forall>a. (rep1 ---> abs2) ((abs1 ---> rep2) a) = a"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
    apply(simp add: expand_fun_eq)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
    using q1 q2
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
    apply(simp add: QUOTIENT_def)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
    done
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
  moreover
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
  have "\<forall>a. (R1 ===> R2) ((abs1 ---> rep2) a) ((abs1 ---> rep2) a)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
    apply(auto)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
    using q1 q2 unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
    apply(metis)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
    done
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
  moreover
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
  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
   160
        (rep1 ---> abs2) r  = (rep1 ---> abs2) s)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
    apply(auto simp add: expand_fun_eq)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
    using q1 q2 unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
    apply(metis)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
    using q1 q2 unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
    apply(metis)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
    using q1 q2 unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
    apply(metis)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
    using q1 q2 unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
    apply(metis)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
    done
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
  ultimately
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
  show "QUOTIENT (R1 ===> R2) (rep1 ---> abs2) (abs1 ---> rep2)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
    unfolding QUOTIENT_def by blast
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
qed
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
definition
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
  Respects
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
where
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
  "Respects R x \<equiv> (R x x)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
lemma IN_RESPECTS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
  shows "(x \<in> Respects R) = R x x"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
unfolding mem_def Respects_def by simp
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
lemma RESPECTS_THM:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
  shows "Respects (R1 ===> R2) f = (\<forall>x y. R1 x y \<longrightarrow> R2 (f x) (f y))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
unfolding Respects_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
by (simp add: expand_fun_eq) 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
lemma RESPECTS_MP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
  assumes a: "Respects (R1 ===> R2) f"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
  and     b: "R1 x y"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
  shows "R2 (f x) (f y)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
using a b unfolding Respects_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
by simp
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
lemma RESPECTS_REP_ABS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
  assumes a: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
  and     b: "Respects (R1 ===> R2) f"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
  and     c: "R1 x x"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
  shows "R2 (f (Rep1 (Abs1 x))) (f x)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
using a b[simplified RESPECTS_THM] c unfolding QUOTIENT_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
by blast
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
lemma RESPECTS_o:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
  assumes a: "Respects (R2 ===> R3) f"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
  and     b: "Respects (R1 ===> R2) g"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
  shows "Respects (R1 ===> R3) (f o g)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
using a b unfolding Respects_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
by simp
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
(*
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
definition
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
  "RES_EXISTS_EQUIV R P \<equiv> (\<exists>x \<in> Respects R. P x) \<and> 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
                          (\<forall>x\<in> Respects R. \<forall>y\<in> Respects R. P x \<and> P y \<longrightarrow> R x y)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
*)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
lemma FUN_REL_EQ_REL:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
  shows "(R1 ===> R2) f g = ((Respects (R1 ===> R2) f) \<and> (Respects (R1 ===> R2) g) 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
                             \<and> ((Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
using FUN_QUOTIENT[OF q1 q2] unfolding Respects_def QUOTIENT_def expand_fun_eq
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
by blast
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   225
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   226
(* TODO: it is the same as APPLY_RSP *)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
(* q1 and q2 not used; see next lemma *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
lemma FUN_REL_MP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
  shows "(R1 ===> R2) f g \<Longrightarrow> R1 x y \<Longrightarrow> R2 (f x) (g y)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
by simp
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   233
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
lemma FUN_REL_IMP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
  shows "(R1 ===> R2) f g \<Longrightarrow> R1 x y \<Longrightarrow> R2 (f x) (g y)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
by simp
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
lemma FUN_REL_EQUALS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241
  and     r1: "Respects (R1 ===> R2) f"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
  and     r2: "Respects (R1 ===> R2) g" 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
  shows "((Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g) = (\<forall>x y. R1 x y \<longrightarrow> R2 (f x) (g y))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
apply(rule_tac iffI)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
using FUN_QUOTIENT[OF q1 q2] r1 r2 unfolding QUOTIENT_def Respects_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
apply(metis FUN_REL_IMP)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
using r1 unfolding Respects_def expand_fun_eq
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
apply(simp (no_asm_use))
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   249
apply(metis QUOTIENT_REL[OF q2] QUOTIENT_REL_REP[OF q1])
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
done
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   252
(* ask Peter: FUN_REL_IMP used twice *) 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
lemma FUN_REL_IMP2:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   256
  and     r1: "Respects (R1 ===> R2) f"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   257
  and     r2: "Respects (R1 ===> R2) g" 
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   258
  and     a:  "(Rep1 ---> Abs2) f = (Rep1 ---> Abs2) g"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   259
  shows "R1 x y \<Longrightarrow> R2 (f x) (g y)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   260
using q1 q2 r1 r2 a
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   261
by (simp add: FUN_REL_EQUALS)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
459
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   263
(* We don't use it, it is exactly the same as QUOTIENT_REL_REP but wrong way *)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
lemma EQUALS_PRS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
  assumes q: "QUOTIENT R Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
  shows "(x = y) = R (Rep x) (Rep y)"
459
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   267
by (rule QUOTIENT_REL_REP[OF q, symmetric])
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
lemma EQUALS_RSP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
  assumes q: "QUOTIENT R Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
  and     a: "R x1 x2" "R y1 y2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
  shows "R x1 y1 = R x2 y2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
using QUOTIENT_SYM[OF q] QUOTIENT_TRANS[OF q] unfolding SYM_def TRANS_def
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
using a by blast
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
lemma LAMBDA_PRS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
  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
   279
  shows "(Rep1 ---> Abs2) (\<lambda>x. Rep2 (f (Abs1 x))) = (\<lambda>x. f x)"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280
unfolding expand_fun_eq
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   281
using QUOTIENT_ABS_REP[OF q1] QUOTIENT_ABS_REP[OF q2]
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   282
by simp
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   284
lemma LAMBDA_PRS1:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   285
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
  shows "(\<lambda>x. f x) = (Rep1 ---> Abs2) (\<lambda>x. (Abs1 ---> Rep2) f x)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
unfolding expand_fun_eq
253
e169a99c6ada Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 252
diff changeset
   289
using QUOTIENT_ABS_REP[OF q1] QUOTIENT_ABS_REP[OF q2]
459
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   290
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
   291
459
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   292
(* Not used since applic_prs proves a version for an arbitrary number of arguments *)
253
e169a99c6ada Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 252
diff changeset
   293
lemma APP_PRS:
e169a99c6ada Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 252
diff changeset
   294
  assumes q1: "QUOTIENT R1 abs1 rep1"
e169a99c6ada Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 252
diff changeset
   295
  and     q2: "QUOTIENT R2 abs2 rep2"
e169a99c6ada Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 252
diff changeset
   296
  shows "abs2 ((abs1 ---> rep2) f (rep1 x)) = f x"
e169a99c6ada Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 252
diff changeset
   297
unfolding expand_fun_eq
e169a99c6ada Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 252
diff changeset
   298
using QUOTIENT_ABS_REP[OF q1] QUOTIENT_ABS_REP[OF q2]
e169a99c6ada Automatic computation of application preservation and manually finished "alpha.induct". Slow...
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 252
diff changeset
   299
by simp
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
(* Ask Peter: assumption q1 and q2 not used and lemma is the 'identity' *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
lemma LAMBDA_RSP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   303
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
  and     a: "(R1 ===> R2) f1 f2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
  shows "(R1 ===> R2) (\<lambda>x. f1 x) (\<lambda>y. f2 y)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   307
by (rule a)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   308
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   309
(* ASK Peter about next four lemmas in quotientScript
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   310
lemma ABSTRACT_PRS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   311
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   312
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   313
  shows "f = (Rep1 ---> Abs2) ???"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   314
*)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   316
lemma LAMBDA_REP_ABS_RSP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   317
  assumes r1: "\<And>r r'. R1 r r' \<Longrightarrow>R1 r (Rep1 (Abs1 r'))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   318
  and     r2: "\<And>r r'. R2 r r' \<Longrightarrow>R2 r (Rep2 (Abs2 r'))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   319
  shows "(R1 ===> R2) f1 f2 \<Longrightarrow> (R1 ===> R2) f1 ((Abs1 ---> Rep2) ((Rep1 ---> Abs2) f2))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   320
using r1 r2 by auto
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   321
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   322
lemma REP_ABS_RSP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   323
  assumes q: "QUOTIENT R Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   324
  and     a: "R x1 x2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   325
  shows "R x1 (Rep (Abs x2))"
459
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   326
using q a by (metis QUOTIENT_REL[OF q] QUOTIENT_ABS_REP[OF q] QUOTIENT_REP_REFL[OF q])
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   327
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   328
(* Not used *)
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   329
lemma REP_ABS_RSP_LEFT:
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   330
  assumes q: "QUOTIENT R Abs Rep"
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   331
  and     a: "R x1 x2"
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   332
  shows "R x1 (Rep (Abs x2))"
516
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   333
using q a by (metis QUOTIENT_REL[OF q] QUOTIENT_ABS_REP[OF q] QUOTIENT_REP_REFL[OF q])
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
(* ----------------------------------------------------- *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
(* Quantifiers: FORALL, EXISTS, EXISTS_UNIQUE,           *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   337
(*              RES_FORALL, RES_EXISTS, RES_EXISTS_EQUIV *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   338
(* ----------------------------------------------------- *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   339
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   340
(* bool theory: COND, LET *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   341
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
lemma IF_PRS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
  assumes q: "QUOTIENT R Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
  shows "If a b c = Abs (If a (Rep b) (Rep c))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   345
using QUOTIENT_ABS_REP[OF q] by auto
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   346
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
(* ask peter: no use of q *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   348
lemma IF_RSP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   349
  assumes q: "QUOTIENT R Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
  and     a: "a1 = a2" "R b1 b2" "R c1 c2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
  shows "R (If a1 b1 c1) (If a2 b2 c2)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
using a by auto
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   354
lemma LET_PRS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   356
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   357
  shows "Let x f = Abs2 (Let (Rep1 x) ((Abs1 ---> Rep2) f))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
using QUOTIENT_ABS_REP[OF q1] QUOTIENT_ABS_REP[OF q2] by auto
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
lemma LET_RSP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   361
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   362
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   363
  and     a1: "(R1 ===> R2) f g"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   364
  and     a2: "R1 x y"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   365
  shows "R2 (Let x f) (Let y g)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   366
using FUN_REL_MP[OF q1 q2 a1] a2
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   367
by auto
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   368
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   369
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   370
(* ask peter what are literal_case *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   371
(* literal_case_PRS *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   372
(* literal_case_RSP *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   373
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   374
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   375
(* FUNCTION APPLICATION *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   376
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   377
lemma APPLY_PRS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   378
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   379
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   380
  shows "f x = Abs2 (((Abs1 ---> Rep2) f) (Rep1 x))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   381
using QUOTIENT_ABS_REP[OF q1] QUOTIENT_ABS_REP[OF q2] by auto
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   382
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   383
(* ask peter: no use of q1 q2 *)
516
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   384
(* Cez: I can answer,
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   385
   In the following theorem R2 can be instantiated with anything,
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   386
   but we know some of the types of the Rep and Abs functions;
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   387
   so by solving QUOTIENT assumptions we can get a unique R2 that
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   388
   will be provable; which is why we need to use APPLY_RSP1 *)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
lemma APPLY_RSP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   390
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   392
  and     a: "(R1 ===> R2) f g" "R1 x y"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   393
  shows "R2 (f x) (g y)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   394
using a by (rule FUN_REL_IMP)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   395
516
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   396
lemma APPLY_RSP1:
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   397
  assumes q: "QUOTIENT R1 Abs1 Rep1"
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   398
  and     a: "(R1 ===> R2) f g" "R1 x y"
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   399
  shows "R2 ((f::'a\<Rightarrow>'c) x) ((g::'a\<Rightarrow>'c) y)"
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   400
using a by (rule FUN_REL_IMP)
bed81795848c Using APPLY_RSP1; again a little bit faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   401
317
d3c7f6d19c7f Still don't know how to do the proof automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 253
diff changeset
   402
lemma APPLY_RSP2:
d3c7f6d19c7f Still don't know how to do the proof automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 253
diff changeset
   403
  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
   404
  shows "R2 (f x) (g y)"
d3c7f6d19c7f Still don't know how to do the proof automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 253
diff changeset
   405
using a by (rule FUN_REL_IMP)
d3c7f6d19c7f Still don't know how to do the proof automatically.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 253
diff changeset
   406
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   407
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   408
(* combinators: I, K, o, C, W *)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   409
459
020e27417b59 More code cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 458
diff changeset
   410
(* We use id_simps which includes id_apply; so these 2 theorems can be removed *)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   411
lemma I_PRS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   412
  assumes q: "QUOTIENT R Abs Rep"
126
9cb8f9a59402 Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 113
diff changeset
   413
  shows "id e = Abs (id (Rep e))"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   414
using QUOTIENT_ABS_REP[OF q] by auto
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   415
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   416
lemma I_RSP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   417
  assumes q: "QUOTIENT R Abs Rep"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   418
  and     a: "R e1 e2"
126
9cb8f9a59402 Partial simplification of the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 113
diff changeset
   419
  shows "R (id e1) (id e2)"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   420
using a by auto
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   421
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   422
lemma o_PRS:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   423
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   424
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   425
  and     q3: "QUOTIENT R3 Abs3 Rep3"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   426
  shows "f o g = (Rep1 ---> Abs3) (((Abs2 ---> Rep3) f) o ((Abs1 ---> Rep2) g))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   427
using QUOTIENT_ABS_REP[OF q1] QUOTIENT_ABS_REP[OF q2] QUOTIENT_ABS_REP[OF q3]
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   428
unfolding o_def expand_fun_eq
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   429
by simp
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   430
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   431
lemma o_RSP:
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   432
  assumes q1: "QUOTIENT R1 Abs1 Rep1"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   433
  and     q2: "QUOTIENT R2 Abs2 Rep2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   434
  and     q3: "QUOTIENT R3 Abs3 Rep3"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   435
  and     a1: "(R2 ===> R3) f1 f2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   436
  and     a2: "(R1 ===> R2) g1 g2"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   437
  shows "(R1 ===> R3) (f1 o g1) (f2 o g2)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   438
using a1 a2 unfolding o_def expand_fun_eq
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   439
by (auto)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   440
96
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   441
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   442
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   443
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   444
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   445
lemma COND_PRS:
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   446
  assumes a: "QUOTIENT R absf repf"
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   447
  shows "(if a then b else c) = absf (if a then repf b else repf c)"
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   448
  using a unfolding QUOTIENT_def by auto
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   449
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   450
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   451
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   452
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   453
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
   454
(* Set of lemmas for regularisation of ball and bex *)
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
   455
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
   456
  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
   457
  assumes a: "EQUIV R"
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
   458
  shows "Ball (Respects R) P = (All P)"
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
   459
  by (metis EQUIV_def IN_RESPECTS a)
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
   460
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
   461
lemma bex_reg_eqv:
93
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   462
  fixes P :: "'a \<Rightarrow> bool"
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
   463
  assumes a: "EQUIV R"
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
   464
  shows "Bex (Respects R) P = (Ex P)"
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
   465
  by (metis EQUIV_def IN_RESPECTS a)
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
   466
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
   467
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
   468
  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
   469
  shows "All P \<longrightarrow> Ball R Q"
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
   470
  by (metis COMBC_def Collect_def Collect_mem_eq a)
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
   471
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
   472
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
   473
  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
   474
  shows "Bex R Q \<longrightarrow> Ex P"
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
   475
  by (metis COMBC_def Collect_def Collect_mem_eq a)
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
   476
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
   477
lemma ball_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
   478
  assumes a: "EQUIV R"
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
   479
  shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ball (Respects R) Q \<longrightarrow> All P"
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
   480
  by (metis EQUIV_REFL IN_RESPECTS a)
93
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   481
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
   482
lemma bex_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
   483
  assumes a: "EQUIV R"
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
   484
  shows "(\<And>x. (Q x \<longrightarrow> P x)) \<Longrightarrow> Ex Q \<longrightarrow> Bex (Respects R) P"
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
   485
  by (metis EQUIV_REFL IN_RESPECTS a)
93
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   486
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
   487
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
   488
  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
   489
  and x::"'a"
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
   490
  assumes a: "EQUIV R2"
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
   491
  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
   492
  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
   493
  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
   494
  apply(drule_tac x="\<lambda>y. f x" in bspec)
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
   495
  apply(simp add: Respects_def IN_RESPECTS)
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
   496
  apply(rule impI)
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
   497
  using a EQUIV_REFL_SYM_TRANS[of "R2"]
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
   498
  apply(simp add: REFL_def)
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
   499
  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
   500
  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
   501
  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
   502
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
   503
lemma bex_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
   504
  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
   505
  and x::"'a"
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
   506
  assumes a: "EQUIV R2"
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
   507
  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
   508
  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
   509
  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
   510
  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
   511
  apply(simp add: Respects_def IN_RESPECTS)
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
   512
  apply(rule impI)
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
   513
  using a EQUIV_REFL_SYM_TRANS[of "R2"]
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
   514
  apply(simp add: REFL_def)
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
   515
  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
   516
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
   517
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
   518
  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
   519
  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
   520
  shows "All Q"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   521
  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
   522
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
   523
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
   524
  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
   525
  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
   526
  shows "Ex Q"
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   527
  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
   528
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
   529
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
   530
  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
   531
  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
   532
  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
   533
  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
   534
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
   535
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
   536
  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
   537
  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
   538
  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
   539
  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
   540
432
9c33c0809733 Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 427
diff changeset
   541
lemma ball_all_comm:
9c33c0809733 Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 427
diff changeset
   542
  "(\<And>y. (\<forall>x\<in>P. A x y) \<longrightarrow> (\<forall>x. B x y)) \<Longrightarrow> ((\<forall>x\<in>P. \<forall>y. A x y) \<longrightarrow> (\<forall>x. \<forall>y. B x y))"
9c33c0809733 Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 427
diff changeset
   543
by auto
9c33c0809733 Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 427
diff changeset
   544
9c33c0809733 Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 427
diff changeset
   545
lemma bex_ex_comm:
9c33c0809733 Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 427
diff changeset
   546
  "((\<exists>y. \<exists>x. A x y) \<longrightarrow> (\<exists>y. \<exists>x\<in>P. B x y)) \<Longrightarrow> ((\<exists>x. \<exists>y. A x y) \<longrightarrow> (\<exists>x\<in>P. \<exists>y. B x y))"
9c33c0809733 Finished and tested the new regularize
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 427
diff changeset
   547
by auto
96
4da714704611 A number of lemmas for REGULARIZE_TAC and regularizing card1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 95
diff changeset
   548
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   549
(* 2 lemmas needed for proving repabs_inj *)
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   550
lemma ball_rsp:
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   551
  assumes a: "(R ===> (op =)) f g"
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   552
  shows "Ball (Respects R) f = Ball (Respects R) g"
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   553
  using a by (simp add: Ball_def IN_RESPECTS)
153
0288dd5b7ed4 The problems with 'abs' term.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 126
diff changeset
   554
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   555
lemma bex_rsp:
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   556
  assumes a: "(R ===> (op =)) f g"
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   557
  shows "(Bex (Respects R) f = Bex (Respects R) g)"
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   558
  using a by (simp add: Bex_def IN_RESPECTS)
171
13aab4c59096 More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 166
diff changeset
   559
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   560
(* 2 lemmas needed for cleaning of quantifiers *)
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   561
lemma all_prs:
162
20f0b148cfe2 eqsubst_tac
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 155
diff changeset
   562
  assumes a: "QUOTIENT R absf repf"
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   563
  shows "Ball (Respects R) ((absf ---> id) f) = All f"
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   564
  using a unfolding QUOTIENT_def
183
6acf9e001038 proved the two lemmas in QuotScript (reformulated them without leading forall)
Christian Urban <urbanc@in.tum.de>
parents: 173
diff changeset
   565
  by (metis IN_RESPECTS fun_map.simps id_apply)
162
20f0b148cfe2 eqsubst_tac
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 155
diff changeset
   566
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   567
lemma ex_prs:
187
f8fc085db38f Cleaning and fixing.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 183
diff changeset
   568
  assumes a: "QUOTIENT R absf repf"
458
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   569
  shows "Bex (Respects R) ((absf ---> id) f) = Ex f"
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   570
  using a unfolding QUOTIENT_def
44a70e69ef92 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 432
diff changeset
   571
  by (metis COMBC_def Collect_def Collect_mem_eq IN_RESPECTS fun_map.simps id_apply)
171
13aab4c59096 More infrastructure for automatic lifting of theorems lifted before
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 166
diff changeset
   572
93
ec29be471518 Manually regularized list_induct2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 0
diff changeset
   573
end
95
8c3a35da4560 Proving the proper RepAbs version
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 93
diff changeset
   574