src/HOL/UNITY/SubstAx.ML
changeset 6575 70d758762c50
parent 6570 a7d7985050a9
child 6710 4d438b714571
equal deleted inserted replaced
6574:a91b4cfd3104 6575:70d758762c50
     5 
     5 
     6 LeadsTo relation, restricted to the set of reachable states.
     6 LeadsTo relation, restricted to the set of reachable states.
     7 *)
     7 *)
     8 
     8 
     9 overload_1st_set "SubstAx.op LeadsTo";
     9 overload_1st_set "SubstAx.op LeadsTo";
       
    10 
       
    11 
       
    12 (*Resembles the previous definition of LeadsTo*)
       
    13 Goalw [LeadsTo_def]
       
    14      "A LeadsTo B = {F. F : (reachable F Int A) leadsTo (reachable F Int B)}";
       
    15 by (blast_tac (claset() addDs [psp_stable2] 
       
    16                         addIs [leadsTo_weaken, stable_reachable]) 1);
       
    17 qed "LeadsTo_eq_leadsTo";
    10 
    18 
    11 
    19 
    12 (*** Specialized laws for handling invariants ***)
    20 (*** Specialized laws for handling invariants ***)
    13 
    21 
    14 (** Conjoining an Always property **)
    22 (** Conjoining an Always property **)
    21 qed "Always_LeadsToI";
    29 qed "Always_LeadsToI";
    22 
    30 
    23 Goal "[| F : Always C;  F : A LeadsTo A' |]   \
    31 Goal "[| F : Always C;  F : A LeadsTo A' |]   \
    24 \     ==> F : A LeadsTo (C Int A')";
    32 \     ==> F : A LeadsTo (C Int A')";
    25 by (asm_full_simp_tac
    33 by (asm_full_simp_tac
    26     (simpset() addsimps [LeadsTo_def, Always_eq_includes_reachable, 
    34     (simpset() addsimps [LeadsTo_eq_leadsTo, Always_eq_includes_reachable, 
    27 			 Int_absorb2, Int_assoc RS sym]) 1);
    35 			 Int_absorb2, Int_assoc RS sym]) 1);
    28 qed "Always_LeadsToD";
    36 qed "Always_LeadsToD";
    29 
    37 
    30 
    38 
    31 (*** Introduction rules: Basis, Trans, Union ***)
    39 (*** Introduction rules: Basis, Trans, Union ***)
    32 
    40 
    33 Goal "F : A leadsTo B ==> F : A LeadsTo B";
    41 Goal "F : A leadsTo B ==> F : A LeadsTo B";
    34 by (simp_tac (simpset() addsimps [LeadsTo_def]) 1);
    42 by (simp_tac (simpset() addsimps [LeadsTo_def]) 1);
    35 by (blast_tac (claset() addIs [psp_stable2, stable_reachable]) 1);
    43 by (blast_tac (claset() addIs [leadsTo_weaken_L]) 1);
    36 qed "leadsTo_imp_LeadsTo";
    44 qed "leadsTo_imp_LeadsTo";
    37 
    45 
    38 Goal "[| F : A LeadsTo B;  F : B LeadsTo C |] ==> F : A LeadsTo C";
    46 Goal "[| F : A LeadsTo B;  F : B LeadsTo C |] ==> F : A LeadsTo C";
    39 by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1);
    47 by (full_simp_tac (simpset() addsimps [LeadsTo_eq_leadsTo]) 1);
    40 by (blast_tac (claset() addIs [leadsTo_Trans]) 1);
    48 by (blast_tac (claset() addIs [leadsTo_Trans]) 1);
    41 qed "LeadsTo_Trans";
    49 qed "LeadsTo_Trans";
    42 
    50 
    43 val prems = Goalw [LeadsTo_def]
    51 val prems = Goalw [LeadsTo_def]
    44      "(!!A. A : S ==> F : A LeadsTo B) ==> F : (Union S) LeadsTo B";
    52      "(!!A. A : S ==> F : A LeadsTo B) ==> F : (Union S) LeadsTo B";
    49 
    57 
    50 
    58 
    51 (*** Derived rules ***)
    59 (*** Derived rules ***)
    52 
    60 
    53 Goal "F : A LeadsTo UNIV";
    61 Goal "F : A LeadsTo UNIV";
    54 by (asm_simp_tac 
    62 by (simp_tac (simpset() addsimps [LeadsTo_def]) 1);
    55     (simpset() addsimps [LeadsTo_def, Int_lower1 RS subset_imp_leadsTo]) 1);
       
    56 qed "LeadsTo_UNIV";
    63 qed "LeadsTo_UNIV";
    57 Addsimps [LeadsTo_UNIV];
    64 Addsimps [LeadsTo_UNIV];
    58 
    65 
    59 (*Useful with cancellation, disjunction*)
    66 (*Useful with cancellation, disjunction*)
    60 Goal "F : A LeadsTo (A' Un A') ==> F : A LeadsTo A'";
    67 Goal "F : A LeadsTo (A' Un A') ==> F : A LeadsTo A'";
   140 
   147 
   141 (** More rules using the premise "Always INV" **)
   148 (** More rules using the premise "Always INV" **)
   142 
   149 
   143 Goal "[| F : (A-A') Co (A Un A');  F : transient (A-A') |]   \
   150 Goal "[| F : (A-A') Co (A Un A');  F : transient (A-A') |]   \
   144 \     ==> F : A LeadsTo A'";
   151 \     ==> F : A LeadsTo A'";
   145 by (asm_full_simp_tac (simpset() addsimps [LeadsTo_def, Constrains_def]) 1);
   152 by (asm_full_simp_tac
       
   153     (simpset() addsimps [LeadsTo_def, Constrains_eq_constrains]) 1);
   146 by (rtac (ensuresI RS leadsTo_Basis) 1);
   154 by (rtac (ensuresI RS leadsTo_Basis) 1);
   147 by (blast_tac (claset() addIs [transient_strengthen]) 2);
   155 by (blast_tac (claset() addIs [transient_strengthen]) 2);
   148 by (blast_tac (claset() addIs [constrains_weaken]) 1);
   156 by (blast_tac (claset() addIs [constrains_weaken]) 1);
   149 qed "LeadsTo_Basis";
   157 qed "LeadsTo_Basis";
   150 
   158 
   242 (** PSP: Progress-Safety-Progress **)
   250 (** PSP: Progress-Safety-Progress **)
   243 
   251 
   244 (*Special case of PSP: Misra's "stable conjunction"*)
   252 (*Special case of PSP: Misra's "stable conjunction"*)
   245 Goal "[| F : A LeadsTo A';  F : Stable B |] \
   253 Goal "[| F : A LeadsTo A';  F : Stable B |] \
   246 \     ==> F : (A Int B) LeadsTo (A' Int B)";
   254 \     ==> F : (A Int B) LeadsTo (A' Int B)";
   247 by (full_simp_tac (simpset() addsimps [LeadsTo_def, Stable_eq_stable]) 1);
   255 by (full_simp_tac
       
   256     (simpset() addsimps [LeadsTo_eq_leadsTo, Stable_eq_stable]) 1);
   248 by (dtac psp_stable 1);
   257 by (dtac psp_stable 1);
   249 by (assume_tac 1);
   258 by (assume_tac 1);
   250 by (asm_full_simp_tac (simpset() addsimps Int_ac) 1);
   259 by (asm_full_simp_tac (simpset() addsimps Int_ac) 1);
   251 qed "PSP_stable";
   260 qed "PSP_stable";
   252 
   261 
   253 Goal "[| F : A LeadsTo A'; F : Stable B |] \
   262 Goal "[| F : A LeadsTo A'; F : Stable B |] \
   254 \     ==> F : (B Int A) LeadsTo (B Int A')";
   263 \     ==> F : (B Int A) LeadsTo (B Int A')";
   255 by (asm_simp_tac (simpset() addsimps PSP_stable::Int_ac) 1);
   264 by (asm_simp_tac (simpset() addsimps PSP_stable::Int_ac) 1);
   256 qed "PSP_stable2";
   265 qed "PSP_stable2";
   257 
   266 
   258 Goalw [LeadsTo_def, Constrains_def]
   267 Goal "[| F : A LeadsTo A'; F : B Co B' |] \
   259      "[| F : A LeadsTo A'; F : B Co B' |] \
       
   260 \     ==> F : (A Int B) LeadsTo ((A' Int B) Un (B' - B))";
   268 \     ==> F : (A Int B) LeadsTo ((A' Int B) Un (B' - B))";
       
   269 by (full_simp_tac
       
   270     (simpset() addsimps [LeadsTo_def, Constrains_eq_constrains]) 1);
   261 by (blast_tac (claset() addDs [psp] addIs [leadsTo_weaken]) 1);
   271 by (blast_tac (claset() addDs [psp] addIs [leadsTo_weaken]) 1);
   262 qed "PSP";
   272 qed "PSP";
   263 
   273 
   264 Goal "[| F : A LeadsTo A'; F : B Co B' |] \
   274 Goal "[| F : A LeadsTo A'; F : B Co B' |] \
   265 \     ==> F : (B Int A) LeadsTo ((B Int A') Un (B' - B))";
   275 \     ==> F : (B Int A) LeadsTo ((B Int A') Un (B' - B))";
   290 (** Meta or object quantifier ????? **)
   300 (** Meta or object quantifier ????? **)
   291 Goal "[| wf r;     \
   301 Goal "[| wf r;     \
   292 \        ALL m. F : (A Int f-``{m}) LeadsTo                     \
   302 \        ALL m. F : (A Int f-``{m}) LeadsTo                     \
   293 \                           ((A Int f-``(r^-1 ^^ {m})) Un B) |] \
   303 \                           ((A Int f-``(r^-1 ^^ {m})) Un B) |] \
   294 \     ==> F : A LeadsTo B";
   304 \     ==> F : A LeadsTo B";
   295 by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1);
   305 by (full_simp_tac (simpset() addsimps [LeadsTo_eq_leadsTo]) 1);
   296 by (etac leadsTo_wf_induct 1);
   306 by (etac leadsTo_wf_induct 1);
   297 by (blast_tac (claset() addIs [leadsTo_weaken]) 1);
   307 by (blast_tac (claset() addIs [leadsTo_weaken]) 1);
   298 qed "LeadsTo_wf_induct";
   308 qed "LeadsTo_wf_induct";
   299 
   309 
   300 
   310 
   353 (*** Completion: Binary and General Finite versions ***)
   363 (*** Completion: Binary and General Finite versions ***)
   354 
   364 
   355 Goal "[| F : A LeadsTo A';  F : Stable A';   \
   365 Goal "[| F : A LeadsTo A';  F : Stable A';   \
   356 \        F : B LeadsTo B';  F : Stable B' |] \
   366 \        F : B LeadsTo B';  F : Stable B' |] \
   357 \     ==> F : (A Int B) LeadsTo (A' Int B')";
   367 \     ==> F : (A Int B) LeadsTo (A' Int B')";
   358 by (full_simp_tac (simpset() addsimps [LeadsTo_def, Stable_eq_stable]) 1);
   368 by (full_simp_tac
       
   369     (simpset() addsimps [LeadsTo_eq_leadsTo, Stable_eq_stable]) 1);
   359 by (blast_tac (claset() addIs [stable_completion, leadsTo_weaken]) 1);
   370 by (blast_tac (claset() addIs [stable_completion, leadsTo_weaken]) 1);
   360 qed "Stable_completion";
   371 qed "Stable_completion";
   361 
   372 
   362 
   373 
   363 Goal "finite I      \
   374 Goal "finite I      \
   371 
   382 
   372 
   383 
   373 Goal "[| F : A LeadsTo (A' Un C);  F : A' Co (A' Un C); \
   384 Goal "[| F : A LeadsTo (A' Un C);  F : A' Co (A' Un C); \
   374 \        F : B LeadsTo (B' Un C);  F : B' Co (B' Un C) |] \
   385 \        F : B LeadsTo (B' Un C);  F : B' Co (B' Un C) |] \
   375 \     ==> F : (A Int B) LeadsTo ((A' Int B') Un C)";
   386 \     ==> F : (A Int B) LeadsTo ((A' Int B') Un C)";
   376 by (full_simp_tac (simpset() addsimps [LeadsTo_def, Constrains_def,
   387 by (full_simp_tac
       
   388     (simpset() addsimps [LeadsTo_eq_leadsTo, Constrains_eq_constrains,
   377 				       Int_Un_distrib]) 1);
   389 				       Int_Un_distrib]) 1);
   378 by (blast_tac (claset() addIs [completion, leadsTo_weaken]) 1);
   390 by (blast_tac (claset() addIs [completion, leadsTo_weaken]) 1);
   379 qed "Completion";
   391 qed "Completion";
   380 
   392 
   381 
   393