1 (* Title: HOLCF/Dnat.thy
2 Author: Franz Regensburger
4 Theory for the domain of natural numbers dnat = one ++ dnat
11 domain dnat = dzero | dsucc (dpred :: dnat)
14 iterator :: "dnat -> ('a -> 'a) -> 'a -> 'a" where
15 "iterator = fix $ (LAM h n f x.
17 | dsucc $ m => f $ (h $ m $ f $ x))"
20 \medskip Expand fixed point properties.
24 "iterator = (LAM n f x. case n of dzero => x | dsucc$m => f$(iterator$m$f$x))"
27 apply (rule iterator_def [THEN eq_reflection])
28 apply (rule beta_cfun)
32 text {* \medskip Recursive properties. *}
34 lemma iterator1: "iterator $ UU $ f $ x = UU"
35 apply (subst iterator_def2)
39 lemma iterator2: "iterator $ dzero $ f $ x = x"
40 apply (subst iterator_def2)
44 lemma iterator3: "n ~= UU ==> iterator $ (dsucc $ n) $ f $ x = f $ (iterator $ n $ f $ x)"
46 apply (subst iterator_def2)
51 lemmas iterator_rews = iterator1 iterator2 iterator3
53 lemma dnat_flat: "ALL x y::dnat. x<<y --> x=UU | x=y"
55 apply (induct_tac x rule: dnat.ind)
58 apply (rule_tac x = y in dnat.casedist)
63 apply (rule_tac x = y in dnat.casedist)
64 apply (fast intro!: UU_I)
65 apply (thin_tac "ALL y. d << y --> d = UU | d = y")
67 apply (simp (no_asm_simp))
68 apply (drule_tac x="da" in spec)