author | haftmann |
Fri, 17 Mar 2006 14:20:24 +0100 | |
changeset 19281 | b411f25fff25 |
parent 16417 | 9bc16273c2d4 |
child 19550 | ae77a20f6995 |
permissions | -rw-r--r-- |
2570 | 1 |
(* Title: HOLCF/Dnat.thy |
2 |
ID: $Id$ |
|
3 |
Author: Franz Regensburger |
|
4 |
||
5 |
Theory for the domain of natural numbers dnat = one ++ dnat |
|
6 |
*) |
|
7 |
||
16417 | 8 |
theory Dnat imports HOLCF begin |
2570 | 9 |
|
10 |
domain dnat = dzero | dsucc (dpred :: dnat) |
|
11 |
||
12 |
constdefs |
|
12035 | 13 |
iterator :: "dnat -> ('a -> 'a) -> 'a -> 'a" |
14 |
"iterator == fix $ (LAM h n f x. |
|
15 |
case n of dzero => x |
|
16 |
| dsucc $ m => f $ (h $ m $ f $ x))" |
|
2570 | 17 |
|
12035 | 18 |
text {* |
19 |
\medskip Expand fixed point properties. |
|
20 |
*} |
|
21 |
||
22 |
ML_setup {* |
|
23 |
bind_thm ("iterator_def2", fix_prover2 (the_context ()) (thm "iterator_def") |
|
24 |
"iterator = (LAM n f x. case n of dzero => x | dsucc$m => f$(iterator$m$f$x))"); |
|
25 |
*} |
|
26 |
||
27 |
text {* |
|
28 |
\medskip Recursive properties. |
|
29 |
*} |
|
30 |
||
31 |
lemma iterator1: "iterator $ UU $ f $ x = UU" |
|
32 |
apply (subst iterator_def2) |
|
33 |
apply (simp add: dnat.rews) |
|
34 |
done |
|
35 |
||
36 |
lemma iterator2: "iterator $ dzero $ f $ x = x" |
|
37 |
apply (subst iterator_def2) |
|
38 |
apply (simp add: dnat.rews) |
|
39 |
done |
|
40 |
||
41 |
lemma iterator3: "n ~= UU ==> iterator $ (dsucc $ n) $ f $ x = f $ (iterator $ n $ f $ x)" |
|
42 |
apply (rule trans) |
|
43 |
apply (subst iterator_def2) |
|
44 |
apply (simp add: dnat.rews) |
|
45 |
apply (rule refl) |
|
46 |
done |
|
47 |
||
48 |
lemmas iterator_rews = iterator1 iterator2 iterator3 |
|
49 |
||
50 |
lemma dnat_flat: "ALL x y::dnat. x<<y --> x=UU | x=y" |
|
51 |
apply (rule allI) |
|
52 |
apply (induct_tac x rule: dnat.ind) |
|
53 |
apply fast |
|
54 |
apply (rule allI) |
|
55 |
apply (rule_tac x = y in dnat.casedist) |
|
56 |
apply (fast intro!: UU_I) |
|
57 |
apply simp |
|
58 |
apply (simp add: dnat.dist_les) |
|
59 |
apply (rule allI) |
|
60 |
apply (rule_tac x = y in dnat.casedist) |
|
61 |
apply (fast intro!: UU_I) |
|
62 |
apply (simp add: dnat.dist_les) |
|
63 |
apply (simp (no_asm_simp) add: dnat.rews) |
|
64 |
apply (intro strip) |
|
65 |
apply (subgoal_tac "d << da") |
|
66 |
apply (erule allE) |
|
67 |
apply (drule mp) |
|
68 |
apply assumption |
|
69 |
apply (erule disjE) |
|
70 |
apply (tactic "contr_tac 1") |
|
71 |
apply simp |
|
16322
7cd7d21975ad
fix usage of inverts lemma, which has fewer premises now
huffman
parents:
14981
diff
changeset
|
72 |
apply (erule (1) dnat.inverts) |
12035 | 73 |
done |
2570 | 74 |
|
75 |
end |