| 4776 |      1 | (*  Title:      HOL/UNITY/Channel
 | 
|  |      2 |     ID:         $Id$
 | 
|  |      3 |     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
 | 
|  |      4 |     Copyright   1998  University of Cambridge
 | 
|  |      5 | 
 | 
|  |      6 | Unordered Channel
 | 
|  |      7 | 
 | 
|  |      8 | From Misra, "A Logic for Concurrent Programming" (1994), section 13.3
 | 
|  |      9 | *)
 | 
|  |     10 | 
 | 
|  |     11 | (*None represents "infinity" while Some represents proper integers*)
 | 
| 5111 |     12 | Goalw [minSet_def] "minSet A = Some x --> x : A";
 | 
| 4776 |     13 | by (Simp_tac 1);
 | 
|  |     14 | by (fast_tac (claset() addIs [LeastI]) 1);
 | 
|  |     15 | qed_spec_mp "minSet_eq_SomeD";
 | 
|  |     16 | 
 | 
| 5069 |     17 | Goalw [minSet_def] " minSet{} = None";
 | 
| 4776 |     18 | by (Asm_simp_tac 1);
 | 
|  |     19 | qed_spec_mp "minSet_empty";
 | 
|  |     20 | Addsimps [minSet_empty];
 | 
|  |     21 | 
 | 
| 5111 |     22 | Goalw [minSet_def] "x:A ==> minSet A = Some (LEAST x. x: A)";
 | 
| 7403 |     23 | by Auto_tac;
 | 
| 4776 |     24 | qed_spec_mp "minSet_nonempty";
 | 
|  |     25 | 
 | 
| 6536 |     26 | Goal "F : (minSet -`` {Some x}) leadsTo (minSet -`` (Some``greaterThan x))";
 | 
| 4776 |     27 | by (rtac leadsTo_weaken 1);
 | 
| 6700 |     28 | by (res_inst_tac [("x1","x")] ([UC2, UC1] MRS psp) 1);
 | 
| 4776 |     29 | by Safe_tac;
 | 
|  |     30 | by (auto_tac (claset() addDs [minSet_eq_SomeD], 
 | 
| 6700 |     31 | 	      simpset() addsimps [linorder_neq_iff]));
 | 
| 4776 |     32 | qed "minSet_greaterThan";
 | 
|  |     33 | 
 | 
|  |     34 | (*The induction*)
 | 
| 6536 |     35 | Goal "F : (UNIV-{{}}) leadsTo (minSet -`` (Some``atLeast y))";
 | 
| 4776 |     36 | by (rtac leadsTo_weaken_R 1);
 | 
|  |     37 | by (res_inst_tac  [("l", "y"), ("f", "the o minSet"), ("B", "{}")]
 | 
|  |     38 |      greaterThan_bounded_induct 1);
 | 
|  |     39 | by Safe_tac;
 | 
|  |     40 | by (ALLGOALS Asm_simp_tac);
 | 
|  |     41 | by (dtac minSet_nonempty 2);
 | 
|  |     42 | by (Asm_full_simp_tac 2);
 | 
|  |     43 | by (rtac (minSet_greaterThan RS leadsTo_weaken) 1);
 | 
|  |     44 | by Safe_tac;
 | 
|  |     45 | by (ALLGOALS Asm_full_simp_tac);
 | 
|  |     46 | by (dtac minSet_nonempty 1);
 | 
|  |     47 | by (Asm_full_simp_tac 1);
 | 
|  |     48 | val lemma = result();
 | 
|  |     49 | 
 | 
|  |     50 | 
 | 
| 6536 |     51 | Goal "!!y::nat. F : (UNIV-{{}}) leadsTo {s. y ~: s}";
 | 
| 4776 |     52 | by (rtac (lemma RS leadsTo_weaken_R) 1);
 | 
|  |     53 | by (Clarify_tac 1);
 | 
| 7499 |     54 | by (ftac minSet_nonempty 1);
 | 
| 7403 |     55 | by (auto_tac (claset() addDs [Suc_le_lessD, not_less_Least], 
 | 
|  |     56 | 	      simpset()));
 | 
| 4776 |     57 | qed "Channel_progress";
 |