src/HOL/UNITY/Channel.ML
author paulson
Thu, 06 Aug 1998 15:47:26 +0200
changeset 5277 e4297d03e5d2
parent 5253 82a5ca6290aa
child 5625 77e9ab9cd7b1
permissions -rw-r--r--
A higher-level treatment of LeadsTo, minimizing use of "reachable"
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Channel
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     2
    ID:         $Id$
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     5
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     6
Unordered Channel
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     7
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     8
From Misra, "A Logic for Concurrent Programming" (1994), section 13.3
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     9
*)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    10
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    11
AddIffs [skip];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    12
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    13
(*None represents "infinity" while Some represents proper integers*)
5111
8f4b72f0c15d Uncurried functions LeadsTo and reach
paulson
parents: 5069
diff changeset
    14
Goalw [minSet_def] "minSet A = Some x --> x : A";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    15
by (Simp_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    16
by (fast_tac (claset() addIs [LeastI]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    17
qed_spec_mp "minSet_eq_SomeD";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    18
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    19
Goalw [minSet_def] " minSet{} = None";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    20
by (Asm_simp_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    21
qed_spec_mp "minSet_empty";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    22
Addsimps [minSet_empty];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    23
5111
8f4b72f0c15d Uncurried functions LeadsTo and reach
paulson
parents: 5069
diff changeset
    24
Goalw [minSet_def] "x:A ==> minSet A = Some (LEAST x. x: A)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    25
by (ALLGOALS Asm_simp_tac);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    26
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    27
qed_spec_mp "minSet_nonempty";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    28
5253
82a5ca6290aa New record type of programs
paulson
parents: 5232
diff changeset
    29
Goal "leadsTo acts (minSet -`` {Some x}) (minSet -`` (Some``greaterThan x))";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    30
by (rtac leadsTo_weaken 1);
5277
e4297d03e5d2 A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents: 5253
diff changeset
    31
by (rtac ([UC2, UC1] MRS psp) 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    32
by (ALLGOALS Asm_simp_tac);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    33
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    34
by Safe_tac;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    35
by (auto_tac (claset() addDs [minSet_eq_SomeD], 
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    36
	      simpset() addsimps [le_def, nat_neq_iff]));
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    37
qed "minSet_greaterThan";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    38
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    39
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    40
(*The induction*)
5253
82a5ca6290aa New record type of programs
paulson
parents: 5232
diff changeset
    41
Goal "leadsTo acts (UNIV-{{}}) (minSet -`` (Some``atLeast y))";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    42
by (rtac leadsTo_weaken_R 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    43
by (res_inst_tac  [("l", "y"), ("f", "the o minSet"), ("B", "{}")]
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    44
     greaterThan_bounded_induct 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    45
by Safe_tac;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    46
by (ALLGOALS Asm_simp_tac);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    47
by (dtac minSet_nonempty 2);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    48
by (Asm_full_simp_tac 2);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    49
by (rtac (minSet_greaterThan RS leadsTo_weaken) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    50
by Safe_tac;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    51
by (ALLGOALS Asm_full_simp_tac);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    52
by (dtac minSet_nonempty 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    53
by (Asm_full_simp_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    54
val lemma = result();
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    55
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    56
5253
82a5ca6290aa New record type of programs
paulson
parents: 5232
diff changeset
    57
Goal "!!y::nat. leadsTo acts (UNIV-{{}}) {s. y ~: s}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    58
by (rtac (lemma RS leadsTo_weaken_R) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    59
by (Clarify_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    60
by (forward_tac [minSet_nonempty] 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    61
by (asm_full_simp_tac (simpset() addsimps [Suc_le_eq]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    62
by (blast_tac (claset() addDs [Suc_le_lessD, not_less_Least]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    63
qed "Channel_progress";