QuotList.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Fri, 04 Dec 2009 15:50:57 +0100
changeset 537 57073b0b8fac
parent 533 4318ab0df27b
child 539 8287fb5b8d7a
permissions -rw-r--r--
Even more name changes and cleaning
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 QuotList
533
4318ab0df27b smaller theory footprint
Christian Urban <urbanc@in.tum.de>
parents: 529
diff changeset
     2
imports QuotScript List
0
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
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
     5
lemma LIST_map_id:
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
  shows "map (\<lambda>x. x) = (\<lambda>x. x)"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
  by simp
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
fun
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    10
  list_rel
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
where
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    12
  "list_rel R [] [] = True"
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    13
| "list_rel R (x#xs) [] = False"
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    14
| "list_rel R [] (x#xs) = False"
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    15
| "list_rel R (x#xs) (y#ys) = (R x y \<and> list_rel R xs ys)"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    17
lemma list_rel_EQ:
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    18
  shows "list_rel (op =) \<equiv> (op =)"
515
b00a9b58264d Fixes after big merge.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 511
diff changeset
    19
apply(rule eq_reflection)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
unfolding expand_fun_eq
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
apply(rule allI)+
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
apply(induct_tac x xa rule: list_induct2')
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
apply(simp_all)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
done
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    26
lemma list_rel_REFL:
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  assumes a: "\<And>x y. R x y = (R x = R y)"
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    28
  shows "list_rel R x x"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
by (induct x) (auto simp add: a)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    31
lemma LIST_equivp:
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    32
  assumes a: "equivp R"
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    33
  shows "equivp (list_rel R)"
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    34
unfolding equivp_def
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
apply(rule allI)+
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
apply(induct_tac x y rule: list_induct2')
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
apply(simp)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
apply(simp add: expand_fun_eq)
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    39
apply(metis list_rel.simps(1) list_rel.simps(2))
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
apply(simp add: expand_fun_eq)
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    41
apply(metis list_rel.simps(1) list_rel.simps(2))
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
apply(simp add: expand_fun_eq)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
apply(rule iffI)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
apply(rule allI)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
apply(case_tac x)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
apply(simp)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
apply(simp)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
using a
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    49
apply(unfold equivp_def)
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
apply(auto)[1]
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    51
apply(metis list_rel.simps(4))
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
done
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    54
lemma list_rel_REL: 
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    55
  assumes q: "Quotient R Abs Rep"
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    56
  shows "list_rel R r s = (list_rel R r r \<and> list_rel R s s \<and> (map Abs r = map Abs s))"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
apply(induct r s rule: list_induct2')
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
apply(simp_all)
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    59
using Quotient_REL[OF q]
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
apply(metis)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
done
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    63
lemma list_quotient:
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    64
  assumes q: "Quotient R Abs Rep"
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    65
  shows "Quotient (list_rel R) (map Abs) (map Rep)"
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    66
unfolding Quotient_def
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
apply(rule conjI)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
apply(rule allI)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
apply(induct_tac a)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
apply(simp)
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    71
apply(simp add: Quotient_ABS_REP[OF q])
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
apply(rule conjI)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
apply(rule allI)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
apply(induct_tac a)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
apply(simp)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
apply(simp)
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    77
apply(simp add: Quotient_REP_reflp[OF q])
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
apply(rule allI)+
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    79
apply(rule list_rel_REL[OF q])
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
done
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 CONS_PRS:
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    83
  assumes q: "Quotient R Abs Rep"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
  shows "(h#t) = (map Abs) ((Rep h)#(map Rep t))"
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    85
by (induct t) (simp_all add: Quotient_ABS_REP[OF q])
0
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 CONS_RSP:
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    88
  assumes q: "Quotient R Abs Rep"
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    89
  and     a: "R h1 h2" "list_rel R t1 t2"
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
    90
  shows "list_rel R (h1#t1) (h2#t2)"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
using a by (auto)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
lemma NIL_PRS:
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    94
  assumes q: "Quotient R Abs Rep"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
  shows "[] = (map Abs [])"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
by (simp)
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 NIL_RSP:
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
    99
  assumes q: "Quotient R Abs Rep"
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
   100
  shows "list_rel R [] []"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
by simp
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
lemma MAP_PRS:
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   104
  assumes q1: "Quotient R1 Abs1 Rep1"
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   105
  and     q2: "Quotient R2 Abs2 Rep2"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
  shows "map f l = (map Abs2) (map ((Abs1 ---> Rep2) f) (map Rep1 l))"
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
by (induct l)
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   108
   (simp_all add: Quotient_ABS_REP[OF q1] Quotient_ABS_REP[OF q2])
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
lemma MAP_RSP:
529
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   111
  assumes q1: "Quotient R1 Abs1 Rep1"
6348c2a57ec2 More name changes
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 515
diff changeset
   112
  and     q2: "Quotient R2 Abs2 Rep2"
537
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
   113
  and     a: "(R1 ===> R2) f1 f2"
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
   114
  and     b: "list_rel R1 l1 l2"
57073b0b8fac Even more name changes and cleaning
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 533
diff changeset
   115
  shows "list_rel R2 (map f1 l1) (map f2 l2)"
0
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
using b a
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
by (induct l1 l2 rule: list_induct2')
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
   (simp_all)
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
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
end
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
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
val LENGTH_PRS = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
   ("LENGTH_PRS",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
         !l. LENGTH l = LENGTH (MAP rep l)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
val LENGTH_RSP = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
   ("LENGTH_RSP",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
         !l1 l2.
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
          (LIST_REL R) l1 l2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
          (LENGTH l1 = LENGTH l2)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
val APPEND_PRS = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
   ("APPEND_PRS",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
         !l m. APPEND l m = MAP abs (APPEND (MAP rep l) (MAP rep m))--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
val APPEND_RSP = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
   ("APPEND_RSP",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
         !l1 l2 m1 m2.
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
          (LIST_REL R) l1 l2 /\ (LIST_REL R) m1 m2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
          (LIST_REL R) (APPEND l1 m1) (APPEND l2 m2)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
val FLAT_PRS = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
   ("FLAT_PRS",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
         !l. FLAT l = MAP abs (FLAT (MAP (MAP rep) l))--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
val FLAT_RSP = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
   ("FLAT_RSP",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
         !l1 l2.
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
          LIST_REL (LIST_REL R) l1 l2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
          (LIST_REL R) (FLAT l1) (FLAT l2)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
val REVERSE_PRS = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
   ("REVERSE_PRS",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
         !l. REVERSE l = MAP abs (REVERSE (MAP rep l))--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
val REVERSE_RSP = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
   ("REVERSE_RSP",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
         !l1 l2.
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
          LIST_REL R l1 l2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
          (LIST_REL R) (REVERSE l1) (REVERSE l2)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
val FILTER_PRS = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
   ("FILTER_PRS",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
         !P l. FILTER P l = (MAP abs) (FILTER ((abs --> I) P) (MAP rep l))
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
       --),
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
val FILTER_RSP = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
   ("FILTER_RSP",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
         !P1 P2 l1 l2.
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
          (R ===> $=) P1 P2 /\ (LIST_REL R) l1 l2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
          (LIST_REL R) (FILTER P1 l1) (FILTER P2 l2)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
val NULL_PRS = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
   ("NULL_PRS",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
         !l. NULL l = NULL (MAP rep l)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
val NULL_RSP = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
   ("NULL_RSP",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
         !l1 l2.
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
          LIST_REL R l1 l2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
          (NULL l1 = NULL l2)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
val SOME_EL_PRS = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
   ("SOME_EL_PRS",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
         !l P. SOME_EL P l = SOME_EL ((abs --> I) P) (MAP rep l)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
val SOME_EL_RSP = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
   ("SOME_EL_RSP",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
         !l1 l2 P1 P2.
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
          (R ===> $=) P1 P2 /\ (LIST_REL R) l1 l2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
          (SOME_EL P1 l1 = SOME_EL P2 l2)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
val ALL_EL_PRS = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
   ("ALL_EL_PRS",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
         !l P. ALL_EL P l = ALL_EL ((abs --> I) P) (MAP rep l)--),
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
val ALL_EL_RSP = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
   ("ALL_EL_RSP",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
    (--!R (abs:'a -> 'b) rep. QUOTIENT R abs rep ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
         !l1 l2 P1 P2.
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
          (R ===> $=) P1 P2 /\ (LIST_REL R) l1 l2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
          (ALL_EL P1 l1 = ALL_EL P2 l2)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
val FOLDL_PRS = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
   ("FOLDL_PRS",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
    (--!R1 (abs1:'a -> 'c) rep1. QUOTIENT R1 abs1 rep1 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
        !R2 (abs2:'b -> 'd) rep2. QUOTIENT R2 abs2 rep2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
         !l f e. FOLDL f e l =
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
                 abs1 (FOLDL ((abs1 --> abs2 --> rep1) f)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   225
                      (rep1 e)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
                      (MAP rep2 l))--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
val FOLDL_RSP = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
   ("FOLDL_RSP",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
    (--!R1 (abs1:'a -> 'c) rep1. QUOTIENT R1 abs1 rep1 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
        !R2 (abs2:'b -> 'd) rep2. QUOTIENT R2 abs2 rep2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
         !l1 l2 f1 f2 e1 e2.
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   233
          (R1 ===> R2 ===> R1) f1 f2 /\
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
             R1 e1 e2 /\ (LIST_REL R2) l1 l2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
          R1 (FOLDL f1 e1 l1) (FOLDL f2 e2 l2)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
val FOLDR_PRS = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
   ("FOLDR_PRS",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
    (--!R1 (abs1:'a -> 'c) rep1. QUOTIENT R1 abs1 rep1 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
        !R2 (abs2:'b -> 'd) rep2. QUOTIENT R2 abs2 rep2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241
         !l f e. FOLDR f e l =
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
                 abs2 (FOLDR ((abs1 --> abs2 --> rep2) f)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
                      (rep2 e)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
                      (MAP rep1 l))--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
val FOLDR_RSP = store_thm
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
   ("FOLDR_RSP",
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
    (--!R1 (abs1:'a -> 'c) rep1. QUOTIENT R1 abs1 rep1 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   249
        !R2 (abs2:'b -> 'd) rep2. QUOTIENT R2 abs2 rep2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
         !l1 l2 f1 f2 e1 e2.
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
          (R1 ===> R2 ===> R2) f1 f2 /\
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   252
             R2 e1 e2 /\ (LIST_REL R1) l1 l2 ==>
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
          R2 (FOLDR f1 e1 l1) (FOLDR f2 e2 l2)--),
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
*)
ebe0ea8fe247 initial commit
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255