author | Cezary Kaliszyk <cezarykaliszyk@gmail.com> |
Thu, 09 Feb 2012 14:47:24 +0100 | |
changeset 3118 | c9633254a4ec |
parent 3115 | 3748acdef916 |
child 3119 | ed0196555690 |
permissions | -rw-r--r-- |
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 |
|
3118 | 40 |
declare [[show_question_marks = false]] |
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
|
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 |
(*>*) |
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
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
|
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 |
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
|
67 |
\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
|
68 |
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
|
69 |
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
|
70 |
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
|
71 |
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
|
72 |
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
|
73 |
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
|
74 |
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
|
75 |
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
|
76 |
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
|
77 |
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
|
78 |
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
|
79 |
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
|
80 |
\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
|
81 |
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
|
82 |
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
|
83 |
|
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
\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
|
86 |
@{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
|
87 |
\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
|
88 |
|
a6b0220fb8ae
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 |
\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
|
90 |
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
|
91 |
"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
|
92 |
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
|
93 |
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
|
94 |
terms of operations on pairs of natural numbers: |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
95 |
|
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
96 |
\begin{isabelle}\ \ \ \ \ %%% |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
97 |
@{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
|
98 |
\end{isabelle} |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
99 |
|
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
100 |
\noindent |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
101 |
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
|
102 |
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
|
103 |
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
|
104 |
|
a6b0220fb8ae
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 |
\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
|
106 |
@{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
|
107 |
\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
|
108 |
|
a6b0220fb8ae
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 |
\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
|
110 |
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
|
111 |
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
|
112 |
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
|
113 |
@{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
|
114 |
|
a6b0220fb8ae
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 |
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
|
116 |
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
|
117 |
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
|
118 |
|
a6b0220fb8ae
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 |
\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
|
120 |
@{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
|
121 |
\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
|
122 |
|
a6b0220fb8ae
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 |
\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
|
124 |
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
|
125 |
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
|
126 |
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
|
127 |
\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
|
128 |
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
|
129 |
$\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
|
130 |
$\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
|
131 |
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
|
132 |
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
|
133 |
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
|
134 |
|
3092 | 135 |
{\bf MAYBE AN EAMPLE FOR PARTIAL QUOTIENTS?} |
136 |
||
137 |
||
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
|
138 |
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
|
139 |
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
|
140 |
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
|
141 |
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
|
142 |
(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
|
143 |
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
|
144 |
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
|
145 |
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
|
146 |
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
|
147 |
|
a6b0220fb8ae
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 |
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
|
149 |
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
|
150 |
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
|
151 |
\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
|
152 |
\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
|
153 |
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
|
154 |
|
a6b0220fb8ae
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 |
%%% 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
|
156 |
%%% 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
|
157 |
%%% 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
|
158 |
%%% 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
|
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 |
%%% 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
|
161 |
%%% 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
|
162 |
|
a6b0220fb8ae
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 |
\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
|
164 |
\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
|
165 |
%%\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
|
166 |
|
a6b0220fb8ae
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 |
\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
|
168 |
\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
|
169 |
\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
|
170 |
|
a6b0220fb8ae
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 |
\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
|
172 |
\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
|
173 |
|
a6b0220fb8ae
Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
174 |
\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
|
175 |
\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
|
176 |
\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
|
177 |
{\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
|
178 |
\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
|
179 |
|
a6b0220fb8ae
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 |
\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
|
181 |
\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
|
182 |
\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
|
183 |
\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
|
184 |
\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
|
185 |
\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
|
186 |
|
a6b0220fb8ae
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 |
\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
|
188 |
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
|
189 |
\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
|
190 |
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
|
191 |
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
|
192 |
\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
|
193 |
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
|
194 |
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
|
195 |
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
|
196 |
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
|
197 |
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
|
198 |
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
|
199 |
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
|
200 |
|
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
\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
|
203 |
@{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
|
204 |
\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
|
205 |
|
a6b0220fb8ae
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 |
\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
|
207 |
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
|
208 |
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
|
209 |
|
a6b0220fb8ae
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 |
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
|
211 |
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
|
212 |
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
|
213 |
"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
|
214 |
|
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
\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
|
217 |
@{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
|
218 |
\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
|
219 |
|
a6b0220fb8ae
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 |
\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
|
221 |
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
|
222 |
@{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
|
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 |
\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
|
225 |
@{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
|
226 |
\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
|
227 |
\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
|
228 |
|
a6b0220fb8ae
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 |
\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
|
230 |
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
|
231 |
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
|
232 |
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
|
233 |
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
|
234 |
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
|
235 |
\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
|
236 |
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
|
237 |
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
|
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 |
@{thm concat.simps(1)[THEN eq_reflection]}\hspace{10mm} |
3118 | 241 |
@{thm concat.simps(2)[THEN eq_reflection]} |
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
|
242 |
\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
|
243 |
|
a6b0220fb8ae
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 |
\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
|
245 |
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
|
246 |
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
|
247 |
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
|
248 |
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
|
249 |
|
a6b0220fb8ae
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 |
\begin{isabelle}\ \ \ \ \ %%% |
3118 | 251 |
@{thm concat_empty_fset[THEN eq_reflection]}\hspace{10mm} |
252 |
@{thm concat_insert_fset[THEN eq_reflection]} |
|
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
|
253 |
\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
|
254 |
|
a6b0220fb8ae
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 |
\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
|
256 |
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
|
257 |
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
|
258 |
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
|
259 |
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
|
260 |
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
|
261 |
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
|
262 |
|
a6b0220fb8ae
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 |
\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
|
264 |
@{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
|
265 |
\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
|
266 |
|
a6b0220fb8ae
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 |
\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
|
268 |
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
|
269 |
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
|
270 |
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
|
271 |
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
|
272 |
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
|
273 |
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
|
274 |
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
|
275 |
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
|
276 |
|
a6b0220fb8ae
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 |
\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
|
278 |
@{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
|
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 @{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
|
283 |
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
|
284 |
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
|
285 |
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
|
286 |
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
|
287 |
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
|
288 |
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
|
289 |
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
|
290 |
|
3118 | 291 |
{\bf EXAMPLE BY HUFFMAN @{thm map_concat_fset}} |
3094
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
292 |
|
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
|
293 |
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
|
294 |
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
|
295 |
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
|
296 |
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
|
297 |
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
|
298 |
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
|
299 |
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
|
300 |
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
|
301 |
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
|
302 |
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
|
303 |
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
|
304 |
*} |
a6b0220fb8ae
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 |
|
3092 | 306 |
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
|
307 |
|
a6b0220fb8ae
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 |
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
|
309 |
\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
|
310 |
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
|
311 |
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
|
312 |
|
a6b0220fb8ae
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 |
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
|
314 |
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
|
315 |
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
|
316 |
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
|
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 |
\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
|
319 |
\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
|
320 |
@{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
|
321 |
@{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
|
322 |
\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
|
323 |
\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
|
324 |
|
a6b0220fb8ae
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 |
\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
|
326 |
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
|
327 |
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
|
328 |
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
|
329 |
@{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
|
330 |
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
|
331 |
"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
|
332 |
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
|
333 |
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
|
334 |
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
|
335 |
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
|
336 |
|
a6b0220fb8ae
Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
337 |
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
|
338 |
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
|
339 |
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
|
340 |
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
|
341 |
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
|
342 |
|
a6b0220fb8ae
Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
343 |
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
|
344 |
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
|
345 |
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
|
346 |
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
|
347 |
|
a6b0220fb8ae
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 |
\begin{isabelle}\ \ \ \ \ %%% |
3118 | 349 |
@{thm map_fun_def[THEN eq_reflection]} |
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
|
350 |
\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
|
351 |
|
a6b0220fb8ae
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 |
\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
|
353 |
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
|
354 |
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
|
355 |
|
a6b0220fb8ae
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{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
|
357 |
@{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
|
358 |
\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
|
359 |
|
a6b0220fb8ae
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 |
\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
|
361 |
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
|
362 |
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
|
363 |
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
|
364 |
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
|
365 |
%% 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
|
366 |
%% 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
|
367 |
%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
|
368 |
%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
|
369 |
%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
|
370 |
%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
|
371 |
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
|
372 |
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
|
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 |
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
|
375 |
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
|
376 |
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
|
377 |
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
|
378 |
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
|
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 |
\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
|
381 |
@{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
|
382 |
\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
|
383 |
|
a6b0220fb8ae
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 |
\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
|
385 |
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
|
386 |
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
|
387 |
% |
a6b0220fb8ae
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 |
\begin{isabelle}\ \ \ \ \ %%% |
3118 | 389 |
@{thm fun_rel_def[of "R\<^isub>1" "R\<^isub>2", THEN eq_reflection]} |
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
|
390 |
\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
|
391 |
\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
|
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 |
\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
|
394 |
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
|
395 |
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
|
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 |
\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
|
398 |
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
|
399 |
\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
|
400 |
|
a6b0220fb8ae
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 |
\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
|
402 |
@{text "\<forall>x \<in> S. P x"} holds if for all @{text x}, @{text "x \<in> S"} implies @{text "P x"}; |
3114
a9a4baa7779f
2 typos found by John Wickerson in QPaper
Christian Urban <urbanc@in.tum.de>
parents:
3094
diff
changeset
|
403 |
and @{text "(\<lambda>x \<in> S. f x) x = f x"} provided @{text "x \<in> S"}. |
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
|
404 |
\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
|
405 |
|
a6b0220fb8ae
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 |
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
|
407 |
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
|
408 |
|
a6b0220fb8ae
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 |
\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
|
410 |
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
|
411 |
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
|
412 |
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
|
413 |
\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
|
414 |
\begin{tabular}{rl} |
3118 | 415 |
(i) & \begin{isa}@{thm (rhs1) Quotient_def[of "R"]}\end{isa}\\ |
416 |
(ii) & \begin{isa}@{thm (rhs2) Quotient_def[of "R"]}\end{isa}\\ |
|
417 |
(iii) & \begin{isa}@{thm (rhs3) Quotient_def[of "R"]}\end{isa}\\ |
|
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
|
418 |
\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
|
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 |
\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
|
421 |
|
a6b0220fb8ae
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 |
\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
|
423 |
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
|
424 |
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
|
425 |
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
|
426 |
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
|
427 |
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
|
428 |
|
a6b0220fb8ae
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 |
\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
|
430 |
\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
|
431 |
@{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
|
432 |
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
|
433 |
\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
|
434 |
\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
|
435 |
|
a6b0220fb8ae
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 |
\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
|
437 |
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
|
438 |
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
|
439 |
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
|
440 |
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
|
441 |
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
|
442 |
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
|
443 |
|
a6b0220fb8ae
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 |
%%% 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
|
445 |
%%% 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
|
446 |
|
a6b0220fb8ae
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 |
\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
|
448 |
@{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
|
449 |
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
|
450 |
@{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
|
451 |
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
|
452 |
@{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
|
453 |
\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
|
454 |
|
a6b0220fb8ae
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 |
\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
|
456 |
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
|
457 |
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
|
458 |
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
|
459 |
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
|
460 |
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
|
461 |
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
|
462 |
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
|
463 |
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
|
464 |
|
a6b0220fb8ae
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 |
\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
|
466 |
\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
|
467 |
@{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
|
468 |
& @{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
|
469 |
\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
|
470 |
\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
|
471 |
*} |
a6b0220fb8ae
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 |
|
3092 | 473 |
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
|
474 |
|
a6b0220fb8ae
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 |
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
|
476 |
\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
|
477 |
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
|
478 |
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
|
479 |
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
|
480 |
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
|
481 |
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
|
482 |
|
a6b0220fb8ae
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 |
\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
|
484 |
\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
|
485 |
\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
|
486 |
|
a6b0220fb8ae
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 |
\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
|
488 |
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
|
489 |
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
|
490 |
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
|
491 |
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
|
492 |
|
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
\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
|
495 |
\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
|
496 |
\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
|
497 |
\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
|
498 |
\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
|
499 |
\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
|
500 |
|
a6b0220fb8ae
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 |
\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
|
502 |
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
|
503 |
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
|
504 |
"\<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
|
505 |
\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
|
506 |
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
|
507 |
\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
|
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 |
\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
|
510 |
\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
|
511 |
\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
|
512 |
|
a6b0220fb8ae
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 |
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
|
515 |
@{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
|
516 |
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
|
517 |
"\<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
|
518 |
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
|
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 |
@{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
|
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 |
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
|
526 |
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
|
527 |
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
|
528 |
|
a6b0220fb8ae
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 |
\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
|
530 |
@{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
|
531 |
\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
|
532 |
|
a6b0220fb8ae
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 |
\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
|
534 |
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
|
535 |
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
|
536 |
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
|
537 |
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
|
538 |
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
|
539 |
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
|
540 |
(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
|
541 |
|
a6b0220fb8ae
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 |
\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
|
543 |
\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
|
544 |
\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
|
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 |
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
|
547 |
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
|
548 |
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
|
549 |
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
|
550 |
|
a6b0220fb8ae
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 |
\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
|
552 |
\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
|
553 |
\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
|
554 |
|
a6b0220fb8ae
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 |
\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
|
556 |
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
|
557 |
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
|
558 |
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
|
559 |
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
|
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 |
\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
|
562 |
\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
|
563 |
\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
|
564 |
\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
|
565 |
\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
|
566 |
\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
|
567 |
\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
|
568 |
|
a6b0220fb8ae
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 |
\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
|
570 |
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
|
571 |
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
|
572 |
@{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
|
573 |
|
a6b0220fb8ae
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 |
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
|
575 |
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
|
576 |
@{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
|
577 |
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
|
578 |
\<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
|
579 |
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
|
580 |
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
|
581 |
@{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
|
582 |
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
|
583 |
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
|
584 |
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
|
585 |
@{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
|
586 |
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
|
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{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
|
589 |
\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
|
590 |
\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
|
591 |
\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
|
592 |
@{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
|
593 |
@{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
|
594 |
\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
|
595 |
@{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
|
596 |
@{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
|
597 |
\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
|
598 |
@{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
|
599 |
@{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
|
600 |
\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
|
601 |
@{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
|
602 |
@{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
|
603 |
\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
|
604 |
\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
|
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 |
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
|
608 |
\<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
|
609 |
@{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
|
610 |
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
|
611 |
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
|
612 |
"\<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
|
613 |
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
|
614 |
@{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
|
615 |
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
|
616 |
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
|
617 |
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
|
618 |
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
|
619 |
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
|
620 |
% |
a6b0220fb8ae
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 |
\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
|
622 |
\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
|
623 |
@{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
|
624 |
@{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
|
625 |
@{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
|
626 |
@{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
|
627 |
\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
|
628 |
\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
|
629 |
% |
a6b0220fb8ae
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 |
\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
|
631 |
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
|
632 |
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
|
633 |
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
|
634 |
@{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
|
635 |
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
|
636 |
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
|
637 |
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
|
638 |
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
|
639 |
|
a6b0220fb8ae
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 |
%%% 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
|
641 |
%%% 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
|
642 |
%%% 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
|
643 |
%%% 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
|
644 |
%%% 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
|
645 |
%%% 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
|
646 |
%%% 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
|
647 |
%%% $\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
|
648 |
%%% $\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
|
649 |
|
a6b0220fb8ae
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 |
\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
|
651 |
@{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
|
652 |
\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
|
653 |
|
a6b0220fb8ae
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 |
\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
|
655 |
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
|
656 |
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
|
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 |
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
|
659 |
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
|
660 |
@{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
|
661 |
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
|
662 |
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
|
663 |
|
a6b0220fb8ae
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 |
\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
|
665 |
\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
|
666 |
@{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
|
667 |
\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
|
668 |
\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
|
669 |
\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
|
670 |
|
a6b0220fb8ae
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 |
\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
|
672 |
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
|
673 |
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
|
674 |
"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
|
675 |
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
|
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 |
\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
|
678 |
@{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
|
679 |
\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
|
680 |
|
a6b0220fb8ae
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 |
\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
|
682 |
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
|
683 |
|
a6b0220fb8ae
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 |
\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
|
685 |
@{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
|
686 |
\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
|
687 |
|
a6b0220fb8ae
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 |
\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
|
689 |
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
|
690 |
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
|
691 |
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
|
692 |
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
|
693 |
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
|
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 |
\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
|
696 |
\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
|
697 |
\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
|
698 |
|
a6b0220fb8ae
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 |
\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
|
700 |
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
|
701 |
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
|
702 |
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
|
703 |
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
|
704 |
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
|
705 |
|
a6b0220fb8ae
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 |
\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
|
707 |
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
|
708 |
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
|
709 |
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
|
710 |
@{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
|
711 |
\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
|
712 |
|
a6b0220fb8ae
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 |
\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
|
714 |
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
|
715 |
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
|
716 |
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
|
717 |
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
|
718 |
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
|
719 |
@{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
|
720 |
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
|
721 |
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
|
722 |
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
|
723 |
\<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
|
724 |
\<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
|
725 |
@{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
|
726 |
"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
|
727 |
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
|
728 |
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
|
729 |
@{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
|
730 |
\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
|
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 |
|
3092 | 733 |
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
|
734 |
|
a6b0220fb8ae
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 |
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
|
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 |
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
|
738 |
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
|
739 |
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
|
740 |
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
|
741 |
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
|
742 |
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
|
743 |
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
|
744 |
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
|
745 |
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
|
746 |
|
a6b0220fb8ae
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 |
\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
|
748 |
\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
|
749 |
@{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
|
750 |
@{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
|
751 |
@{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
|
752 |
\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
|
753 |
\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
|
754 |
|
a6b0220fb8ae
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 |
\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
|
756 |
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
|
757 |
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
|
758 |
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
|
759 |
"\<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
|
760 |
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
|
761 |
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
|
762 |
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
|
763 |
|
a6b0220fb8ae
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 |
%%% 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
|
765 |
%%% 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
|
766 |
|
a6b0220fb8ae
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 |
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
|
768 |
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
|
769 |
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
|
770 |
@{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
|
771 |
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
|
772 |
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
|
773 |
|
a6b0220fb8ae
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 |
\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
|
775 |
\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
|
776 |
\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
|
777 |
\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
|
778 |
@{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
|
779 |
\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
|
780 |
@{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
|
781 |
\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
|
782 |
@{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
|
783 |
\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
|
784 |
\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
|
785 |
|
a6b0220fb8ae
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 |
\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
|
787 |
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
|
788 |
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
|
789 |
@{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
|
790 |
@{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
|
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 |
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
|
793 |
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
|
794 |
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
|
795 |
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
|
796 |
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
|
797 |
|
a6b0220fb8ae
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 |
\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
|
799 |
@{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
|
800 |
\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
|
801 |
|
a6b0220fb8ae
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 |
\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
|
803 |
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
|
804 |
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
|
805 |
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
|
806 |
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
|
807 |
@{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
|
808 |
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
|
809 |
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
|
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 |
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
|
812 |
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
|
813 |
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
|
814 |
|
a6b0220fb8ae
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 |
\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
|
816 |
@{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
|
817 |
\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
|
818 |
|
a6b0220fb8ae
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 |
\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
|
820 |
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
|
821 |
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
|
822 |
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
|
823 |
|
a6b0220fb8ae
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 |
\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
|
825 |
@{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
|
826 |
\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
|
827 |
|
a6b0220fb8ae
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 |
\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
|
829 |
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
|
830 |
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
|
831 |
|
a6b0220fb8ae
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 |
\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
|
833 |
@{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
|
834 |
\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
|
835 |
|
a6b0220fb8ae
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 |
\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
|
837 |
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
|
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 |
\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
|
840 |
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
|
841 |
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
|
842 |
\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
|
843 |
|
a6b0220fb8ae
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 |
\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
|
845 |
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
|
846 |
|
a6b0220fb8ae
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 |
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
|
848 |
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
|
849 |
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
|
850 |
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
|
851 |
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
|
852 |
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
|
853 |
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
|
854 |
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
|
855 |
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
|
856 |
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
|
857 |
|
a6b0220fb8ae
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 |
%%% 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
|
859 |
%%% 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
|
860 |
%%% 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
|
861 |
%%% 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
|
862 |
|
a6b0220fb8ae
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 |
%%% 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
|
864 |
%%% 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
|
865 |
|
a6b0220fb8ae
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 |
\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
|
867 |
@{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
|
868 |
\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
|
869 |
|
a6b0220fb8ae
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 |
\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
|
871 |
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
|
872 |
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
|
873 |
|
a6b0220fb8ae
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 |
\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
|
875 |
@{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
|
876 |
\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
|
877 |
|
a6b0220fb8ae
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 |
\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
|
879 |
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
|
880 |
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
|
881 |
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
|
882 |
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
|
883 |
|
3118 | 884 |
%%%@ {thm [display, indent=10] Cons_prs2} |
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
|
885 |
|
a6b0220fb8ae
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 |
%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
|
887 |
%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
|
888 |
%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
|
889 |
%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
|
890 |
%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
|
891 |
%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
|
892 |
%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
|
893 |
%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
|
894 |
%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
|
895 |
%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
|
896 |
%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
|
897 |
%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
|
898 |
% |
a6b0220fb8ae
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 |
%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
|
900 |
%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
|
901 |
%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
|
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 |
%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
|
904 |
%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
|
905 |
% |
a6b0220fb8ae
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 |
%@ {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
|
907 |
%%% |
a6b0220fb8ae
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 |
%%%\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
|
909 |
%%%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
|
910 |
%%%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
|
911 |
%%%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
|
912 |
*} |
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
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
|
915 |
|
a6b0220fb8ae
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 |
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
|
917 |
|
a6b0220fb8ae
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 |
%%% 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
|
919 |
%%% 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
|
920 |
%%% 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
|
921 |
%%% 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
|
922 |
%%% 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
|
923 |
|
a6b0220fb8ae
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 |
\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
|
925 |
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
|
926 |
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
|
927 |
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
|
928 |
\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
|
929 |
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
|
930 |
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
|
931 |
(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
|
932 |
|
a6b0220fb8ae
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 |
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
|
934 |
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
|
935 |
(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
|
936 |
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
|
937 |
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
|
938 |
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
|
939 |
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
|
940 |
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
|
941 |
|
a6b0220fb8ae
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 |
%%% 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
|
943 |
%%% 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
|
944 |
%%% 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
|
945 |
|
a6b0220fb8ae
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 |
\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
|
947 |
\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
|
948 |
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
|
949 |
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
|
950 |
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
|
951 |
\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
|
952 |
\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
|
953 |
|
a6b0220fb8ae
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 |
\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
|
955 |
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
|
956 |
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
|
957 |
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
|
958 |
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
|
959 |
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
|
960 |
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
|
961 |
|
a6b0220fb8ae
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 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
|
963 |
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
|
964 |
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
|
965 |
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
|
966 |
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
|
967 |
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
|
968 |
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
|
969 |
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
|
970 |
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
|
971 |
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
|
972 |
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
|
973 |
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
|
974 |
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
|
975 |
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
|
976 |
|
a6b0220fb8ae
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 |
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
|
978 |
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
|
979 |
@{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
|
980 |
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
|
981 |
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
|
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 |
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
|
984 |
@{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
|
985 |
@{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
|
986 |
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
|
987 |
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
|
988 |
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
|
989 |
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
|
990 |
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
|
991 |
% |
a6b0220fb8ae
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 |
\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
|
993 |
\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
|
994 |
\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
|
995 |
@{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
|
996 |
$\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
|
997 |
@{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
|
998 |
@{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
|
999 |
\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
|
1000 |
\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
|
1001 |
@{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
|
1002 |
$\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
|
1003 |
@{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
|
1004 |
@{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
|
1005 |
\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
|
1006 |
\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
|
1007 |
%% 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
|
1008 |
@{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
|
1009 |
\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
|
1010 |
@{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
|
1011 |
@{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
|
1012 |
@{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
|
1013 |
\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
|
1014 |
\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
|
1015 |
% |
a6b0220fb8ae
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 |
\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
|
1017 |
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
|
1018 |
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
|
1019 |
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
|
1020 |
|
a6b0220fb8ae
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 |
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
|
1022 |
@{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
|
1023 |
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
|
1024 |
|
a6b0220fb8ae
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 |
\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
|
1026 |
\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
|
1027 |
\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
|
1028 |
@{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
|
1029 |
\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
|
1030 |
@{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
|
1031 |
@{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
|
1032 |
\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
|
1033 |
@{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
|
1034 |
\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
|
1035 |
\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
|
1036 |
@{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
|
1037 |
@{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
|
1038 |
\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
|
1039 |
@{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
|
1040 |
@{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
|
1041 |
$\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
|
1042 |
@{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
|
1043 |
@{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
|
1044 |
\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
|
1045 |
@{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
|
1046 |
$\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
|
1047 |
@{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
|
1048 |
@{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
|
1049 |
\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
|
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 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
|
1055 |
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
|
1056 |
|
a6b0220fb8ae
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 |
%%% 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
|
1058 |
%%% 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
|
1059 |
%%% 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
|
1060 |
%%% 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
|
1061 |
%%% 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
|
1062 |
%%% 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
|
1063 |
%%% 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
|
1064 |
%%% 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
|
1065 |
|
a6b0220fb8ae
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 |
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
|
1067 |
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
|
1068 |
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
|
1069 |
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
|
1070 |
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
|
1071 |
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
|
1072 |
|
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
%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
|
1075 |
%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
|
1076 |
% |
a6b0220fb8ae
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 |
% \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
|
1078 |
%@{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
|
1079 |
%\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
|
1080 |
|
a6b0220fb8ae
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 |
%\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
|
1082 |
%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
|
1083 |
%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
|
1084 |
%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
|
1085 |
%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
|
1086 |
|
a6b0220fb8ae
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 |
%\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
|
1088 |
%@{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
|
1089 |
%\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
|
1090 |
|
a6b0220fb8ae
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 |
%\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
|
1092 |
%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
|
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 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
|
1095 |
%%% 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
|
1096 |
|
a6b0220fb8ae
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 |
%\begin{isabelle}\ \ \ \ \ %%% |
3118 | 1098 |
%@{thm (concl) ball_reg_eqv_range[of R\<^isub>1 R\<^isub>2]} |
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
|
1099 |
%\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
|
1100 |
|
a6b0220fb8ae
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 |
%\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
|
1102 |
%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
|
1103 |
%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
|
1104 |
%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
|
1105 |
%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
|
1106 |
%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
|
1107 |
|
a6b0220fb8ae
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 |
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
|
1109 |
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
|
1110 |
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
|
1111 |
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
|
1112 |
|
a6b0220fb8ae
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 |
%\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
|
1114 |
%\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
|
1115 |
%\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
|
1116 |
%\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
|
1117 |
%\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
|
1118 |
% @{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
|
1119 |
% 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
|
1120 |
|
a6b0220fb8ae
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 |
%\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
|
1122 |
% @{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
|
1123 |
%\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
|
1124 |
|
a6b0220fb8ae
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 |
% 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
|
1126 |
% 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
|
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 |
%\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
|
1129 |
% @{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
|
1130 |
%\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
|
1131 |
%\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
|
1132 |
|
a6b0220fb8ae
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 |
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
|
1134 |
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
|
1135 |
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
|
1136 |
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
|
1137 |
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
|
1138 |
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
|
1139 |
|
a6b0220fb8ae
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 |
%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
|
1141 |
%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
|
1142 |
%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
|
1143 |
%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
|
1144 |
%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
|
1145 |
%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
|
1146 |
%@{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
|
1147 |
|
a6b0220fb8ae
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 |
%\begin{isabelle}\ \ \ \ \ %%% |
3118 | 1149 |
%@{thm (concl) lambda_prs[of _ "Abs\<^isub>1" "Rep\<^isub>1" _ "Abs\<^isub>2" "Rep\<^isub>2"]} |
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
|
1150 |
%\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
|
1151 |
|
a6b0220fb8ae
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 |
%\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
|
1153 |
%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
|
1154 |
%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
|
1155 |
%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
|
1156 |
|
a6b0220fb8ae
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 |
%\begin{isabelle}\ \ \ \ \ %%% |
3118 | 1158 |
%@{thm (concl) Quotient_rel_rep} |
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
|
1159 |
%\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
|
1160 |
|
a6b0220fb8ae
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 |
%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
|
1163 |
%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
|
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 |
|
a6b0220fb8ae
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 |
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
|
1167 |
|
a6b0220fb8ae
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 |
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
|
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 |
\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
|
1171 |
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
|
1172 |
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
|
1173 |
\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
|
1174 |
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
|
1175 |
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
|
1176 |
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
|
1177 |
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
|
1178 |
@{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
|
1179 |
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
|
1180 |
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
|
1181 |
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
|
1182 |
\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
|
1183 |
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
|
1184 |
|
3094
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1185 |
{\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
|
1186 |
|
a6b0220fb8ae
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 |
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
|
1188 |
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
|
1189 |
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
|
1190 |
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
|
1191 |
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
|
1192 |
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
|
1193 |
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
|
1194 |
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
|
1195 |
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
|
1196 |
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
|
1197 |
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
|
1198 |
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
|
1199 |
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
|
1200 |
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
|
1201 |
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
|
1202 |
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
|
1203 |
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
|
1204 |
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
|
1205 |
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
|
1206 |
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
|
1207 |
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
|
1208 |
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
|
1209 |
|
a6b0220fb8ae
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 |
%%% 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
|
1211 |
%%% 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
|
1212 |
|
a6b0220fb8ae
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 |
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
|
1214 |
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
|
1215 |
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
|
1216 |
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
|
1217 |
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
|
1218 |
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
|
1219 |
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
|
1220 |
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
|
1221 |
%% |
a6b0220fb8ae
Added an initial version of qpaper-jv and a TODO of things to write about.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1222 |
%% 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
|
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 |
\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
|
1225 |
|
a6b0220fb8ae
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 |
\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
|
1227 |
{\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
|
1228 |
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
|
1229 |
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
|
1230 |
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
|
1231 |
*} |
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
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
|
1234 |
%%\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
|
1235 |
\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
|
1236 |
|
a6b0220fb8ae
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 |
\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
|
1238 |
|
a6b0220fb8ae
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 |
*} |
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
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
|
1242 |
|
a6b0220fb8ae
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 |
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
|
1244 |
|
a6b0220fb8ae
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 |
%%% 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
|
1246 |
%%% 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
|
1247 |
%%% 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
|
1248 |
|
a6b0220fb8ae
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 |
\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
|
1250 |
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
|
1251 |
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
|
1252 |
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
|
1253 |
|
a6b0220fb8ae
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 |
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
|
1255 |
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
|
1256 |
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
|
1257 |
|
a6b0220fb8ae
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 |
\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
|
1259 |
\begin{tabular}{@ {}l} |
3114
a9a4baa7779f
2 typos found by John Wickerson in QPaper
Christian Urban <urbanc@in.tum.de>
parents:
3094
diff
changeset
|
1260 |
\isacommand{fun}~~@{text "int_rel :: (nat \<times> nat) \<Rightarrow> (nat \<times> nat) \<Rightarrow> bool"}\\ |
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
|
1261 |
\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
|
1262 |
\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
|
1263 |
\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
|
1264 |
|
a6b0220fb8ae
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 |
\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
|
1266 |
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
|
1267 |
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
|
1268 |
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
|
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 |
\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
|
1271 |
\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
|
1272 |
\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
|
1273 |
\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
|
1274 |
\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
|
1275 |
\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
|
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 |
\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
|
1278 |
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
|
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 |
\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
|
1281 |
\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
|
1282 |
\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
|
1283 |
\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
|
1284 |
\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
|
1285 |
@{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
|
1286 |
\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
|
1287 |
\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
|
1288 |
\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
|
1289 |
\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
|
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 |
\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
|
1292 |
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
|
1293 |
|
a6b0220fb8ae
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 |
\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
|
1295 |
\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
|
1296 |
\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
|
1297 |
|
a6b0220fb8ae
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 |
\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
|
1299 |
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
|
1300 |
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
|
1301 |
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
|
1302 |
|
a6b0220fb8ae
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 |
\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
|
1304 |
\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
|
1305 |
\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
|
1306 |
@{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
|
1307 |
\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
|
1308 |
\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
|
1309 |
|
a6b0220fb8ae
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 |
\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
|
1311 |
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
|
1312 |
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
|
1313 |
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
|
1314 |
|
a6b0220fb8ae
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 |
\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
|
1316 |
\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
|
1317 |
\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
|
1318 |
|
a6b0220fb8ae
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 |
\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
|
1320 |
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
|
1321 |
|
a6b0220fb8ae
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 |
\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
|
1323 |
\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
|
1324 |
\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
|
1325 |
|
a6b0220fb8ae
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 |
\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
|
1327 |
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
|
1328 |
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
|
1329 |
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
|
1330 |
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
|
1331 |
|
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1332 |
{\bf \begin{itemize} |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1333 |
\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
|
1334 |
\item Quotient extensions |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1335 |
\item Respectfulness and preservation |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1336 |
- Show special cases for quantifiers and lambda |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1337 |
\item Quotient-type locale |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1338 |
- 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
|
1339 |
\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
|
1340 |
\item Lifting vs Descending vs quot\_lifted |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1341 |
- automatic theorem translation heuristic |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1342 |
\item Partial equivalence quotients |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1343 |
- Bounded abstraction |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1344 |
- Respects |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1345 |
- partial descending |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1346 |
\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
|
1347 |
\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
|
1348 |
injected and cleaned statement |
8bad9887ad90
moved TODO into the paper
Christian Urban <urbanc@in.tum.de>
parents:
3092
diff
changeset
|
1349 |
\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
|
1350 |
\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
|
1351 |
\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
|
1352 |
*} |
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
|
a6b0220fb8ae
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 |
(*<*) |
a6b0220fb8ae
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 |
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
|
1358 |
(*>*) |