src/HOL/UNITY/Channel.ML
author paulson
Fri, 12 May 2000 15:05:02 +0200
changeset 8862 78643f8449c6
parent 7499 23e090051cb8
child 10834 a7897aebbffc
permissions -rw-r--r--
NatSimprocs is now a theory, not a file
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)";
7403
c318acb88251 tidied some proofs
paulson
parents: 6700
diff changeset
    23
by Auto_tac;
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    24
qed_spec_mp "minSet_nonempty";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    25
6536
281d44905cab made many specification operators infix
paulson
parents: 5648
diff changeset
    26
Goal "F : (minSet -`` {Some x}) leadsTo (minSet -`` (Some``greaterThan x))";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    27
by (rtac leadsTo_weaken 1);
6700
716d2d253a3c updated for stronger version of psp
paulson
parents: 6536
diff changeset
    28
by (res_inst_tac [("x1","x")] ([UC2, UC1] MRS psp) 1);
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    29
by Safe_tac;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    30
by (auto_tac (claset() addDs [minSet_eq_SomeD], 
6700
716d2d253a3c updated for stronger version of psp
paulson
parents: 6536
diff changeset
    31
	      simpset() addsimps [linorder_neq_iff]));
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    32
qed "minSet_greaterThan";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    33
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    34
(*The induction*)
6536
281d44905cab made many specification operators infix
paulson
parents: 5648
diff changeset
    35
Goal "F : (UNIV-{{}}) leadsTo (minSet -`` (Some``atLeast y))";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    36
by (rtac leadsTo_weaken_R 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    37
by (res_inst_tac  [("l", "y"), ("f", "the o minSet"), ("B", "{}")]
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    38
     greaterThan_bounded_induct 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    39
by Safe_tac;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    40
by (ALLGOALS Asm_simp_tac);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    41
by (dtac minSet_nonempty 2);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    42
by (Asm_full_simp_tac 2);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    43
by (rtac (minSet_greaterThan RS leadsTo_weaken) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    44
by Safe_tac;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    45
by (ALLGOALS Asm_full_simp_tac);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    46
by (dtac minSet_nonempty 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    47
by (Asm_full_simp_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    48
val lemma = result();
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    49
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    50
6536
281d44905cab made many specification operators infix
paulson
parents: 5648
diff changeset
    51
Goal "!!y::nat. F : (UNIV-{{}}) leadsTo {s. y ~: s}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    52
by (rtac (lemma RS leadsTo_weaken_R) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    53
by (Clarify_tac 1);
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 7403
diff changeset
    54
by (ftac minSet_nonempty 1);
7403
c318acb88251 tidied some proofs
paulson
parents: 6700
diff changeset
    55
by (auto_tac (claset() addDs [Suc_le_lessD, not_less_Least], 
c318acb88251 tidied some proofs
paulson
parents: 6700
diff changeset
    56
	      simpset()));
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    57
qed "Channel_progress";