src/HOL/UNITY/Channel.ML
author wenzelm
Fri, 27 Aug 1999 18:59:27 +0200
changeset 7380 2bcee6a460d8
parent 6700 716d2d253a3c
child 7403 c318acb88251
permissions -rw-r--r--
thm "_" = asm_rl;
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
(*None represents "infinity" while Some represents proper integers*)
5111
8f4b72f0c15d Uncurried functions LeadsTo and reach
paulson
parents: 5069
diff changeset
    12
Goalw [minSet_def] "minSet A = Some x --> x : A";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    13
by (Simp_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    14
by (fast_tac (claset() addIs [LeastI]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    15
qed_spec_mp "minSet_eq_SomeD";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    16
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    17
Goalw [minSet_def] " minSet{} = None";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    18
by (Asm_simp_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    19
qed_spec_mp "minSet_empty";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    20
Addsimps [minSet_empty];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    21
5111
8f4b72f0c15d Uncurried functions LeadsTo and reach
paulson
parents: 5069
diff changeset
    22
Goalw [minSet_def] "x:A ==> minSet A = Some (LEAST x. x: A)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    23
by (ALLGOALS Asm_simp_tac);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    24
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    25
qed_spec_mp "minSet_nonempty";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    26
6536
281d44905cab made many specification operators infix
paulson
parents: 5648
diff changeset
    27
Goal "F : (minSet -`` {Some x}) leadsTo (minSet -`` (Some``greaterThan x))";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    28
by (rtac leadsTo_weaken 1);
6700
716d2d253a3c updated for stronger version of psp
paulson
parents: 6536
diff changeset
    29
by (res_inst_tac [("x1","x")] ([UC2, UC1] MRS psp) 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    30
by Safe_tac;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    31
by (auto_tac (claset() addDs [minSet_eq_SomeD], 
6700
716d2d253a3c updated for stronger version of psp
paulson
parents: 6536
diff changeset
    32
	      simpset() addsimps [linorder_neq_iff]));
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    33
qed "minSet_greaterThan";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    34
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    35
(*The induction*)
6536
281d44905cab made many specification operators infix
paulson
parents: 5648
diff changeset
    36
Goal "F : (UNIV-{{}}) leadsTo (minSet -`` (Some``atLeast y))";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    37
by (rtac leadsTo_weaken_R 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    38
by (res_inst_tac  [("l", "y"), ("f", "the o minSet"), ("B", "{}")]
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    39
     greaterThan_bounded_induct 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    40
by Safe_tac;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    41
by (ALLGOALS Asm_simp_tac);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    42
by (dtac minSet_nonempty 2);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    43
by (Asm_full_simp_tac 2);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    44
by (rtac (minSet_greaterThan RS leadsTo_weaken) 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_full_simp_tac);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    47
by (dtac minSet_nonempty 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    48
by (Asm_full_simp_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    49
val lemma = result();
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    50
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    51
6536
281d44905cab made many specification operators infix
paulson
parents: 5648
diff changeset
    52
Goal "!!y::nat. F : (UNIV-{{}}) leadsTo {s. y ~: s}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    53
by (rtac (lemma RS leadsTo_weaken_R) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    54
by (Clarify_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    55
by (forward_tac [minSet_nonempty] 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    56
by (asm_full_simp_tac (simpset() addsimps [Suc_le_eq]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    57
by (blast_tac (claset() addDs [Suc_le_lessD, not_less_Least]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    58
qed "Channel_progress";