src/HOL/Library/Accessible_Part.thy
author wenzelm
Sat Apr 08 22:51:06 2006 +0200 (2006-04-08)
changeset 19363 667b5ea637dd
parent 19086 1b3780be6cc2
permissions -rw-r--r--
refined 'abbreviation';
     1 (*  Title:      HOL/Library/Accessible_Part.thy
     2     ID:         $Id$
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1994  University of Cambridge
     5 *)
     6 
     7 header {* The accessible part of a relation *}
     8 
     9 theory Accessible_Part
    10 imports Main
    11 begin
    12 
    13 subsection {* Inductive definition *}
    14 
    15 text {*
    16  Inductive definition of the accessible part @{term "acc r"} of a
    17  relation; see also \cite{paulin-tlca}.
    18 *}
    19 
    20 consts
    21   acc :: "('a \<times> 'a) set => 'a set"
    22 inductive "acc r"
    23   intros
    24     accI: "(!!y. (y, x) \<in> r ==> y \<in> acc r) ==> x \<in> acc r"
    25 
    26 abbreviation
    27   termi :: "('a \<times> 'a) set => 'a set"
    28   "termi r == acc (r\<inverse>)"
    29 
    30 
    31 subsection {* Induction rules *}
    32 
    33 theorem acc_induct:
    34   assumes major: "a \<in> acc r"
    35   assumes hyp: "!!x. x \<in> acc r ==> \<forall>y. (y, x) \<in> r --> P y ==> P x"
    36   shows "P a"
    37   apply (rule major [THEN acc.induct])
    38   apply (rule hyp)
    39    apply (rule accI)
    40    apply fast
    41   apply fast
    42   done
    43 
    44 theorems acc_induct_rule = acc_induct [rule_format, induct set: acc]
    45 
    46 theorem acc_downward: "b \<in> acc r ==> (a, b) \<in> r ==> a \<in> acc r"
    47   apply (erule acc.elims)
    48   apply fast
    49   done
    50 
    51 lemma acc_downwards_aux: "(b, a) \<in> r\<^sup>* ==> a \<in> acc r --> b \<in> acc r"
    52   apply (erule rtrancl_induct)
    53    apply blast
    54   apply (blast dest: acc_downward)
    55   done
    56 
    57 theorem acc_downwards: "a \<in> acc r ==> (b, a) \<in> r\<^sup>* ==> b \<in> acc r"
    58   apply (blast dest: acc_downwards_aux)
    59   done
    60 
    61 theorem acc_wfI: "\<forall>x. x \<in> acc r ==> wf r"
    62   apply (rule wfUNIVI)
    63   apply (induct_tac P x rule: acc_induct)
    64    apply blast
    65   apply blast
    66   done
    67 
    68 theorem acc_wfD: "wf r ==> x \<in> acc r"
    69   apply (erule wf_induct)
    70   apply (rule accI)
    71   apply blast
    72   done
    73 
    74 theorem wf_acc_iff: "wf r = (\<forall>x. x \<in> acc r)"
    75   apply (blast intro: acc_wfI dest: acc_wfD)
    76   done
    77 
    78 end