Quotient-Paper-jv/Paper.thy
author Christian Urban <urbanc@in.tum.de>
Thu, 22 Dec 2011 05:15:37 +0000
changeset 3094 8bad9887ad90
parent 3092 ff377f9d030a
child 3114 a9a4baa7779f
permissions -rw-r--r--
moved TODO into the paper
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
(*<*)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     2
theory Paper
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
imports "Quotient"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
        "~~/src/HOL/Library/Quotient_Syntax"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
        "~~/src/HOL/Library/LaTeXsugar"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
        "~~/src/HOL/Quotient_Examples/FSet"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
begin
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
(****
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
** things to do for the next version
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
* - what are quot_thms?
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
* - what do all preservation theorems look like,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
    in particular preservation for quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
    compositions
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
  - explain how Quotient R Abs Rep is proved (j-version)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
  - give an example where precise specification helps (core Haskell in nominal?)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
  - Mention Andreas Lochbiler in Acknowledgements and 'desceding'.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
*)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
notation (latex output)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
  rel_conj ("_ \<circ>\<circ>\<circ> _" [53, 53] 52) and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
  pred_comp ("_ \<circ>\<circ> _" [1, 1] 30) and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
  implies (infix "\<longrightarrow>" 100) and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
  "==>" (infix "\<Longrightarrow>" 100) and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
  map_fun ("_ \<singlearr> _" 51) and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
  fun_rel ("_ \<doublearr> _" 51) and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
  list_eq (infix "\<approx>" 50) and (* Not sure if we want this notation...? *)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
  empty_fset ("\<emptyset>") and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
  union_fset ("_ \<union> _") and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
  insert_fset ("{_} \<union> _") and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
  Cons ("_::_") and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
  concat ("flat") and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
  concat_fset ("\<Union>") and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
  Quotient ("Quot _ _ _")
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
ML {*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
fun nth_conj n (_, r) = nth (HOLogic.dest_conj r) n;
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
fun style_lhs_rhs proj = Scan.succeed (fn ctxt => fn t =>
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
  let
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
    val concl =
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
      Object_Logic.drop_judgment (Proof_Context.theory_of ctxt) (Logic.strip_imp_concl t)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
  in
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
    case concl of (_ $ l $ r) => proj (l, r)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
    | _ => error ("Binary operator expected in term: " ^ Syntax.string_of_term ctxt concl)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
  end);
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    55
setup {*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
  Term_Style.setup "rhs1" (style_lhs_rhs (nth_conj 0)) #>
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
  Term_Style.setup "rhs2" (style_lhs_rhs (nth_conj 1)) #>
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
  Term_Style.setup "rhs3" (style_lhs_rhs (nth_conj 2))
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    60
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
lemma insert_preserve2:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    62
  shows "((rep_fset ---> (map rep_fset \<circ> rep_fset) ---> (abs_fset \<circ> map abs_fset)) op #) =
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    63
         (id ---> rep_fset ---> abs_fset) op #"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    64
  by (simp add: fun_eq_iff abs_o_rep[OF Quotient_fset] map_id Quotient_abs_rep[OF Quotient_fset])
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
lemma list_all2_symp:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
  assumes a: "equivp R"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    68
  and b: "list_all2 R xs ys"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    69
  shows "list_all2 R ys xs"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
using list_all2_lengthD[OF b] b
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    71
apply(induct xs ys rule: list_induct2)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
apply(auto intro: equivp_symp[OF a])
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    73
done
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    74
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    75
lemma concat_rsp_unfolded:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    76
  "\<lbrakk>list_all2 list_eq a ba; list_eq ba bb; list_all2 list_eq bb b\<rbrakk> \<Longrightarrow> list_eq (concat a) (concat b)"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    77
proof -
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    78
  fix a b ba bb
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    79
  assume a: "list_all2 list_eq a ba"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    80
  assume b: "list_eq ba bb"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
  assume c: "list_all2 list_eq bb b"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
  have "\<forall>x. (\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)" proof
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    83
    fix x
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    84
    show "(\<exists>xa\<in>set a. x \<in> set xa) = (\<exists>xa\<in>set b. x \<in> set xa)" proof
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    85
      assume d: "\<exists>xa\<in>set a. x \<in> set xa"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    86
      show "\<exists>xa\<in>set b. x \<in> set xa" by (rule concat_rsp_pre[OF a b c d])
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    87
    next
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    88
      assume e: "\<exists>xa\<in>set b. x \<in> set xa"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    89
      have a': "list_all2 list_eq ba a" by (rule list_all2_symp[OF list_eq_equivp, OF a])
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    90
      have b': "list_eq bb ba" by (rule equivp_symp[OF list_eq_equivp, OF b])
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    91
      have c': "list_all2 list_eq b bb" by (rule list_all2_symp[OF list_eq_equivp, OF c])
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    92
      show "\<exists>xa\<in>set a. x \<in> set xa" by (rule concat_rsp_pre[OF c' b' a' e])
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    93
    qed
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    94
  qed
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    95
  then show "list_eq (concat a) (concat b)" by auto
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    96
qed
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    97
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    98
(*>*)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    99
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   100
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   101
section {* Introduction *}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   102
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   103
text {*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   104
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   105
  One might think quotients have been studied to death, but in the context of
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   106
  theorem provers many questions concerning them are far from settled. In
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   107
  this paper we address the question of how to establish a convenient reasoning
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   108
  infrastructure
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   109
  for quotient constructions in the Isabelle/HOL
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   110
  theorem prover. Higher-Order Logic (HOL) consists
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   111
  of a small number of axioms and inference rules over a simply-typed
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   112
  term-language. Safe reasoning in HOL is ensured by two very restricted
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   113
  mechanisms for extending the logic: one is the definition of new constants
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   114
  in terms of existing ones; the other is the introduction of new types by
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   115
  identifying non-empty subsets in existing types. Previous work has shown how
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   116
  to use both mechanisms for dealing with quotient constructions in HOL (see
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   117
  \cite{Homeier05,Paulson06}).  For example the integers in Isabelle/HOL are
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   118
  constructed by a quotient construction over the type @{typ "nat \<times> nat"} and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   119
  the equivalence relation
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   120
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   121
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   122
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   123
  @{text "(n\<^isub>1, n\<^isub>2) \<approx> (m\<^isub>1, m\<^isub>2) \<equiv> n\<^isub>1 + m\<^isub>2 = m\<^isub>1 + n\<^isub>2"}\hfill\numbered{natpairequiv}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   124
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   125
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   126
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   127
  This constructions yields the new type @{typ int}, and definitions for @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   128
  "0"} and @{text "1"} of type @{typ int} can be given in terms of pairs of
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   129
  natural numbers (namely @{text "(0, 0)"} and @{text "(1, 0)"}). Operations
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   130
  such as @{text "add"} with type @{typ "int \<Rightarrow> int \<Rightarrow> int"} can be defined in
3094
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   131
  terms of operations on pairs of natural numbers:
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   132
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   133
  \begin{isabelle}\ \ \ \ \ %%%
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   134
  @{text "add_pair (n\<^isub>1, m\<^isub>1) (n\<^isub>2, m\<^isub>2) \<equiv> (n\<^isub>1 + n\<^isub>2, m\<^isub>1 + m\<^isub>2)"}
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   135
  \end{isabelle}
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   136
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   137
  \noindent
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   138
  Similarly one can construct the type of
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   139
  finite sets, written @{term "\<alpha> fset"},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   140
  by quotienting the type @{text "\<alpha> list"} according to the equivalence relation
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   141
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   142
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   143
  @{text "xs \<approx> ys \<equiv> (\<forall>x. memb x xs \<longleftrightarrow> memb x ys)"}\hfill\numbered{listequiv}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   144
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   145
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   146
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   147
  which states that two lists are equivalent if every element in one list is
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   148
  also member in the other. The empty finite set, written @{term "{||}"}, can
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   149
  then be defined as the empty list and the union of two finite sets, written
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   150
  @{text "\<union>"}, as list append.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   151
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   152
  Quotients are important in a variety of areas, but they are really ubiquitous in
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   153
  the area of reasoning about programming language calculi. A simple example
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   154
  is the lambda-calculus, whose raw terms are defined as
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   155
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   156
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   157
  @{text "t ::= x | t t | \<lambda>x.t"}%\hfill\numbered{lambda}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   158
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   159
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   160
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   161
  The problem with this definition arises, for instance, when one attempts to
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   162
  prove formally the substitution lemma \cite{Barendregt81} by induction
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   163
  over the structure of terms. This can be fiendishly complicated (see
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   164
  \cite[Pages 94--104]{CurryFeys58} for some ``rough'' sketches of a proof
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   165
  about raw lambda-terms). In contrast, if we reason about
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   166
  $\alpha$-equated lambda-terms, that means terms quotient according to
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   167
  $\alpha$-equivalence, then the reasoning infrastructure provided,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   168
  for example, by Nominal Isabelle %%\cite{UrbanKaliszyk11}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   169
  makes the formal
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   170
  proof of the substitution lemma almost trivial.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   171
3092
ff377f9d030a some slight tuning
Christian Urban <urbanc@in.tum.de>
parents: 3082
diff changeset
   172
  {\bf MAYBE AN EAMPLE FOR PARTIAL QUOTIENTS?}
ff377f9d030a some slight tuning
Christian Urban <urbanc@in.tum.de>
parents: 3082
diff changeset
   173
ff377f9d030a some slight tuning
Christian Urban <urbanc@in.tum.de>
parents: 3082
diff changeset
   174
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   175
  The difficulty is that in order to be able to reason about integers, finite
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   176
  sets or $\alpha$-equated lambda-terms one needs to establish a reasoning
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   177
  infrastructure by transferring, or \emph{lifting}, definitions and theorems
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   178
  from the raw type @{typ "nat \<times> nat"} to the quotient type @{typ int}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   179
  (similarly for finite sets and $\alpha$-equated lambda-terms). This lifting
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   180
  usually requires a \emph{lot} of tedious reasoning effort \cite{Paulson06}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   181
  In principle it is feasible to do this work manually, if one has only a few quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   182
  constructions at hand. But if they have to be done over and over again, as in
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   183
  Nominal Isabelle, then manual reasoning is not an option.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   184
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   185
  The purpose of a \emph{quotient package} is to ease the lifting of theorems
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   186
  and automate the reasoning as much as possible. In the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   187
  context of HOL, there have been a few quotient packages already
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   188
  \cite{harrison-thesis,Slotosch97}. The most notable one is by Homeier
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   189
  \cite{Homeier05} implemented in HOL4.  The fundamental construction these
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   190
  quotient packages perform can be illustrated by the following picture:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   191
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   192
%%% FIXME: Referee 1 says:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   193
%%% Diagram is unclear.  Firstly, isn't an existing type a "set (not sets) of raw elements"?
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   194
%%% Secondly, isn't the _set of_ equivalence classes mapped to and from the new type?
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   195
%%% Thirdly, what do the words "non-empty subset" refer to ?
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   196
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   197
%%% Cezary: I like the diagram, maybe 'new type' could be outside, but otherwise
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   198
%%% I wouldn't change it.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   199
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   200
  \begin{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   201
  \mbox{}\hspace{20mm}\begin{tikzpicture}[scale=0.9]
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   202
  %%\draw[step=2mm] (-4,-1) grid (4,1);
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   203
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   204
  \draw[very thick] (0.7,0.3) circle (4.85mm);
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   205
  \draw[rounded corners=1mm, very thick] ( 0.0,-0.9) rectangle ( 1.8, 0.9);
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   206
  \draw[rounded corners=1mm, very thick] (-1.95,0.8) rectangle (-2.9,-0.195);
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   207
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   208
  \draw (-2.0, 0.8) --  (0.7,0.8);
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   209
  \draw (-2.0,-0.195)  -- (0.7,-0.195);
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   210
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   211
  \draw ( 0.7, 0.23) node {\begin{tabular}{@ {}c@ {}}equiv-\\[-1mm]clas.\end{tabular}};
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   212
  \draw (-2.45, 0.35) node {\begin{tabular}{@ {}c@ {}}new\\[-1mm]type\end{tabular}};
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   213
  \draw (1.8, 0.35) node[right=-0.1mm]
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   214
    {\begin{tabular}{@ {}l@ {}}existing\\[-1mm] type\\ (sets of raw elements)\end{tabular}};
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   215
  \draw (0.9, -0.55) node {\begin{tabular}{@ {}l@ {}}non-empty\\[-1mm]subset\end{tabular}};
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   216
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   217
  \draw[->, very thick] (-1.8, 0.36) -- (-0.1,0.36);
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   218
  \draw[<-, very thick] (-1.8, 0.16) -- (-0.1,0.16);
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   219
  \draw (-0.95, 0.26) node[above=0.4mm] {@{text Rep}};
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   220
  \draw (-0.95, 0.26) node[below=0.4mm] {@{text Abs}};
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   221
  \end{tikzpicture}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   222
  \end{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   223
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   224
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   225
  The starting point is an existing type, to which we refer as the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   226
  \emph{raw type} and over which an equivalence relation is given by the user.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   227
  With this input the package introduces a new type, to which we
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   228
  refer as the \emph{quotient type}. This type comes with an
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   229
  \emph{abstraction} and a \emph{representation} function, written @{text Abs}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   230
  and @{text Rep}.\footnote{Actually slightly more basic functions are given;
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   231
  the functions @{text Abs} and @{text Rep} need to be derived from them. We
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   232
  will show the details later. } They relate elements in the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   233
  existing type to elements in the new type, % and vice versa,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   234
  and can be uniquely
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   235
  identified by their quotient type. For example for the integer quotient construction
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   236
  the types of @{text Abs} and @{text Rep} are
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   237
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   238
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   239
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   240
  @{text "Abs :: nat \<times> nat \<Rightarrow> int"}\hspace{10mm}@{text "Rep :: int \<Rightarrow> nat \<times> nat"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   241
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   242
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   243
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   244
  We therefore often write @{text Abs_int} and @{text Rep_int} if the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   245
  typing information is important.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   246
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   247
  Every abstraction and representation function stands for an isomorphism
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   248
  between the non-empty subset and elements in the new type. They are
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   249
  necessary for making definitions involving the new type. For example @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   250
  "0"} and @{text "1"} of type @{typ int} can be defined as
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   251
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   252
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   253
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   254
  @{text "0 \<equiv> Abs_int (0, 0)"}\hspace{10mm}@{text "1 \<equiv> Abs_int (1, 0)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   255
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   256
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   257
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   258
  Slightly more complicated is the definition of @{text "add"} having type
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   259
  @{typ "int \<Rightarrow> int \<Rightarrow> int"}. Its definition is as follows
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   260
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   261
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   262
  @{text "add n m \<equiv> Abs_int (add_pair (Rep_int n) (Rep_int m))"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   263
  \hfill\numbered{adddef}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   264
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   265
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   266
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   267
  where we take the representation of the arguments @{text n} and @{text m},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   268
  add them according to the function @{text "add_pair"} and then take the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   269
  abstraction of the result.  This is all straightforward and the existing
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   270
  quotient packages can deal with such definitions. But what is surprising is
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   271
  that none of them can deal with slightly more complicated definitions involving
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   272
  \emph{compositions} of quotients. Such compositions are needed for example
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   273
  in case of quotienting lists to yield finite sets and the operator that
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   274
  flattens lists of lists, defined as follows
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   275
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   276
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   277
  @{thm concat.simps(1)[THEN eq_reflection]}\hspace{10mm}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   278
  @{thm concat.simps(2)[THEN eq_reflection, no_vars]}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   279
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   280
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   281
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   282
  where @{text "@"} is the usual
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   283
  list append. We expect that the corresponding
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   284
  operator on finite sets, written @{term "fconcat"},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   285
  builds finite unions of finite sets:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   286
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   287
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   288
  @{thm concat_empty_fset[THEN eq_reflection, no_vars]}\hspace{10mm}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   289
  @{thm concat_insert_fset[THEN eq_reflection, no_vars]}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   290
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   291
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   292
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   293
  The quotient package should automatically provide us with a definition for @{text "\<Union>"} in
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   294
  terms of @{text flat}, @{text Rep_fset} and @{text Abs_fset}. The problem is
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   295
  that the method  used in the existing quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   296
  packages of just taking the representation of the arguments and then taking
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   297
  the abstraction of the result is \emph{not} enough. The reason is that in case
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   298
  of @{text "\<Union>"} we obtain the incorrect definition
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   299
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   300
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   301
  @{text "\<Union> S \<equiv> Abs_fset (flat (Rep_fset S))"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   302
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   303
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   304
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   305
  where the right-hand side is not even typable! This problem can be remedied in the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   306
  existing quotient packages by introducing an intermediate step and reasoning
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   307
  about flattening of lists of finite sets. However, this remedy is rather
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   308
  cumbersome and inelegant in light of our work, which can deal with such
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   309
  definitions directly. The solution is that we need to build aggregate
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   310
  representation and abstraction functions, which in case of @{text "\<Union>"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   311
  generate the %%%following
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   312
  definition
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   313
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   314
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   315
  @{text "\<Union> S \<equiv> Abs_fset (flat ((map_list Rep_fset \<circ> Rep_fset) S))"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   316
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   317
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   318
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   319
  where @{term map_list} is the usual mapping function for lists. In this paper we
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   320
  will present a formal definition of our aggregate abstraction and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   321
  representation functions (this definition was omitted in \cite{Homeier05}).
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   322
  They generate definitions, like the one above for @{text "\<Union>"},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   323
  according to the type of the raw constant and the type
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   324
  of the quotient constant. This means we also have to extend the notions
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   325
  of \emph{aggregate equivalence relation}, \emph{respectfulness} and \emph{preservation}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   326
  from Homeier \cite{Homeier05}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   327
3094
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   328
  {\bf EXAMPLE BY HUFFMAN ABOUT @{thm map_concat}}
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   329
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   330
  In addition we are able to clearly specify what is involved
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   331
  in the lifting process (this was only hinted at in \cite{Homeier05} and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   332
  implemented as a ``rough recipe'' in ML-code). A pleasing side-result
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   333
  is that our procedure for lifting theorems is completely deterministic
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   334
  following the structure of the theorem being lifted and the theorem
3094
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   335
  on the quotient level. {\it Space constraints, unfortunately, allow us to only
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   336
  sketch this part of our work in Section 5 and we defer the reader to a longer
3094
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
   337
  version for the details.} However, we will give in Section 3 and 4 all
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   338
  definitions that specify the input and output data of our three-step
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   339
  lifting procedure. Appendix A gives an example how our quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   340
  package works in practise.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   341
*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   342
3092
ff377f9d030a some slight tuning
Christian Urban <urbanc@in.tum.de>
parents: 3082
diff changeset
   343
section {* Preliminaries and General Quotients\label{sec:prelims} *}
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   344
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   345
text {*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   346
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   347
  We will give in this section a crude overview of HOL and describe the main
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   348
  definitions given by Homeier for quotients \cite{Homeier05}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   349
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   350
  At its core, HOL is based on a simply-typed term language, where types are
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   351
  recorded in Church-style fashion (that means, we can always infer the type of
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   352
  a term and its subterms without any additional information). The grammars
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   353
  for types and terms are
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   354
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   355
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   356
  \begin{tabular}{@ {}c@ {\hspace{10mm}}c@ {}}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   357
  @{text "\<sigma>, \<tau> ::= \<alpha> | (\<sigma>,\<dots>, \<sigma>) \<kappa>"} &
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   358
  @{text "t, s ::= x\<^isup>\<sigma> | c\<^isup>\<sigma> | t t | \<lambda>x\<^isup>\<sigma>. t"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   359
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   360
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   361
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   362
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   363
  with types being either type variables or type constructors and terms
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   364
  being variables, constants, applications or abstractions.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   365
  We often write just @{text \<kappa>} for @{text "() \<kappa>"}, and use @{text "\<alpha>s"} and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   366
  @{text "\<sigma>s"} to stand for collections of type variables and types,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   367
  respectively.  The type of a term is often made explicit by writing @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   368
  "t :: \<sigma>"}. HOL includes a type @{typ bool} for booleans and the function
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   369
  type, written @{text "\<sigma> \<Rightarrow> \<tau>"}. HOL also contains many primitive and defined
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   370
  constants; for example, a primitive constant is equality, with type @{text "= :: \<sigma> \<Rightarrow> \<sigma> \<Rightarrow>
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   371
  bool"}, and the identity function with type @{text "id :: \<sigma> \<Rightarrow> \<sigma>"} is
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   372
  defined as @{text "\<lambda>x\<^sup>\<sigma>. x\<^sup>\<sigma>"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   373
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   374
  An important point to note is that theorems in HOL can be seen as a subset
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   375
  of terms that are constructed specially (namely through axioms and proof
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   376
  rules). As a result we are able to define automatic proof
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   377
  procedures showing that one theorem implies another by decomposing the term
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   378
  underlying the first theorem.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   379
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   380
  Like Homeier's, our work relies on map-functions defined for every type
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   381
  constructor taking some arguments, for example @{text map_list} for lists. Homeier
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   382
  describes in \cite{Homeier05} map-functions for products, sums, options and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   383
  also the following map for function types
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   384
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   385
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   386
  @{thm map_fun_def[no_vars, THEN eq_reflection]}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   387
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   388
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   389
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   390
  Using this map-function, we can give the following, equivalent, but more
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   391
  uniform definition for @{text add} shown in \eqref{adddef}:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   392
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   393
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   394
  @{text "add \<equiv> (Rep_int \<singlearr> Rep_int \<singlearr> Abs_int) add_pair"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   395
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   396
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   397
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   398
  Using extensionality and unfolding the definition of @{text "\<singlearr>"},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   399
  we can get back to \eqref{adddef}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   400
  In what follows we shall use the convention to write @{text "map_\<kappa>"} for a map-function
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   401
  of the type-constructor @{text \<kappa>}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   402
  %% a general type for map all types is difficult to give (algebraic types are
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   403
  %% easy, but for example the function type is not algebraic
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   404
  %For a type @{text \<kappa>} with arguments @{text "\<alpha>\<^isub>1\<^isub>\<dots>\<^isub>n"} the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   405
  %type of the function @{text "map_\<kappa>"} has to be @{text "\<alpha>\<^isub>1\<Rightarrow>\<dots>\<Rightarrow>\<alpha>\<^isub>n\<Rightarrow>\<alpha>\<^isub>1\<dots>\<alpha>\<^isub>n \<kappa>"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   406
  %For example @{text "map_list"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   407
  %has to have the type @{text "\<alpha>\<Rightarrow>\<alpha> list"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   408
  In our implementation we maintain
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   409
  a database of these map-functions that can be dynamically extended.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   410
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   411
  It will also be necessary to have operators, referred to as @{text "rel_\<kappa>"},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   412
  which define equivalence relations in terms of constituent equivalence
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   413
  relations. For example given two equivalence relations @{text "R\<^isub>1"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   414
  and @{text "R\<^isub>2"}, we can define an equivalence relations over
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   415
  products as %% follows
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   416
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   417
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   418
  @{text "(R\<^isub>1 \<tripple> R\<^isub>2) (x\<^isub>1, x\<^isub>2) (y\<^isub>1, y\<^isub>2) \<equiv> R\<^isub>1 x\<^isub>1 y\<^isub>1 \<and> R\<^isub>2 x\<^isub>2 y\<^isub>2"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   419
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   420
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   421
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   422
  Homeier gives also the following operator for defining equivalence
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   423
  relations over function types
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   424
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   425
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   426
  @{thm fun_rel_def[of "R\<^isub>1" "R\<^isub>2", no_vars, THEN eq_reflection]}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   427
  \hfill\numbered{relfun}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   428
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   429
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   430
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   431
  In the context of quotients, the following two notions from \cite{Homeier05}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   432
  are needed later on.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   433
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   434
  \begin{definition}[Respects]\label{def:respects}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   435
  An element @{text "x"} respects a relation @{text "R"} provided @{text "R x x"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   436
  \end{definition}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   437
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   438
  \begin{definition}[Bounded $\forall$ and $\lambda$]\label{def:babs}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   439
  @{text "\<forall>x \<in> S. P x"} holds if for all @{text x}, @{text "x \<in> S"} implies @{text "P x"};
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   440
  and @{text "(\<lambda>x \<in> S. f x) = f x"} provided @{text "x \<in> S"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   441
  \end{definition}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   442
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   443
  The central definition in Homeier's work \cite{Homeier05} relates equivalence
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   444
  relations, abstraction and representation functions:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   445
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   446
  \begin{definition}[Quotient Types]
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   447
  Given a relation $R$, an abstraction function $Abs$
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   448
  and a representation function $Rep$, the predicate @{term "Quotient R Abs Rep"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   449
  holds if and only if
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   450
  \begin{isabelle}\ \ \ \ \ %%%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   451
  \begin{tabular}{rl}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   452
  (i) & \begin{isa}@{thm (rhs1) Quotient_def[of "R", no_vars]}\end{isa}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   453
  (ii) & \begin{isa}@{thm (rhs2) Quotient_def[of "R", no_vars]}\end{isa}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   454
  (iii) & \begin{isa}@{thm (rhs3) Quotient_def[of "R", no_vars]}\end{isa}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   455
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   456
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   457
  \end{definition}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   458
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   459
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   460
  The value of this definition lies in the fact that validity of @{term "Quotient R Abs Rep"} can
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   461
  often be proved in terms of the validity of @{term "Quot"} over the constituent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   462
  types of @{text "R"}, @{text Abs} and @{text Rep}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   463
  For example Homeier proves the following property for higher-order quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   464
  types:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   465
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   466
  \begin{proposition}\label{funquot}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   467
  \begin{isa}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   468
  @{thm[mode=IfThen] fun_quotient[where ?R1.0="R\<^isub>1" and ?R2.0="R\<^isub>2"
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   469
      and ?abs1.0="Abs\<^isub>1" and ?abs2.0="Abs\<^isub>2" and ?rep1.0="Rep\<^isub>1" and ?rep2.0="Rep\<^isub>2"]}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   470
  \end{isa}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   471
  \end{proposition}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   472
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   473
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   474
  As a result, Homeier is able to build an automatic prover that can nearly
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   475
  always discharge a proof obligation involving @{text "Quot"}. Our quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   476
  package makes heavy
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   477
  use of this part of Homeier's work including an extension
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   478
  for dealing with \emph{conjugations} of equivalence relations\footnote{That are
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   479
  symmetric by definition.} defined as follows:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   480
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   481
%%% FIXME Referee 2 claims that composition-of-relations means OO, and this is also
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   482
%%% what wikipedia says. Any idea for a different name? Conjugation of Relations?
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   483
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   484
  \begin{definition}%%[Composition of Relations]
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   485
  @{abbrev "rel_conj R\<^isub>1 R\<^isub>2"} where @{text "\<circ>\<circ>"} is the predicate
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   486
  composition defined by
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   487
  @{thm (concl) pred_compI[of "R\<^isub>1" "x" "y" "R\<^isub>2" "z"]}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   488
  holds if and only if there exists a @{text y} such that @{thm (prem 1) pred_compI[of "R\<^isub>1" "x" "y" "R\<^isub>2" "z"]} and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   489
  @{thm (prem 2) pred_compI[of "R\<^isub>1" "x" "y" "R\<^isub>2" "z"]}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   490
  \end{definition}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   491
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   492
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   493
  Unfortunately a general quotient theorem for @{text "\<circ>\<circ>\<circ>"}, analogous to the one
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   494
  for @{text "\<singlearr>"} given in Proposition \ref{funquot}, would not be true
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   495
  in general. It cannot even be stated inside HOL, because of restrictions on types.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   496
  However, we can prove specific instances of a
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   497
  quotient theorem for composing particular quotient relations.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   498
  For example, to lift theorems involving @{term flat} the quotient theorem for
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   499
  composing @{text "\<approx>\<^bsub>list\<^esub>"} will be necessary: given @{term "Quotient R Abs Rep"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   500
  with @{text R} being an equivalence relation, then
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   501
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   502
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   503
  \begin{tabular}{r@ {\hspace{1mm}}l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   504
  @{text  "Quot"} & @{text "(rel_list R \<circ>\<circ>\<circ> \<approx>\<^bsub>list\<^esub>)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   505
                  & @{text "(Abs_fset \<circ> map_list Abs)"} @{text "(map_list Rep \<circ> Rep_fset)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   506
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   507
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   508
*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   509
3092
ff377f9d030a some slight tuning
Christian Urban <urbanc@in.tum.de>
parents: 3082
diff changeset
   510
section {* Quotient Types and Quotient Definitions\label{sec:type} *}
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   511
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   512
text {*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   513
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   514
  The first step in a quotient construction is to take a name for the new
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   515
  type, say @{text "\<kappa>\<^isub>q"}, and an equivalence relation, say @{text R},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   516
  defined over a raw type, say @{text "\<sigma>"}. The type of the equivalence
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   517
  relation must be @{text "\<sigma> \<Rightarrow> \<sigma> \<Rightarrow> bool"}. The user-visible part of
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   518
  the quotient type declaration is therefore
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   519
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   520
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   521
  \isacommand{quotient\_type}~~@{text "\<alpha>s \<kappa>\<^isub>q = \<sigma> / R"}\hfill\numbered{typedecl}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   522
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   523
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   524
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   525
  and a proof that @{text "R"} is indeed an equivalence relation. The @{text "\<alpha>s"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   526
  indicate the arity of the new type and the type-variables of @{text "\<sigma>"} can only
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   527
  be contained in @{text "\<alpha>s"}. Two concrete
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   528
  examples are
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   529
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   530
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   531
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   532
  \begin{tabular}{@ {}l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   533
  \isacommand{quotient\_type}~~@{text "int = nat \<times> nat / \<approx>\<^bsub>nat \<times> nat\<^esub>"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   534
  \isacommand{quotient\_type}~~@{text "\<alpha> fset = \<alpha> list / \<approx>\<^bsub>list\<^esub>"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   535
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   536
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   537
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   538
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   539
  which introduce the type of integers and of finite sets using the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   540
  equivalence relations @{text "\<approx>\<^bsub>nat \<times> nat\<^esub>"} and @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   541
  "\<approx>\<^bsub>list\<^esub>"} defined in \eqref{natpairequiv} and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   542
  \eqref{listequiv}, respectively (the proofs about being equivalence
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   543
  relations are omitted).  Given this data, we define for declarations shown in
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   544
  \eqref{typedecl} the quotient types internally as
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   545
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   546
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   547
  \isacommand{typedef}~~@{text "\<alpha>s \<kappa>\<^isub>q = {c. \<exists>x. c = R x}"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   548
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   549
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   550
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   551
  where the right-hand side is the (non-empty) set of equivalence classes of
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   552
  @{text "R"}. The constraint in this declaration is that the type variables
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   553
  in the raw type @{text "\<sigma>"} must be included in the type variables @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   554
  "\<alpha>s"} declared for @{text "\<kappa>\<^isub>q"}. HOL will then provide us with the following
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   555
  abstraction and representation functions
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   556
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   557
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   558
  @{text "abs_\<kappa>\<^isub>q :: \<sigma> set \<Rightarrow> \<alpha>s \<kappa>\<^isub>q"}\hspace{10mm}@{text "rep_\<kappa>\<^isub>q :: \<alpha>s \<kappa>\<^isub>q \<Rightarrow> \<sigma> set"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   559
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   560
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   561
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   562
  As can be seen from the type, they relate the new quotient type and equivalence classes of the raw
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   563
  type. However, as Homeier \cite{Homeier05} noted, it is much more convenient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   564
  to work with the following derived abstraction and representation functions
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   565
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   566
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   567
  @{text "Abs_\<kappa>\<^isub>q x \<equiv> abs_\<kappa>\<^isub>q (R x)"}\hspace{10mm}@{text "Rep_\<kappa>\<^isub>q x \<equiv> \<epsilon> (rep_\<kappa>\<^isub>q x)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   568
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   569
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   570
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   571
  on the expense of having to use Hilbert's choice operator @{text "\<epsilon>"} in the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   572
  definition of @{text "Rep_\<kappa>\<^isub>q"}. These derived notions relate the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   573
  quotient type and the raw type directly, as can be seen from their type,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   574
  namely @{text "\<sigma> \<Rightarrow> \<alpha>s \<kappa>\<^isub>q"} and @{text "\<alpha>s \<kappa>\<^isub>q \<Rightarrow> \<sigma>"},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   575
  respectively.  Given that @{text "R"} is an equivalence relation, the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   576
  following property holds  for every quotient type
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   577
  (for the proof see \cite{Homeier05}).
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   578
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   579
  \begin{proposition}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   580
  \begin{isa}@{term "Quotient R Abs_\<kappa>\<^isub>q Rep_\<kappa>\<^isub>q"}.\end{isa}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   581
  \end{proposition}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   582
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   583
  The next step in a quotient construction is to introduce definitions of new constants
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   584
  involving the quotient type. These definitions need to be given in terms of concepts
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   585
  of the raw type (remember this is the only way how to extend HOL
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   586
  with new definitions). For the user the visible part of such definitions is the declaration
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   587
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   588
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   589
  \isacommand{quotient\_definition}~~@{text "c :: \<tau>"}~~\isacommand{is}~~@{text "t :: \<sigma>"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   590
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   591
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   592
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   593
  where @{text t} is the definiens (its type @{text \<sigma>} can always be inferred)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   594
  and @{text "c"} is the name of definiendum, whose type @{text "\<tau>"} needs to be
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   595
  given explicitly (the point is that @{text "\<tau>"} and @{text "\<sigma>"} can only differ
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   596
  in places where a quotient and raw type is involved). Two concrete examples are
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   597
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   598
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   599
  \begin{tabular}{@ {}l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   600
  \isacommand{quotient\_definition}~~@{text "0 :: int"}~~\isacommand{is}~~@{text "(0::nat, 0::nat)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   601
  \isacommand{quotient\_definition}~~@{text "\<Union> :: (\<alpha> fset) fset \<Rightarrow> \<alpha> fset"}~~%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   602
  \isacommand{is}~~@{text "flat"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   603
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   604
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   605
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   606
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   607
  The first one declares zero for integers and the second the operator for
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   608
  building unions of finite sets (@{text "flat"} having the type
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   609
  @{text "(\<alpha> list) list \<Rightarrow> \<alpha> list"}).
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   610
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   611
  From such declarations given by the user, the quotient package needs to derive proper
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   612
  definitions using @{text "Abs"} and @{text "Rep"}. The data we rely on is the given quotient type
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   613
  @{text "\<tau>"} and the raw type @{text "\<sigma>"}.  They allow us to define \emph{aggregate
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   614
  abstraction} and \emph{representation functions} using the functions @{text "ABS (\<sigma>,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   615
  \<tau>)"} and @{text "REP (\<sigma>, \<tau>)"} whose clauses we shall give below. The idea behind
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   616
  these two functions is to simultaneously descend into the raw types @{text \<sigma>} and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   617
  quotient types @{text \<tau>}, and generate the appropriate
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   618
  @{text "Abs"} and @{text "Rep"} in places where the types differ. Therefore
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   619
  we generate just the identity whenever the types are equal. On the ``way'' down,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   620
  however we might have to use map-functions to let @{text Abs} and @{text Rep} act
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   621
  over the appropriate types. In what follows we use the short-hand notation
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   622
  @{text "ABS (\<sigma>s, \<tau>s)"} to mean @{text "ABS (\<sigma>\<^isub>1, \<tau>\<^isub>1)\<dots>ABS (\<sigma>\<^isub>n, \<tau>\<^isub>n)"}; similarly
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   623
  for @{text REP}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   624
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   625
  \begin{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   626
  \hfill
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   627
  \begin{tabular}{@ {\hspace{2mm}}l@ {}}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   628
  \multicolumn{1}{@ {}l}{equal types:}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   629
  @{text "ABS (\<sigma>, \<sigma>)"} $\dn$ @{text "id :: \<sigma> \<Rightarrow> \<sigma>"}\hspace{5mm}%\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   630
  @{text "REP (\<sigma>, \<sigma>)"} $\dn$ @{text "id :: \<sigma> \<Rightarrow> \<sigma>"}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   631
  \multicolumn{1}{@ {}l}{function types:}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   632
  @{text "ABS (\<sigma>\<^isub>1 \<Rightarrow> \<sigma>\<^isub>2, \<tau>\<^isub>1 \<Rightarrow> \<tau>\<^isub>2)"} $\dn$ @{text "REP (\<sigma>\<^isub>1, \<tau>\<^isub>1) \<singlearr> ABS (\<sigma>\<^isub>2, \<tau>\<^isub>2)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   633
  @{text "REP (\<sigma>\<^isub>1 \<Rightarrow> \<sigma>\<^isub>2, \<tau>\<^isub>1 \<Rightarrow> \<tau>\<^isub>2)"} $\dn$ @{text "ABS (\<sigma>\<^isub>1, \<tau>\<^isub>1) \<singlearr> REP (\<sigma>\<^isub>2, \<tau>\<^isub>2)"}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   634
  \multicolumn{1}{@ {}l}{equal type constructors:}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   635
  @{text "ABS (\<sigma>s \<kappa>, \<tau>s \<kappa>)"} $\dn$ @{text "map_\<kappa> (ABS (\<sigma>s, \<tau>s))"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   636
  @{text "REP (\<sigma>s \<kappa>, \<tau>s \<kappa>)"} $\dn$ @{text "map_\<kappa> (REP (\<sigma>s, \<tau>s))"}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   637
  \multicolumn{1}{@ {}l}{unequal type constructors:}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   638
  @{text "ABS (\<sigma>s \<kappa>, \<tau>s \<kappa>\<^isub>q)"} $\dn$ @{text "Abs_\<kappa>\<^isub>q \<circ> (MAP(\<rho>s \<kappa>) (ABS (\<sigma>s', \<tau>s)))"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   639
  @{text "REP (\<sigma>s \<kappa>, \<tau>s \<kappa>\<^isub>q)"} $\dn$ @{text "(MAP(\<rho>s \<kappa>) (REP (\<sigma>s', \<tau>s))) \<circ> Rep_\<kappa>\<^isub>q"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   640
  \end{tabular}\hfill\numbered{ABSREP}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   641
  \end{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   642
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   643
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   644
  In the last two clauses are subtle. We rely in them on the fact that the type @{text "\<alpha>s
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   645
  \<kappa>\<^isub>q"} is the quotient of the raw type @{text "\<rho>s \<kappa>"} (for example
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   646
  @{text "int"} and @{text "nat \<times> nat"}, or @{text "\<alpha> fset"} and @{text "\<alpha>
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   647
  list"}). This data is given by declarations shown in \eqref{typedecl}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   648
  The quotient construction ensures that the type variables in @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   649
  "\<rho>s \<kappa>"} must be among the @{text "\<alpha>s"}. The @{text "\<sigma>s'"} are given by the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   650
  substitutions for the @{text "\<alpha>s"} when matching  @{text "\<sigma>s \<kappa>"} against
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   651
  @{text "\<rho>s \<kappa>"}. This calculation determines what are the types in place
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   652
  of the type variables @{text "\<alpha>s"} in the instance of
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   653
  quotient type @{text "\<alpha>s \<kappa>\<^isub>q"}---namely @{text "\<tau>s"}, and the corresponding
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   654
  types in place of the @{text "\<alpha>s"} in the raw type @{text "\<rho>s \<kappa>"}---namely @{text "\<sigma>s'"}. The
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   655
  function @{text "MAP"} calculates an \emph{aggregate map-function} for a raw
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   656
  type as follows:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   657
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   658
  \begin{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   659
  \begin{tabular}{r@ {\hspace{1mm}}c@ {\hspace{1mm}}l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   660
  @{text "MAP' (\<alpha>)"} & $\dn$ & @{text "a\<^sup>\<alpha>"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   661
  @{text "MAP' (\<kappa>)"} & $\dn$ & @{text "id :: \<kappa> \<Rightarrow> \<kappa>"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   662
  @{text "MAP' (\<sigma>s \<kappa>)"} & $\dn$ & @{text "map_\<kappa> (MAP'(\<sigma>s))"}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   663
  @{text "MAP (\<sigma>)"} & $\dn$ & @{text "\<lambda>as. MAP'(\<sigma>)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   664
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   665
  \end{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   666
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   667
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   668
  In this definition we rely on the fact that in the first clause we can interpret type-variables @{text \<alpha>} as
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   669
  term variables @{text a}. In the last clause we build an abstraction over all
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   670
  term-variables of the map-function generated by the auxiliary function
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   671
  @{text "MAP'"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   672
  The need for aggregate map-functions can be seen in cases where we build quotients,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   673
  say @{text "(\<alpha>, \<beta>) \<kappa>\<^isub>q"}, out of compound raw types, say @{text "(\<alpha> list) \<times> \<beta>"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   674
  In this case @{text MAP} generates  the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   675
  aggregate map-function:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   676
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   677
%%% FIXME: Reviewer 2 asks: last two lines defining ABS and REP for
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   678
%%% unequal type constructors: How are the $\varrho$s defined? The
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   679
%%% following paragraph mentions them, but this paragraph is unclear,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   680
%%% since it then mentions $\alpha$s, which do not seem to be defined
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   681
%%% either. As a result, I do not understand the first two sentences
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   682
%%% in this paragraph. I can imagine roughly what the following
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   683
%%% sentence `The $\sigma$s' are given by the matchers for the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   684
%%% $\alpha$s$ when matching $\varrho$s $\kappa$ against $\sigma$s
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   685
%%% $\kappa$.' means, but also think that it is too vague.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   686
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   687
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   688
  @{text "\<lambda>a b. map_prod (map_list a) b"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   689
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   690
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   691
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   692
  which is essential in order to define the corresponding aggregate
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   693
  abstraction and representation functions.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   694
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   695
  To see how these definitions pan out in practise, let us return to our
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   696
  example about @{term "concat"} and @{term "fconcat"}, where we have the raw type
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   697
  @{text "(\<alpha> list) list \<Rightarrow> \<alpha> list"} and the quotient type @{text "(\<alpha> fset) fset \<Rightarrow> \<alpha>
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   698
  fset"}. Feeding these types into @{text ABS} gives us (after some @{text "\<beta>"}-simplifications)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   699
  the abstraction function
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   700
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   701
  \begin{isabelle}\ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   702
  \begin{tabular}{l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   703
  @{text "(map_list (map_list id \<circ> Rep_fset) \<circ> Rep_fset) \<singlearr>"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   704
  \mbox{}\hspace{4.5cm}@{text " Abs_fset \<circ> map_list id"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   705
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   706
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   707
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   708
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   709
  In our implementation we further
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   710
  simplify this function by rewriting with the usual laws about @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   711
  "map"}s and @{text "id"}, for example @{term "map_list id = id"} and @{text "f \<circ> id =
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   712
  id \<circ> f = f"}. This gives us the simpler abstraction function
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   713
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   714
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   715
  @{text "(map_list Rep_fset \<circ> Rep_fset) \<singlearr> Abs_fset"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   716
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   717
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   718
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   719
  which we can use for defining @{term "fconcat"} as follows
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   720
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   721
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   722
  @{text "\<Union> \<equiv> ((map_list Rep_fset \<circ> Rep_fset) \<singlearr> Abs_fset) flat"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   723
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   724
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   725
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   726
  Note that by using the operator @{text "\<singlearr>"} and special clauses
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   727
  for function types in \eqref{ABSREP}, we do not have to
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   728
  distinguish between arguments and results, but can deal with them uniformly.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   729
  Consequently, all definitions in the quotient package
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   730
  are of the general form
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   731
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   732
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   733
  \mbox{@{text "c \<equiv> ABS (\<sigma>, \<tau>) t"}}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   734
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   735
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   736
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   737
  where @{text \<sigma>} is the type of the definiens @{text "t"} and @{text "\<tau>"} the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   738
  type of the defined quotient constant @{text "c"}. This data can be easily
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   739
  generated from the declaration given by the user.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   740
  To increase the confidence in this way of making definitions, we can prove
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   741
  that the terms involved are all typable.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   742
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   743
  \begin{lemma}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   744
  If @{text "ABS (\<sigma>, \<tau>)"} returns some abstraction function @{text "Abs"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   745
  and @{text "REP (\<sigma>, \<tau>)"} some representation function @{text "Rep"},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   746
  then @{text "Abs"} is of type @{text "\<sigma> \<Rightarrow> \<tau>"} and @{text "Rep"} of type
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   747
  @{text "\<tau> \<Rightarrow> \<sigma>"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   748
  \end{lemma}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   749
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   750
  \begin{proof}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   751
  By mutual induction and analysing the definitions of @{text "ABS"} and @{text "REP"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   752
  The cases of equal types and function types are
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   753
  straightforward (the latter follows from @{text "\<singlearr>"} having the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   754
  type @{text "(\<alpha> \<Rightarrow> \<beta>) \<Rightarrow> (\<gamma> \<Rightarrow> \<delta>) \<Rightarrow> (\<beta> \<Rightarrow> \<gamma>) \<Rightarrow> (\<alpha> \<Rightarrow> \<delta>)"}). In case of equal type
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   755
  constructors we can observe that a map-function after applying the functions
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   756
  @{text "ABS (\<sigma>s, \<tau>s)"} produces a term of type @{text "\<sigma>s \<kappa> \<Rightarrow> \<tau>s \<kappa>"}.  The
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   757
  interesting case is the one with unequal type constructors. Since we know
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   758
  the quotient is between @{text "\<alpha>s \<kappa>\<^isub>q"} and @{text "\<rho>s \<kappa>"}, we have
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   759
  that @{text "Abs_\<kappa>\<^isub>q"} is of type @{text "\<rho>s \<kappa> \<Rightarrow> \<alpha>s
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   760
  \<kappa>\<^isub>q"}. This type can be more specialised to @{text "\<rho>s[\<tau>s] \<kappa> \<Rightarrow> \<tau>s
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   761
  \<kappa>\<^isub>q"} where the type variables @{text "\<alpha>s"} are instantiated with the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   762
  @{text "\<tau>s"}. The complete type can be calculated by observing that @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   763
  "MAP (\<rho>s \<kappa>)"}, after applying the functions @{text "ABS (\<sigma>s', \<tau>s)"} to it,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   764
  returns a term of type @{text "\<rho>s[\<sigma>s'] \<kappa> \<Rightarrow> \<rho>s[\<tau>s] \<kappa>"}. This type is
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   765
  equivalent to @{text "\<sigma>s \<kappa> \<Rightarrow> \<rho>s[\<tau>s] \<kappa>"}, which we just have to compose with
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   766
  @{text "\<rho>s[\<tau>s] \<kappa> \<Rightarrow> \<tau>s \<kappa>\<^isub>q"} according to the type of @{text "\<circ>"}.\qed
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   767
  \end{proof}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   768
*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   769
3092
ff377f9d030a some slight tuning
Christian Urban <urbanc@in.tum.de>
parents: 3082
diff changeset
   770
section {* Respectfulness and Preservation \label{sec:resp} *}
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   771
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   772
text {*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   773
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   774
  The main point of the quotient package is to automatically ``lift'' theorems
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   775
  involving constants over the raw type to theorems involving constants over
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   776
  the quotient type. Before we can describe this lifting process, we need to impose
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   777
  two restrictions in form of proof obligations that arise during the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   778
  lifting. The reason is that even if definitions for all raw constants
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   779
  can be given, \emph{not} all theorems can be lifted to the quotient type. Most
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   780
  notable is the bound variable function, that is the constant @{text bn},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   781
  defined
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   782
  for raw lambda-terms as follows
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   783
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   784
  \begin{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   785
  \begin{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   786
  @{text "bn (x) \<equiv> \<emptyset>"}\hspace{4mm}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   787
  @{text "bn (t\<^isub>1 t\<^isub>2) \<equiv> bn (t\<^isub>1) \<union> bn (t\<^isub>2)"}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   788
  @{text "bn (\<lambda>x. t) \<equiv> {x} \<union> bn (t)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   789
  \end{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   790
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   791
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   792
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   793
  We can generate a definition for this constant using @{text ABS} and @{text REP}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   794
  But this constant does \emph{not} respect @{text "\<alpha>"}-equivalence and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   795
  consequently no theorem involving this constant can be lifted to @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   796
  "\<alpha>"}-equated lambda terms. Homeier formulates the restrictions in terms of
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   797
  the properties of \emph{respectfulness} and \emph{preservation}. We have
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   798
  to slightly extend Homeier's definitions in order to deal with quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   799
  compositions.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   800
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   801
%%% FIXME: Reviewer 3 asks why are the definitions that follow enough to deal
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   802
%%% with quotient composition.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   803
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   804
  To formally define what respectfulness is, we have to first define
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   805
  the notion of \emph{aggregate equivalence relations} using the function @{text "REL(\<sigma>, \<tau>)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   806
  The idea behind this function is to simultaneously descend into the raw types
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   807
  @{text \<sigma>} and quotient types @{text \<tau>}, and generate the appropriate
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   808
  quotient equivalence relations in places where the types differ and equalities
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   809
  elsewhere.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   810
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   811
  \begin{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   812
  \hfill
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   813
  \begin{tabular}{l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   814
  \multicolumn{1}{@ {}l}{equal types:}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   815
  @{text "REL (\<sigma>, \<sigma>)"} $\dn$ @{text "= :: \<sigma> \<Rightarrow> \<sigma> \<Rightarrow> bool"}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   816
   \multicolumn{1}{@ {}l}{equal type constructors:}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   817
  @{text "REL (\<sigma>s \<kappa>, \<tau>s \<kappa>)"} $\dn$ @{text "rel_\<kappa> (REL (\<sigma>s, \<tau>s))"}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   818
  \multicolumn{1}{@ {}l}{unequal type constructors:}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   819
  @{text "REL (\<sigma>s \<kappa>, \<tau>s \<kappa>\<^isub>q)"} $\dn$ @{text "rel_\<kappa>\<^isub>q (REL (\<sigma>s', \<tau>s))"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   820
  \end{tabular}\hfill\numbered{REL}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   821
  \end{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   822
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   823
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   824
  The @{text "\<sigma>s'"} in the last clause are calculated as in \eqref{ABSREP}:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   825
  again we know that type @{text "\<alpha>s \<kappa>\<^isub>q"} is the quotient of the raw type
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   826
  @{text "\<rho>s \<kappa>"}. The @{text "\<sigma>s'"} are the substitutions for @{text "\<alpha>s"} obtained by matching
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   827
  @{text "\<rho>s \<kappa>"} and @{text "\<sigma>s \<kappa>"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   828
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   829
  Let us return to the lifting procedure of theorems. Assume we have a theorem
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   830
  that contains the raw constant @{text "c\<^isub>r :: \<sigma>"} and which we want to
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   831
  lift to a theorem where @{text "c\<^isub>r"} is replaced by the corresponding
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   832
  constant @{text "c\<^isub>q :: \<tau>"} defined over a quotient type. In this situation
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   833
  we generate the following proof obligation
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   834
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   835
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   836
  @{text "REL (\<sigma>, \<tau>) c\<^isub>r c\<^isub>r"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   837
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   838
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   839
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   840
  Homeier calls these proof obligations \emph{respectfulness
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   841
  theorems}. However, unlike his quotient package, we might have several
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   842
  respectfulness theorems for one constant---he has at most one.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   843
  The reason is that because of our quotient compositions, the types
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   844
  @{text \<sigma>} and @{text \<tau>} are not completely determined by @{text "c\<^bsub>r\<^esub>"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   845
  And for every instantiation of the types, a corresponding
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   846
  respectfulness theorem is necessary.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   847
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   848
  Before lifting a theorem, we require the user to discharge
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   849
  respectfulness proof obligations. In case of @{text bn}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   850
  this obligation is %%as follows
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   851
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   852
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   853
  @{text  "(\<approx>\<^isub>\<alpha> \<doublearr> =) bn bn"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   854
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   855
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   856
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   857
  and the point is that the user cannot discharge it: because it is not true. To see this,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   858
  we can just unfold the definition of @{text "\<doublearr>"} \eqref{relfun}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   859
  using extensionality to obtain the false statement
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   860
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   861
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   862
  @{text "\<forall>t\<^isub>1 t\<^isub>2. if t\<^isub>1 \<approx>\<^isub>\<alpha> t\<^isub>2 then bn(t\<^isub>1) = bn(t\<^isub>2)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   863
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   864
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   865
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   866
  In contrast, lifting a theorem about @{text "append"} to a theorem describing
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   867
  the union of finite sets will mean to discharge the proof obligation
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   868
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   869
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   870
  @{text "(\<approx>\<^bsub>list\<^esub> \<doublearr> \<approx>\<^bsub>list\<^esub> \<doublearr> \<approx>\<^bsub>list\<^esub>) append append"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   871
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   872
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   873
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   874
  To do so, we have to establish
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   875
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   876
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   877
  if @{text "xs \<approx>\<^bsub>list\<^esub> ys"} and  @{text "us \<approx>\<^bsub>list\<^esub> vs"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   878
  then @{text "xs @ us \<approx>\<^bsub>list\<^esub> ys @ vs"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   879
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   880
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   881
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   882
  which is straightforward given the definition shown in \eqref{listequiv}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   883
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   884
  The second restriction we have to impose arises from non-lifted polymorphic
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   885
  constants, which are instantiated to a type being quotient. For example,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   886
  take the @{term "cons"}-constructor to add a pair of natural numbers to a
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   887
  list, whereby we assume the pair of natural numbers turns into an integer in
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   888
  the quotient construction. The point is that we still want to use @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   889
  cons} for adding integers to lists---just with a different type. To be able
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   890
  to lift such theorems, we need a \emph{preservation property} for @{text
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   891
  cons}. Assuming we have a polymorphic raw constant @{text "c\<^isub>r :: \<sigma>"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   892
  and a corresponding quotient constant @{text "c\<^isub>q :: \<tau>"}, then a
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   893
  preservation property is as follows
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   894
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   895
%%% FIXME: Reviewer 2 asks: You say what a preservation theorem is,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   896
%%% but not which preservation theorems you assume. Do you generate a
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   897
%%% proof obligation for a preservation theorem for each raw constant
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   898
%%% and its corresponding lifted constant?
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   899
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   900
%%% Cezary: I think this would be a nice thing to do but we have not
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   901
%%% done it, the theorems need to be 'guessed' from the remaining obligations
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   902
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   903
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   904
  @{text "Quot R\<^bsub>\<alpha>s\<^esub> Abs\<^bsub>\<alpha>s\<^esub> Rep\<^bsub>\<alpha>s\<^esub> implies  ABS (\<sigma>, \<tau>) c\<^isub>r = c\<^isub>r"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   905
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   906
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   907
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   908
  where the @{text "\<alpha>s"} stand for the type variables in the type of @{text "c\<^isub>r"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   909
  In case of @{text cons} (which has type @{text "\<alpha> \<Rightarrow> \<alpha> list \<Rightarrow> \<alpha> list"}) we have
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   910
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   911
  \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   912
  @{text "(Rep \<singlearr> map_list Rep \<singlearr> map_list Abs) cons = cons"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   913
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   914
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   915
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   916
  under the assumption @{term "Quotient R Abs Rep"}. The point is that if we have
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   917
  an instance of @{text cons} where the type variable @{text \<alpha>} is instantiated
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   918
  with @{text "nat \<times> nat"} and we also quotient this type to yield integers,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   919
  then we need to show this preservation property.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   920
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   921
  %%%@ {thm [display, indent=10] insert_preserve2[no_vars]}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   922
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   923
  %Given two quotients, one of which quotients a container, and the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   924
  %other quotients the type in the container, we can write the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   925
  %composition of those quotients. To compose two quotient theorems
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   926
  %we compose the relations with relation composition as defined above
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   927
  %and the abstraction and relation functions are the ones of the sub
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   928
  %quotients composed with the usual function composition.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   929
  %The @ {term "Rep"} and @ {term "Abs"} functions that we obtain agree
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   930
  %with the definition of aggregate Abs/Rep functions and the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   931
  %relation is the same as the one given by aggregate relations.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   932
  %This becomes especially interesting
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   933
  %when we compose the quotient with itself, as there is no simple
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   934
  %intermediate step.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   935
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   936
  %Lets take again the example of @ {term flat}. To be able to lift
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   937
  %theorems that talk about it we provide the composition quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   938
  %theorem which allows quotienting inside the container:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   939
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   940
  %If @ {term R} is an equivalence relation and @ {term "Quotient R Abs Rep"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   941
  %then
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   942
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   943
  %@ {text [display, indent=10] "Quotient (list_rel R \<circ>\<circ>\<circ> \<approx>\<^bsub>list\<^esub>) (abs_fset \<circ> map_list Abs) (map_list Rep o rep_fset)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   944
  %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   945
  %%%\noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   946
  %%%this theorem will then instantiate the quotients needed in the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   947
  %%%injection and cleaning proofs allowing the lifting procedure to
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   948
  %%%proceed in an unchanged way.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   949
*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   950
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   951
section {* Lifting of Theorems\label{sec:lift} *}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   952
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   953
text {*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   954
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   955
%%% FIXME Reviewer 3 asks: Section 5 shows the technicalities of
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   956
%%% lifting theorems. But there is no clarification about the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   957
%%% correctness. A reader would also be interested in seeing some
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   958
%%% discussions about the generality and limitation of the approach
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   959
%%% proposed there
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   960
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   961
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   962
  The main benefit of a quotient package is to lift automatically theorems over raw
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   963
  types to theorems over quotient types. We will perform this lifting in
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   964
  three phases, called \emph{regularization},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   965
  \emph{injection} and \emph{cleaning} according to procedures in Homeier's ML-code.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   966
  Space restrictions, unfortunately, prevent us from giving anything but a sketch of these three
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   967
  phases. However, we will precisely define the input and output data of these phases
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   968
  (this was omitted in \cite{Homeier05}).
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   969
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   970
  The purpose of regularization is to change the quantifiers and abstractions
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   971
  in a ``raw'' theorem to quantifiers over variables that respect their respective relations
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   972
  (Definition \ref{def:respects} states what respects means). The purpose of injection is to add @{term Rep}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   973
  and @{term Abs} of appropriate types in front of constants and variables
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   974
  of the raw type so that they can be replaced by the corresponding constants from the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   975
  quotient type. The purpose of cleaning is to bring the theorem derived in the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   976
  first two phases into the form the user has specified. Abstractly, our
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   977
  package establishes the following three proof steps:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   978
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   979
%%% FIXME: Reviewer 1 complains that the reader needs to guess the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   980
%%% meaning of reg_thm and inj_thm, as well as the arguments of REG
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   981
%%% which are given above. I wouldn't change it.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   982
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   983
  \begin{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   984
  \begin{tabular}{l@ {\hspace{4mm}}l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   985
  1.) Regularization & @{text "raw_thm \<longrightarrow> reg_thm"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   986
  2.) Injection & @{text "reg_thm \<longleftrightarrow> inj_thm"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   987
  3.) Cleaning & @{text "inj_thm \<longleftrightarrow> quot_thm"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   988
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   989
  \end{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   990
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   991
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   992
  which means, stringed together, the raw theorem implies the quotient theorem.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   993
  In contrast to other quotient packages, our package requires that the user specifies
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   994
  both, the @{text "raw_thm"} (as theorem) and the \emph{term} of the @{text "quot_thm"}.\footnote{Though we
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   995
  also provide a fully automated mode, where the @{text "quot_thm"} is guessed
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   996
  from the form of @{text "raw_thm"}.} As a result, the user has fine control
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   997
  over which parts of a raw theorem should be lifted.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   998
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   999
  The second and third proof step performed in package will always succeed if the appropriate
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1000
  respectfulness and preservation theorems are given. In contrast, the first
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1001
  proof step can fail: a theorem given by the user does not always
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1002
  imply a regularized version and a stronger one needs to be proved. An example
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1003
  for this kind of failure is the simple statement for integers @{text "0 \<noteq> 1"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1004
  One might hope that it can be proved by lifting @{text "(0, 0) \<noteq> (1, 0)"},
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1005
  but this raw theorem only shows that two particular elements in the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1006
  equivalence classes are not equal. In order to obtain @{text "0 \<noteq> 1"}, a
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1007
  more general statement stipulating that the equivalence classes are not
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1008
  equal is necessary.  This kind of failure is beyond the scope where the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1009
  quotient package can help: the user has to provide a raw theorem that
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1010
  can be regularized automatically, or has to provide an explicit proof
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1011
  for the first proof step. Homeier gives more details about this issue
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1012
  in the long version of \cite{Homeier05}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1013
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1014
  In the following we will first define the statement of the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1015
  regularized theorem based on @{text "raw_thm"} and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1016
  @{text "quot_thm"}. Then we define the statement of the injected theorem, based
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1017
  on @{text "reg_thm"} and @{text "quot_thm"}. We then show the three proof steps,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1018
  which can all be performed independently from each other.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1019
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1020
  We first define the function @{text REG}, which takes the terms of the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1021
  @{text "raw_thm"} and @{text "quot_thm"} as input and returns
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1022
  @{text "reg_thm"}. The idea
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1023
  behind this function is that it replaces quantifiers and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1024
  abstractions involving raw types by bounded ones, and equalities
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1025
  involving raw types by appropriate aggregate
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1026
  equivalence relations. It is defined by simultaneous recursion on
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1027
  the structure of  the terms of @{text "raw_thm"} and @{text "quot_thm"} as follows:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1028
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1029
  \begin{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1030
  \begin{tabular}{@ {}l@ {}}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1031
  \multicolumn{1}{@ {}l@ {}}{abstractions:}\\%%\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1032
  @{text "REG (\<lambda>x\<^sup>\<sigma>. t, \<lambda>x\<^sup>\<tau>. s)"} $\dn$
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1033
  $\begin{cases}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1034
  @{text "\<lambda>x\<^sup>\<sigma>. REG (t, s)"} \quad\mbox{provided @{text "\<sigma> = \<tau>"}}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1035
  @{text "\<lambda>x\<^sup>\<sigma> \<in> Resp (REL (\<sigma>, \<tau>)). REG (t, s)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1036
  \end{cases}$\\%%\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1037
  \multicolumn{1}{@ {}l@ {}}{universal quantifiers:}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1038
  @{text "REG (\<forall>x\<^sup>\<sigma>. t, \<forall>x\<^sup>\<tau>. s)"} $\dn$
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1039
  $\begin{cases}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1040
  @{text "\<forall>x\<^sup>\<sigma>. REG (t, s)"} \quad\mbox{provided @{text "\<sigma> = \<tau>"}}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1041
  @{text "\<forall>x\<^sup>\<sigma> \<in> Resp (REL (\<sigma>, \<tau>)). REG (t, s)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1042
  \end{cases}$\\%%\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1043
  \multicolumn{1}{@ {}l@ {}}{equality:  \hspace{3mm}%%}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1044
  %% REL of two equal types is the equality so we do not need a separate case
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1045
  @{text "REG (=\<^bsup>\<sigma>\<Rightarrow>\<sigma>\<Rightarrow>bool\<^esup>, =\<^bsup>\<tau>\<Rightarrow>\<tau>\<Rightarrow>bool\<^esup>)"} $\dn$ @{text "REL (\<sigma>, \<tau>)"}}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1046
  \multicolumn{1}{@ {}l@ {}}{applications, variables and constants:}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1047
  @{text "REG (t\<^isub>1 t\<^isub>2, s\<^isub>1 s\<^isub>2)"} $\dn$ @{text "REG (t\<^isub>1, s\<^isub>1) REG (t\<^isub>2, s\<^isub>2)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1048
  @{text "REG (x\<^isub>1, x\<^isub>2)"} $\dn$ @{text "x\<^isub>1"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1049
  @{text "REG (c\<^isub>1, c\<^isub>2)"} $\dn$ @{text "c\<^isub>1"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1050
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1051
  \end{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1052
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1053
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1054
  In the above definition we omitted the cases for existential quantifiers
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1055
  and unique existential quantifiers, as they are very similar to the cases
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1056
  for the universal quantifier.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1057
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1058
  Next we define the function @{text INJ} which takes as argument
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1059
  @{text "reg_thm"} and @{text "quot_thm"} (both as
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1060
  terms) and returns @{text "inj_thm"}:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1061
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1062
  \begin{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1063
  \begin{tabular}{l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1064
  \multicolumn{1}{@ {}l}{abstractions:}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1065
  @{text "INJ (\<lambda>x. t :: \<sigma>, \<lambda>x. s :: \<tau>) "} $\dn$\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1066
  \hspace{18mm}$\begin{cases}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1067
  @{text "\<lambda>x. INJ (t, s)"} \quad\mbox{provided @{text "\<sigma> = \<tau>"}}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1068
  @{text "REP (\<sigma>, \<tau>) (ABS (\<sigma>, \<tau>) (\<lambda>x. INJ (t, s)))"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1069
  \end{cases}$\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1070
  @{text "INJ (\<lambda>x \<in> R. t :: \<sigma>, \<lambda>x. s :: \<tau>) "} $\dn$\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1071
  \hspace{18mm}@{text "REP (\<sigma>, \<tau>) (ABS (\<sigma>, \<tau>) (\<lambda>x \<in> R. INJ (t, s)))"}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1072
  \multicolumn{1}{@ {}l}{universal quantifiers:}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1073
  @{text "INJ (\<forall> t, \<forall> s) "} $\dn$ @{text "\<forall> INJ (t, s)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1074
  @{text "INJ (\<forall> t \<in> R, \<forall> s) "} $\dn$ @{text "\<forall> INJ (t, s) \<in> R"}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1075
  \multicolumn{1}{@ {}l}{applications, variables and constants:}\smallskip\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1076
  @{text "INJ (t\<^isub>1 t\<^isub>2, s\<^isub>1 s\<^isub>2) "} $\dn$ @{text " INJ (t\<^isub>1, s\<^isub>1) INJ (t\<^isub>2, s\<^isub>2)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1077
  @{text "INJ (x\<^isub>1\<^sup>\<sigma>, x\<^isub>2\<^sup>\<tau>) "} $\dn$
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1078
  $\begin{cases}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1079
  @{text "x\<^isub>1"} \quad\mbox{provided @{text "\<sigma> = \<tau>"}}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1080
  @{text "REP (\<sigma>, \<tau>) (ABS (\<sigma>, \<tau>) x\<^isub>1)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1081
  \end{cases}$\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1082
  @{text "INJ (c\<^isub>1\<^sup>\<sigma>, c\<^isub>2\<^sup>\<tau>) "} $\dn$
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1083
  $\begin{cases}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1084
  @{text "c\<^isub>1"} \quad\mbox{provided @{text "\<sigma> = \<tau>"}}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1085
  @{text "REP (\<sigma>, \<tau>) (ABS (\<sigma>, \<tau>) c\<^isub>1)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1086
  \end{cases}$\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1087
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1088
  \end{center}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1089
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1090
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1091
  In this definition we again omitted the cases for existential and unique existential
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1092
  quantifiers.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1093
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1094
%%% FIXME: Reviewer2 citing following sentence: You mention earlier
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1095
%%% that this implication may fail to be true. Does that meant that
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1096
%%% the `first proof step' is a heuristic that proves the implication
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1097
%%% raw_thm \implies reg_thm in some instances, but fails in others?
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1098
%%% You should clarify under which circumstances the implication is
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1099
%%% being proved here.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1100
%%% Cezary: It would be nice to cite Homeiers discussions in the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1101
%%% Quotient Package manual from HOL (the longer paper), do you agree?
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1102
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1103
  In the first phase, establishing @{text "raw_thm \<longrightarrow> reg_thm"}, we always
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1104
  start with an implication. Isabelle provides \emph{mono} rules that can split up
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1105
  the implications into simpler implicational subgoals. This succeeds for every
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1106
  monotone connective, except in places where the function @{text REG} replaced,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1107
  for instance, a quantifier by a bounded quantifier. To decompose them, we have
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1108
  to prove that the relations involved are aggregate equivalence relations.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1109
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1110
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1111
  %In this case we have
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1112
  %rules of the form
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1113
  %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1114
  % \begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1115
  %@{text "(\<forall>x. R x \<longrightarrow> (P x \<longrightarrow> Q x)) \<longrightarrow> (\<forall>x. P x \<longrightarrow> \<forall>x \<in> R. Q x)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1116
  %\end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1117
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1118
  %\noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1119
  %They decompose a bounded quantifier on the right-hand side. We can decompose a
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1120
  %bounded quantifier anywhere if R is an equivalence relation or
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1121
  %if it is a relation over function types with the range being an equivalence
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1122
  %relation. If @{text R} is an equivalence relation we can prove that
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1123
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1124
  %\begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1125
  %@{text "\<forall>x \<in> Resp R. P x = \<forall>x. P x"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1126
  %\end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1127
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1128
  %\noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1129
  %If @{term R\<^isub>2} is an equivalence relation, we can prove that for any predicate @{term P}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1130
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1131
%%% FIXME Reviewer 1 claims the theorem is obviously false so maybe we
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1132
%%% should include a proof sketch?
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1133
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1134
  %\begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1135
  %@{thm (concl) ball_reg_eqv_range[of R\<^isub>1 R\<^isub>2, no_vars]}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1136
  %\end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1137
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1138
  %\noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1139
  %The last theorem is new in comparison with Homeier's package. There the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1140
  %injection procedure would be used to prove such goals and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1141
  %the assumption about the equivalence relation would be used. We use the above theorem directly,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1142
  %because this allows us to completely separate the first and the second
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1143
  %proof step into two independent ``units''.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1144
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1145
  The second phase, establishing @{text "reg_thm \<longleftrightarrow> inj_thm"},  starts with an equality
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1146
  between the terms of the regularized theorem and the injected theorem.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1147
  The proof again follows the structure of the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1148
  two underlying terms taking respectfulness theorems into account.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1149
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1150
  %\begin{itemize}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1151
  %\item For two constants an appropriate respectfulness theorem is applied.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1152
  %\item For two variables, we use the assumptions proved in the regularization step.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1153
  %\item For two abstractions, we @{text "\<eta>"}-expand and @{text "\<beta>"}-reduce them.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1154
  %\item For two applications, we check that the right-hand side is an application of
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1155
  %  @{term Rep} to an @{term Abs} and @{term "Quotient R Rep Abs"} holds. If yes then we
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1156
  %  can apply the theorem:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1157
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1158
  %\begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1159
  %  @{term "R x y \<longrightarrow> R x (Rep (Abs y))"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1160
  %\end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1161
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1162
  %  Otherwise we introduce an appropriate relation between the subterms
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1163
  %  and continue with two subgoals using the lemma:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1164
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1165
  %\begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1166
  %  @{text "(R\<^isub>1 \<doublearr> R\<^isub>2) f g \<longrightarrow> R\<^isub>1 x y \<longrightarrow> R\<^isub>2 (f x) (g y)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1167
  %\end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1168
  %\end{itemize}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1169
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1170
  We defined the theorem @{text "inj_thm"} in such a way that
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1171
  establishing in the third phase the equivalence @{text "inj_thm \<longleftrightarrow> quot_thm"} can be
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1172
  achieved by rewriting @{text "inj_thm"} with the preservation theorems and quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1173
  definitions. This step also requires that the definitions of all lifted constants
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1174
  are used to fold the @{term Rep} with the raw constants. We will give more details
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1175
  about our lifting procedure in a longer version of this paper.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1176
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1177
  %Next for
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1178
  %all abstractions and quantifiers the lambda and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1179
  %quantifier preservation theorems are used to replace the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1180
  %variables that include raw types with respects by quantifiers
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1181
  %over variables that include quotient types. We show here only
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1182
  %the lambda preservation theorem. Given
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1183
  %@{term "Quotient R\<^isub>1 Abs\<^isub>1 Rep\<^isub>1"} and @{term "Quotient R\<^isub>2 Abs\<^isub>2 Rep\<^isub>2"}, we have:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1184
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1185
  %\begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1186
  %@{thm (concl) lambda_prs[of _ "Abs\<^isub>1" "Rep\<^isub>1" _ "Abs\<^isub>2" "Rep\<^isub>2", no_vars]}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1187
  %\end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1188
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1189
  %\noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1190
  %Next, relations over lifted types can be rewritten to equalities
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1191
  %over lifted type. Rewriting is performed with the following theorem,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1192
  %which has been shown by Homeier~\cite{Homeier05}:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1193
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1194
  %\begin{isabelle}\ \ \ \ \ %%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1195
  %@{thm (concl) Quotient_rel_rep[no_vars]}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1196
  %\end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1197
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1198
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1199
  %Finally, we rewrite with the preservation theorems. This will result
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1200
  %in two equal terms that can be solved by reflexivity.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1201
*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1202
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1203
section {* Conclusion and Related Work\label{sec:conc}*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1204
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1205
text {*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1206
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1207
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1208
  The code of the quotient package and the examples described here are already
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1209
  included in the standard distribution of Isabelle.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1210
  \footnote{Available from \href{http://isabelle.in.tum.de/}{http://isabelle.in.tum.de/}.}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1211
  The package is
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1212
  heavily used in the new version of Nominal Isabelle, which provides a
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1213
  convenient reasoning infrastructure for programming language calculi
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1214
  involving general binders.  To achieve this, it builds types representing
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1215
  @{text \<alpha>}-equivalent terms.  Earlier versions of Nominal Isabelle have been
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1216
  used successfully in formalisations of an equivalence checking algorithm for
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1217
  LF \cite{UrbanCheneyBerghofer08}, Typed
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1218
  Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1219
  \cite{BengtsonParow09} and a strong normalisation result for cut-elimination
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1220
  in classical logic \cite{UrbanZhu08}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1221
3094
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1222
  {\bf INSTEAD OF NOMINAL WORK, GIVE WORK BY BULWAHN ET AL?}
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1223
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1224
  There is a wide range of existing literature for dealing with quotients
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1225
  in theorem provers.  Slotosch~\cite{Slotosch97} implemented a mechanism that
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1226
  automatically defines quotient types for Isabelle/HOL. But he did not
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1227
  include theorem lifting.  Harrison's quotient package~\cite{harrison-thesis}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1228
  is the first one that is able to automatically lift theorems, however only
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1229
  first-order theorems (that is theorems where abstractions, quantifiers and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1230
  variables do not involve functions that include the quotient type). There is
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1231
  also some work on quotient types in non-HOL based systems and logical
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1232
  frameworks, including theory interpretations in
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1233
  PVS~\cite{PVS:Interpretations}, new types in MetaPRL~\cite{Nogin02}, and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1234
  setoids in Coq \cite{ChicliPS02}.  Paulson showed a construction of
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1235
  quotients that does not require the Hilbert Choice operator, but also only
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1236
  first-order theorems can be lifted~\cite{Paulson06}.  The most related work
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1237
  to our package is the package for HOL4 by Homeier~\cite{Homeier05}.  He
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1238
  introduced most of the abstract notions about quotients and also deals with
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1239
  lifting of higher-order theorems. However, he cannot deal with quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1240
  compositions (needed for lifting theorems about @{text flat}). Also, a
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1241
  number of his definitions, like @{text ABS}, @{text REP} and @{text INJ} etc
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1242
  only exist in \cite{Homeier05} as ML-code, not included in the paper.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1243
  Like Homeier's, our quotient package can deal with partial equivalence
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1244
  relations, but for lack of space we do not describe the mechanisms
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1245
  needed for this kind of quotient constructions.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1246
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1247
%%% FIXME Reviewer 3 would like to know more about the lifting in Coq and PVS,
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1248
%%% and some comparison. I don't think we have the space for any additions...
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1249
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1250
  One feature of our quotient package is that when lifting theorems, the user
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1251
  can precisely specify what the lifted theorem should look like. This feature
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1252
  is necessary, for example, when lifting an induction principle for two
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1253
  lists.  Assuming this principle has as the conclusion a predicate of the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1254
  form @{text "P xs ys"}, then we can precisely specify whether we want to
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1255
  quotient @{text "xs"} or @{text "ys"}, or both. We found this feature very
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1256
  useful in the new version of Nominal Isabelle, where such a choice is
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1257
  required to generate a reasoning infrastructure for alpha-equated terms.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1258
%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1259
%% give an example for this
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1260
%%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1261
  \smallskip
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1262
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1263
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1264
  {\bf Acknowledgements:} We would like to thank Peter Homeier for the many
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1265
  discussions about his HOL4 quotient package and explaining to us
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1266
  some of its finer points in the implementation. Without his patient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1267
  help, this work would have been impossible.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1268
*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1269
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1270
text_raw {*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1271
  %%\bibliographystyle{abbrv}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1272
  \bibliography{root}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1273
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1274
  \appendix
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1275
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1276
*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1277
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1278
section {* Examples \label{sec:examples} *}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1279
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1280
text {*
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1281
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1282
%%% FIXME Reviewer 1 would like an example of regularized and injected
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1283
%%% statements. He asks for the examples twice, but I would still ignore
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1284
%%% it due to lack of space...
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1285
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1286
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1287
  In this appendix we will show a sequence of declarations for defining the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1288
  type of integers by quotienting pairs of natural numbers, and
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1289
  lifting one theorem.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1290
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1291
  A user of our quotient package first needs to define a relation on
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1292
  the raw type with which the quotienting will be performed. We give
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1293
  the same integer relation as the one presented in \eqref{natpairequiv}:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1294
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1295
  \begin{isabelle}\ \ \ \ \ %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1296
  \begin{tabular}{@ {}l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1297
  \isacommand{fun}~~@{text "int_rel :: (nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> (nat \<times> nat)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1298
  \isacommand{where}~~@{text "int_rel (m, n) (p, q) = (m + q = n + p)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1299
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1300
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1301
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1302
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1303
  Next the quotient type must be defined. This generates a proof obligation that the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1304
  relation is an equivalence relation, which is solved automatically using the
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1305
  definition of equivalence and extensionality:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1306
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1307
  \begin{isabelle}\ \ \ \ \ %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1308
  \begin{tabular}{@ {}l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1309
  \isacommand{quotient\_type}~~@{text "int"}~~\isacommand{=}~~@{text "(nat \<times> nat)"}~~\isacommand{/}~~@{text "int_rel"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1310
  \hspace{5mm}@{text "by (auto simp add: equivp_def expand_fun_eq)"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1311
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1312
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1313
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1314
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1315
  The user can then specify the constants on the quotient type:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1316
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1317
  \begin{isabelle}\ \ \ \ \ %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1318
  \begin{tabular}{@ {}l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1319
  \isacommand{quotient\_definition}~~@{text "0 :: int"}~~\isacommand{is}~~@{text "(0 :: nat, 0 :: nat)"}\\[3mm]
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1320
  \isacommand{fun}~~@{text "add_pair"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1321
  \isacommand{where}~~%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1322
  @{text "add_pair (m, n) (p, q) \<equiv> (m + p :: nat, n + q :: nat)"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1323
  \isacommand{quotient\_definition}~~@{text "+ :: int \<Rightarrow> int \<Rightarrow> int"}~~%
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1324
  \isacommand{is}~~@{text "add_pair"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1325
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1326
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1327
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1328
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1329
  The following theorem about addition on the raw level can be proved.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1330
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1331
  \begin{isabelle}\ \ \ \ \ %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1332
  \isacommand{lemma}~~@{text "add_pair_zero: int_rel (add_pair (0, 0) x) x"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1333
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1334
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1335
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1336
  If the user lifts this theorem, the quotient package performs all the lifting
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1337
  automatically leaving the respectfulness proof for the constant @{text "add_pair"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1338
  as the only remaining proof obligation. This property needs to be proved by the user:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1339
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1340
  \begin{isabelle}\ \ \ \ \ %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1341
  \begin{tabular}{@ {}l}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1342
  \isacommand{lemma}~~@{text "[quot_respect]:"}\\
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1343
  @{text "(int_rel \<doublearr> int_rel \<doublearr> int_rel) add_pair add_pair"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1344
  \end{tabular}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1345
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1346
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1347
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1348
  It can be discharged automatically by Isabelle when hinting to unfold the definition
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1349
  of @{text "\<doublearr>"}.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1350
  After this, the user can prove the lifted lemma as follows:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1351
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1352
  \begin{isabelle}\ \ \ \ \ %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1353
  \isacommand{lemma}~~@{text "0 + (x :: int) = x"}~~\isacommand{by}~~@{text "lifting add_pair_zero"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1354
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1355
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1356
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1357
  or by using the completely automated mode stating just:
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1358
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1359
  \begin{isabelle}\ \ \ \ \ %
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1360
  \isacommand{thm}~~@{text "add_pair_zero[quot_lifted]"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1361
  \end{isabelle}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1362
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1363
  \noindent
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1364
  Both methods give the same result, namely @{text "0 + x = x"}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1365
  where @{text x} is of type integer.
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1366
  Although seemingly simple, arriving at this result without the help of a quotient
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1367
  package requires a substantial reasoning effort (see \cite{Paulson06}).
3094
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1368
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1369
  {\bf \begin{itemize}
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1370
  \item Type maps and Relation maps (show the case for functions)
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1371
  \item Quotient extensions
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1372
  \item Respectfulness and preservation
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1373
  - Show special cases for quantifiers and lambda
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1374
  \item Quotient-type locale
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1375
  - Show the proof as much simpler than Homeier's one
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1376
  \item ??? Infrastructure for storing theorems (rsp, prs, eqv, quot and idsimp)
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1377
  \item Lifting vs Descending vs quot\_lifted
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1378
  - automatic theorem translation heuristic
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1379
  \item Partial equivalence quotients
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1380
  - Bounded abstraction
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1381
  - Respects
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1382
  - partial descending
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1383
  \item The heuristics for automatic regularization, injection and cleaning.
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1384
  \item A complete example of a lifted theorem together with the regularized
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1385
  injected and cleaned statement
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1386
  \item Examples of quotients and properties that we used the package for.
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1387
  \item co/contra-variance from Ondrej should be taken into account
8bad9887ad90 moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents: 3092
diff changeset
  1388
  \end{itemize}}
3082
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1389
*}
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1390
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1391
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1392
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1393
(*<*)
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1394
end
a6b0220fb8ae Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
  1395
(*>*)