src/HOL/Library/Quotient_Product.thy
author wenzelm
Sun Mar 14 14:31:24 2010 +0100 (2010-03-14)
changeset 35788 f1deaca15ca3
parent 35222 4f1fba00f66d
child 36695 b434506fb0d4
permissions -rw-r--r--
observe standard header format;
wenzelm@35788
     1
(*  Title:      HOL/Library/Quotient_Product.thy
kaliszyk@35222
     2
    Author:     Cezary Kaliszyk and Christian Urban
kaliszyk@35222
     3
*)
wenzelm@35788
     4
wenzelm@35788
     5
header {* Quotient infrastructure for the product type *}
wenzelm@35788
     6
kaliszyk@35222
     7
theory Quotient_Product
kaliszyk@35222
     8
imports Main Quotient_Syntax
kaliszyk@35222
     9
begin
kaliszyk@35222
    10
kaliszyk@35222
    11
fun
kaliszyk@35222
    12
  prod_rel
kaliszyk@35222
    13
where
kaliszyk@35222
    14
  "prod_rel R1 R2 = (\<lambda>(a, b) (c, d). R1 a c \<and> R2 b d)"
kaliszyk@35222
    15
kaliszyk@35222
    16
declare [[map * = (prod_fun, prod_rel)]]
kaliszyk@35222
    17
kaliszyk@35222
    18
kaliszyk@35222
    19
lemma prod_equivp[quot_equiv]:
kaliszyk@35222
    20
  assumes a: "equivp R1"
kaliszyk@35222
    21
  assumes b: "equivp R2"
kaliszyk@35222
    22
  shows "equivp (prod_rel R1 R2)"
kaliszyk@35222
    23
  apply(rule equivpI)
kaliszyk@35222
    24
  unfolding reflp_def symp_def transp_def
kaliszyk@35222
    25
  apply(simp_all add: split_paired_all)
kaliszyk@35222
    26
  apply(blast intro: equivp_reflp[OF a] equivp_reflp[OF b])
kaliszyk@35222
    27
  apply(blast intro: equivp_symp[OF a] equivp_symp[OF b])
kaliszyk@35222
    28
  apply(blast intro: equivp_transp[OF a] equivp_transp[OF b])
kaliszyk@35222
    29
  done
kaliszyk@35222
    30
kaliszyk@35222
    31
lemma prod_quotient[quot_thm]:
kaliszyk@35222
    32
  assumes q1: "Quotient R1 Abs1 Rep1"
kaliszyk@35222
    33
  assumes q2: "Quotient R2 Abs2 Rep2"
kaliszyk@35222
    34
  shows "Quotient (prod_rel R1 R2) (prod_fun Abs1 Abs2) (prod_fun Rep1 Rep2)"
kaliszyk@35222
    35
  unfolding Quotient_def
kaliszyk@35222
    36
  apply(simp add: split_paired_all)
kaliszyk@35222
    37
  apply(simp add: Quotient_abs_rep[OF q1] Quotient_rel_rep[OF q1])
kaliszyk@35222
    38
  apply(simp add: Quotient_abs_rep[OF q2] Quotient_rel_rep[OF q2])
kaliszyk@35222
    39
  using q1 q2
kaliszyk@35222
    40
  unfolding Quotient_def
kaliszyk@35222
    41
  apply(blast)
kaliszyk@35222
    42
  done
kaliszyk@35222
    43
kaliszyk@35222
    44
lemma Pair_rsp[quot_respect]:
kaliszyk@35222
    45
  assumes q1: "Quotient R1 Abs1 Rep1"
kaliszyk@35222
    46
  assumes q2: "Quotient R2 Abs2 Rep2"
kaliszyk@35222
    47
  shows "(R1 ===> R2 ===> prod_rel R1 R2) Pair Pair"
kaliszyk@35222
    48
  by simp
kaliszyk@35222
    49
kaliszyk@35222
    50
lemma Pair_prs[quot_preserve]:
kaliszyk@35222
    51
  assumes q1: "Quotient R1 Abs1 Rep1"
