src/HOL/Wellfounded.thy
changeset 44144 74b3751ea271
parent 43140 504d72a39638
child 44921 58eef4843641
equal deleted inserted replaced
44143:d282b3c5df7c 44144:74b3751ea271
   879 apply(drule assms)
   879 apply(drule assms)
   880 apply (blast intro: card_mono finite_subset psubset_card_mono dest: psubset_eq[THEN iffD2])
   880 apply (blast intro: card_mono finite_subset psubset_card_mono dest: psubset_eq[THEN iffD2])
   881 done
   881 done
   882 
   882 
   883 
   883 
   884 subsection{*Weakly decreasing sequences (w.r.t. some well-founded order) 
       
   885    stabilize.*}
       
   886 
       
   887 text{*This material does not appear to be used any longer.*}
       
   888 
       
   889 lemma sequence_trans: "[| ALL i. (f (Suc i), f i) : r^* |] ==> (f (i+k), f i) : r^*"
       
   890 by (induct k) (auto intro: rtrancl_trans)
       
   891 
       
   892 lemma wf_weak_decr_stable: 
       
   893   assumes as: "ALL i. (f (Suc i), f i) : r^*" "wf (r^+)"
       
   894   shows "EX i. ALL k. f (i+k) = f i"
       
   895 proof -
       
   896   have lem: "!!x. [| ALL i. (f (Suc i), f i) : r^*; wf (r^+) |]  
       
   897       ==> ALL m. f m = x --> (EX i. ALL k. f (m+i+k) = f (m+i))"
       
   898   apply (erule wf_induct, clarify)
       
   899   apply (case_tac "EX j. (f (m+j), f m) : r^+")
       
   900    apply clarify
       
   901    apply (subgoal_tac "EX i. ALL k. f ((m+j) +i+k) = f ( (m+j) +i) ")
       
   902     apply clarify
       
   903     apply (rule_tac x = "j+i" in exI)
       
   904     apply (simp add: add_ac, blast)
       
   905   apply (rule_tac x = 0 in exI, clarsimp)
       
   906   apply (drule_tac i = m and k = k in sequence_trans)
       
   907   apply (blast elim: rtranclE dest: rtrancl_into_trancl1)
       
   908   done
       
   909 
       
   910   from lem[OF as, THEN spec, of 0, simplified] 
       
   911   show ?thesis by auto
       
   912 qed
       
   913 
       
   914 (* special case of the theorem above: <= *)
       
   915 lemma weak_decr_stable:
       
   916      "ALL i. f (Suc i) <= ((f i)::nat) ==> EX i. ALL k. f (i+k) = f i"
       
   917 apply (rule_tac r = pred_nat in wf_weak_decr_stable)
       
   918 apply (simp add: pred_nat_trancl_eq_le)
       
   919 apply (intro wf_trancl wf_pred_nat)
       
   920 done
       
   921 
       
   922 
       
   923 subsection {* size of a datatype value *}
   884 subsection {* size of a datatype value *}
   924 
   885 
   925 use "Tools/Function/size.ML"
   886 use "Tools/Function/size.ML"
   926 
   887 
   927 setup Size.setup
   888 setup Size.setup