kaliszyk@35222
    52
  assumes q2: "Quotient R2 Abs2 Rep2"
kaliszyk@35222
    53
  shows "(Rep1 ---> Rep2 ---> (prod_fun Abs1 Abs2)) Pair = Pair"
kaliszyk@35222
    54
  apply(simp add: expand_fun_eq)
kaliszyk@35222
    55
  apply(simp add: Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2])
kaliszyk@35222
    56
  done
kaliszyk@35222
    57
kaliszyk@35222
    58
lemma fst_rsp[quot_respect]:
kaliszyk@35222
    59
  assumes "Quotient R1 Abs1 Rep1"
kaliszyk@35222
    60
  assumes "Quotient R2 Abs2 Rep2"
kaliszyk@35222
    61
  shows "(prod_rel R1 R2 ===> R1) fst fst"
kaliszyk@35222
    62
  by simp
kaliszyk@35222
    63
kaliszyk@35222
    64
lemma fst_prs[quot_preserve]:
kaliszyk@35222
    65
  assumes q1: "Quotient R1 Abs1 Rep1"
kaliszyk@35222
    66
  assumes q2: "Quotient R2 Abs2 Rep2"
kaliszyk@35222
    67
  shows "(prod_fun Rep1 Rep2 ---> Abs1) fst = fst"
kaliszyk@35222
    68
  apply(simp add: expand_fun_eq)
kaliszyk@35222
    69
  apply(simp add: Quotient_abs_rep[OF q1])
kaliszyk@35222
    70
  done
kaliszyk@35222
    71
kaliszyk@35222
    72
lemma snd_rsp[quot_respect]:
kaliszyk@35222
    73
  assumes "Quotient R1 Abs1 Rep1"
kaliszyk@35222
    74
  assumes "Quotient R2 Abs2 Rep2"
kaliszyk@35222
    75
  shows "(prod_rel R1 R2 ===> R2) snd snd"
kaliszyk@35222
    76
  by simp
kaliszyk@35222
    77
kaliszyk@35222
    78
lemma snd_prs[quot_preserve]:
kaliszyk@35222
    79
  assumes q1: "Quotient R1 Abs1 Rep1"
kaliszyk@35222
    80
  assumes q2: "Quotient R2 Abs2 Rep2"
kaliszyk@35222
    81
  shows "(prod_fun Rep1 Rep2 ---> Abs2) snd = snd"
kaliszyk@35222
    82
  apply(simp add: expand_fun_eq)
kaliszyk@35222
    83
  apply(simp add: Quotient_abs_rep[OF q2])
kaliszyk@35222
    84
  done
kaliszyk@35222
    85
kaliszyk@35222
    86
lemma split_rsp[quot_respect]:
kaliszyk@35222
    87
  shows "((R1 ===> R2 ===> (op =)) ===> (prod_rel R1 R2) ===> (op =)) split split"
kaliszyk@35222
    88
  by auto
kaliszyk@35222
    89
kaliszyk@35222
    90
lemma split_prs[quot_preserve]:
kaliszyk@35222
    91
  assumes q1: "Quotient R1 Abs1 Rep1"
kaliszyk@35222
    92
  and     q2: "Quotient R2 Abs2 Rep2"
kaliszyk@35222
    93
  shows "(((Abs1 ---> Abs2 ---> id) ---> prod_fun Rep1 Rep2 ---> id) split) = split"
kaliszyk@35222
    94
  by (simp add: expand_fun_eq Quotient_abs_rep[OF q1] Quotient_abs_rep[OF q2])
kaliszyk@35222
    95
kaliszyk@35222
    96
lemma prod_fun_id[id_simps]:
kaliszyk@35222
    97
  shows "prod_fun id id = id"
kaliszyk@35222
    98
  by (simp add: prod_fun_def)
kaliszyk@35222
    99
kaliszyk@35222
   100
lemma prod_rel_eq[id_simps]:
kaliszyk@35222
   101
  shows "prod_rel (op =) (op =) = (op =)"
kaliszyk@35222
   102
  by (simp add: expand_fun_eq)
kaliszyk@35222
   103
kaliszyk@35222
   104
end