src/Sequents/S43.thy
author wenzelm
Sat Jun 02 22:40:03 2018 +0200 (17 months ago)
changeset 68358 e761afd35baa
parent 61386 0a29a984a91b
child 69593 3dda49e08b9d
permissions -rw-r--r--
tuned proofs;
wenzelm@41959
     1
(*  Title:      Sequents/S43.thy
paulson@2073
     2
    Author:     Martin Coen
paulson@2073
     3
    Copyright   1991  University of Cambridge
paulson@2073
     4
paulson@2073
     5
This implements Rajeev Gore's sequent calculus for S43.
paulson@2073
     6
*)
paulson@2073
     7
wenzelm@17481
     8
theory S43
wenzelm@17481
     9
imports Modal0
wenzelm@17481
    10
begin
paulson@2073
    11
paulson@2073
    12
consts
wenzelm@61385
    13
  S43pi :: "[seq'\<Rightarrow>seq', seq'\<Rightarrow>seq', seq'\<Rightarrow>seq',
wenzelm@61385
    14
             seq'\<Rightarrow>seq', seq'\<Rightarrow>seq', seq'\<Rightarrow>seq'] \<Rightarrow> prop"
wenzelm@14765
    15
syntax
wenzelm@61385
    16
  "_S43pi" :: "[seq, seq, seq, seq, seq, seq] \<Rightarrow> prop"
paulson@2073
    17
                         ("S43pi((_);(_);(_);(_);(_);(_))" [] 5)
paulson@2073
    18
wenzelm@60770
    19
parse_translation \<open>
wenzelm@35113
    20
  let
wenzelm@35113
    21
    val tr  = seq_tr;
wenzelm@35113
    22
    fun s43pi_tr [s1, s2, s3, s4, s5, s6] =
wenzelm@35113
    23
      Const (@{const_syntax S43pi}, dummyT) $ tr s1 $ tr s2 $ tr s3 $ tr s4 $ tr s5 $ tr s6;
wenzelm@52143
    24
  in [(@{syntax_const "_S43pi"}, K s43pi_tr)] end
wenzelm@60770
    25
\<close>
wenzelm@17481
    26
wenzelm@60770
    27
print_translation \<open>
wenzelm@35113
    28
let
wenzelm@35113
    29
  val tr' = seq_tr';
wenzelm@35113
    30
  fun s43pi_tr' [s1, s2, s3, s4, s5, s6] =
wenzelm@35113
    31
    Const(@{syntax_const "_S43pi"}, dummyT) $ tr' s1 $ tr' s2 $ tr' s3 $ tr' s4 $ tr' s5 $ tr' s6;
wenzelm@52143
    32
in [(@{const_syntax S43pi}, K s43pi_tr')] end
wenzelm@60770
    33
\<close>
wenzelm@17481
    34
wenzelm@51309
    35
axiomatization where
paulson@2073
    36
(* Definition of the star operation using a set of Horn clauses  *)
paulson@2073
    37
(* For system S43: gamma * == {[]P | []P : gamma}                *)
paulson@2073
    38
(*                 delta * == {<>P | <>P : delta}                *)
paulson@2073
    39
wenzelm@51309
    40
  lstar0:         "|L>" and
wenzelm@61385
    41
  lstar1:         "$G |L> $H \<Longrightarrow> []P, $G |L> []P, $H" and
wenzelm@61385
    42
  lstar2:         "$G |L> $H \<Longrightarrow>   P, $G |L>      $H" and
wenzelm@51309
    43
  rstar0:         "|R>" and
wenzelm@61385
    44
  rstar1:         "$G |R> $H \<Longrightarrow> <>P, $G |R> <>P, $H" and
wenzelm@61385
    45
  rstar2:         "$G |R> $H \<Longrightarrow>   P, $G |R>      $H" and
paulson@2073
    46
paulson@2073
    47
(* Set of Horn clauses to generate the antecedents for the S43 pi rule       *)
paulson@2073
    48
(* ie                                                                        *)
paulson@2073
    49
(*           S1...Sk,Sk+1...Sk+m                                             *)
paulson@2073
    50
(*     ----------------------------------                                    *)
wenzelm@61386
    51
(*     <>P1...<>Pk, $G \<turnstile> $H, []Q1...[]Qm                                    *)
paulson@2073
    52
(*                                                                           *)
wenzelm@61386
    53
(*  where Si == <>P1...<>Pi-1,<>Pi+1,..<>Pk,Pi, $G * \<turnstile> $H *, []Q1...[]Qm    *)
wenzelm@61386
    54
(*    and Sj == <>P1...<>Pk, $G * \<turnstile> $H *, []Q1...[]Qj-1,[]Qj+1...[]Qm,Qj    *)
paulson@2073
    55
(*    and 1<=i<=k and k<j<=k+m                                               *)
paulson@2073
    56
wenzelm@51309
    57
  S43pi0:         "S43pi $L;; $R;; $Lbox; $Rdia" and
wenzelm@17481
    58
  S43pi1:
wenzelm@61386
    59
   "\<lbrakk>(S43pi <>P,$L';     $L;; $R; $Lbox;$Rdia);   $L',P,$L,$Lbox \<turnstile> $R,$Rdia\<rbrakk> \<Longrightarrow>
wenzelm@51309
    60
       S43pi     $L'; <>P,$L;; $R; $Lbox;$Rdia" and
wenzelm@17481
    61
  S43pi2:
wenzelm@61386
    62
   "\<lbrakk>(S43pi $L';; []P,$R';     $R; $Lbox;$Rdia);  $L',$Lbox \<turnstile> $R',P,$R,$Rdia\<rbrakk> \<Longrightarrow>
wenzelm@51309
    63
       S43pi $L';;     $R'; []P,$R; $Lbox;$Rdia" and
paulson@2073
    64
paulson@2073
    65
(* Rules for [] and <> for S43 *)
paulson@2073
    66
wenzelm@61386
    67
  boxL:           "$E, P, $F, []P \<turnstile> $G \<Longrightarrow> $E, []P, $F \<turnstile> $G" and
wenzelm@61386
    68
  diaR:           "$E \<turnstile> $F, P, $G, <>P \<Longrightarrow> $E \<turnstile> $F, <>P, $G" and
wenzelm@17481
    69
  pi1:
wenzelm@61385
    70
   "\<lbrakk>$L1,<>P,$L2 |L> $Lbox;  $L1,<>P,$L2 |R> $Ldia;  $R |L> $Rbox;  $R |R> $Rdia;
wenzelm@61385
    71
      S43pi ; $Ldia;; $Rbox; $Lbox; $Rdia\<rbrakk> \<Longrightarrow>
wenzelm@61386
    72
   $L1, <>P, $L2 \<turnstile> $R" and
wenzelm@17481
    73
  pi2:
wenzelm@61385
    74
   "\<lbrakk>$L |L> $Lbox;  $L |R> $Ldia;  $R1,[]P,$R2 |L> $Rbox;  $R1,[]P,$R2 |R> $Rdia;
wenzelm@61385
    75
      S43pi ; $Ldia;; $Rbox; $Lbox; $Rdia\<rbrakk> \<Longrightarrow>
wenzelm@61386
    76
   $L \<turnstile> $R1, []P, $R2"
paulson@2073
    77
wenzelm@21426
    78
wenzelm@60770
    79
ML \<open>
wenzelm@21426
    80
structure S43_Prover = Modal_ProverFun
wenzelm@21426
    81
(
wenzelm@39159
    82
  val rewrite_rls = @{thms rewrite_rls}
wenzelm@39159
    83
  val safe_rls = @{thms safe_rls}
wenzelm@39159
    84
  val unsafe_rls = @{thms unsafe_rls} @ [@{thm pi1}, @{thm pi2}]
wenzelm@39159
    85
  val bound_rls = @{thms bound_rls} @ [@{thm boxL}, @{thm diaR}]
wenzelm@39159
    86
  val aside_rls = [@{thm lstar0}, @{thm lstar1}, @{thm lstar2}, @{thm rstar0},
wenzelm@39159
    87
    @{thm rstar1}, @{thm rstar2}, @{thm S43pi0}, @{thm S43pi1}, @{thm S43pi2}]
wenzelm@21426
    88
)
wenzelm@60770
    89
\<close>
wenzelm@21426
    90
wenzelm@21426
    91
wenzelm@60770
    92
method_setup S43_solve = \<open>
wenzelm@54742
    93
  Scan.succeed (fn ctxt => SIMPLE_METHOD
wenzelm@54742
    94
    (S43_Prover.solve_tac ctxt 2 ORELSE S43_Prover.solve_tac ctxt 3))
wenzelm@60770
    95
\<close>
wenzelm@21426
    96
wenzelm@21426
    97
wenzelm@21426
    98
(* Theorems of system T from Hughes and Cresswell and Hailpern, LNCS 129 *)
wenzelm@21426
    99
wenzelm@61386
   100
lemma "\<turnstile> []P \<longrightarrow> P" by S43_solve
wenzelm@61386
   101
lemma "\<turnstile> [](P \<longrightarrow> Q) \<longrightarrow> ([]P \<longrightarrow> []Q)" by S43_solve   (* normality*)
wenzelm@61386
   102
lemma "\<turnstile> (P--<Q) \<longrightarrow> []P \<longrightarrow> []Q" by S43_solve
wenzelm@61386
   103
lemma "\<turnstile> P \<longrightarrow> <>P" by S43_solve
wenzelm@21426
   104
wenzelm@61386
   105
lemma "\<turnstile>  [](P \<and> Q) \<longleftrightarrow> []P \<and> []Q" by S43_solve
wenzelm@61386
   106
lemma "\<turnstile>  <>(P \<or> Q) \<longleftrightarrow> <>P \<or> <>Q" by S43_solve
wenzelm@61386
   107
lemma "\<turnstile>  [](P \<longleftrightarrow> Q) \<longleftrightarrow> (P>-<Q)" by S43_solve
wenzelm@61386
   108
lemma "\<turnstile>  <>(P \<longrightarrow> Q) \<longleftrightarrow> ([]P \<longrightarrow> <>Q)" by S43_solve
wenzelm@61386
   109
lemma "\<turnstile>        []P \<longleftrightarrow> \<not> <>(\<not> P)" by S43_solve
wenzelm@61386
   110
lemma "\<turnstile>     [](\<not>P) \<longleftrightarrow> \<not> <>P" by S43_solve
wenzelm@61386
   111
lemma "\<turnstile>       \<not> []P \<longleftrightarrow> <>(\<not> P)" by S43_solve
wenzelm@61386
   112
lemma "\<turnstile>      [][]P \<longleftrightarrow> \<not> <><>(\<not> P)" by S43_solve
wenzelm@61386
   113
lemma "\<turnstile> \<not> <>(P \<or> Q) \<longleftrightarrow> \<not> <>P \<and> \<not> <>Q" by S43_solve
wenzelm@21426
   114
wenzelm@61386
   115
lemma "\<turnstile> []P \<or> []Q \<longrightarrow> [](P \<or> Q)" by S43_solve
wenzelm@61386
   116
lemma "\<turnstile> <>(P \<and> Q) \<longrightarrow> <>P \<and> <>Q" by S43_solve
wenzelm@61386
   117
lemma "\<turnstile> [](P \<or> Q) \<longrightarrow> []P \<or> <>Q" by S43_solve
wenzelm@61386
   118
lemma "\<turnstile> <>P \<and> []Q \<longrightarrow> <>(P \<and> Q)" by S43_solve
wenzelm@61386
   119
lemma "\<turnstile> [](P \<or> Q) \<longrightarrow> <>P \<or> []Q" by S43_solve
wenzelm@61386
   120
lemma "\<turnstile> <>(P \<longrightarrow> (Q \<and> R)) \<longrightarrow> ([]P \<longrightarrow> <>Q) \<and> ([]P \<longrightarrow> <>R)" by S43_solve
wenzelm@61386
   121
lemma "\<turnstile> (P --< Q) \<and> (Q --<R ) \<longrightarrow> (P --< R)" by S43_solve
wenzelm@61386
   122
lemma "\<turnstile> []P \<longrightarrow> <>Q \<longrightarrow> <>(P \<and> Q)" by S43_solve
wenzelm@21426
   123
wenzelm@21426
   124
wenzelm@21426
   125
(* Theorems of system S4 from Hughes and Cresswell, p.46 *)
wenzelm@21426
   126
wenzelm@61386
   127
lemma "\<turnstile> []A \<longrightarrow> A" by S43_solve             (* refexivity *)
wenzelm@61386
   128
lemma "\<turnstile> []A \<longrightarrow> [][]A" by S43_solve         (* transitivity *)
wenzelm@61386
   129
lemma "\<turnstile> []A \<longrightarrow> <>A" by S43_solve           (* seriality *)
wenzelm@61386
   130
lemma "\<turnstile> <>[](<>A \<longrightarrow> []<>A)" by S43_solve
wenzelm@61386
   131
lemma "\<turnstile> <>[](<>[]A \<longrightarrow> []A)" by S43_solve
wenzelm@61386
   132
lemma "\<turnstile> []P \<longleftrightarrow> [][]P" by S43_solve
wenzelm@61386
   133
lemma "\<turnstile> <>P \<longleftrightarrow> <><>P" by S43_solve
wenzelm@61386
   134
lemma "\<turnstile> <>[]<>P \<longrightarrow> <>P" by S43_solve
wenzelm@61386
   135
lemma "\<turnstile> []<>P \<longleftrightarrow> []<>[]<>P" by S43_solve
wenzelm@61386
   136
lemma "\<turnstile> <>[]P \<longleftrightarrow> <>[]<>[]P" by S43_solve
wenzelm@21426
   137
wenzelm@21426
   138
(* Theorems for system S4 from Hughes and Cresswell, p.60 *)
wenzelm@21426
   139
wenzelm@61386
   140
lemma "\<turnstile> []P \<or> []Q \<longleftrightarrow> []([]P \<or> []Q)" by S43_solve
wenzelm@61386
   141
lemma "\<turnstile> ((P >-< Q) --< R) \<longrightarrow> ((P >-< Q) --< []R)" by S43_solve
wenzelm@21426
   142
wenzelm@21426
   143
(* These are from Hailpern, LNCS 129 *)
wenzelm@21426
   144
wenzelm@61386
   145
lemma "\<turnstile> [](P \<and> Q) \<longleftrightarrow> []P \<and> []Q" by S43_solve
wenzelm@61386
   146
lemma "\<turnstile> <>(P \<or> Q) \<longleftrightarrow> <>P \<or> <>Q" by S43_solve
wenzelm@61386
   147
lemma "\<turnstile> <>(P \<longrightarrow> Q) \<longleftrightarrow> ([]P \<longrightarrow> <>Q)" by S43_solve
wenzelm@21426
   148
wenzelm@61386
   149
lemma "\<turnstile> [](P \<longrightarrow> Q) \<longrightarrow> (<>P \<longrightarrow> <>Q)" by S43_solve
wenzelm@61386
   150
lemma "\<turnstile> []P \<longrightarrow> []<>P" by S43_solve
wenzelm@61386
   151
lemma "\<turnstile> <>[]P \<longrightarrow> <>P" by S43_solve
wenzelm@21426
   152
wenzelm@61386
   153
lemma "\<turnstile> []P \<or> []Q \<longrightarrow> [](P \<or> Q)" by S43_solve
wenzelm@61386
   154
lemma "\<turnstile> <>(P \<and> Q) \<longrightarrow> <>P \<and> <>Q" by S43_solve
wenzelm@61386
   155
lemma "\<turnstile> [](P \<or> Q) \<longrightarrow> []P \<or> <>Q" by S43_solve
wenzelm@61386
   156
lemma "\<turnstile> <>P \<and> []Q \<longrightarrow> <>(P \<and> Q)" by S43_solve
wenzelm@61386
   157
lemma "\<turnstile> [](P \<or> Q) \<longrightarrow> <>P \<or> []Q" by S43_solve
wenzelm@21426
   158
wenzelm@21426
   159
wenzelm@21426
   160
(* Theorems of system S43 *)
wenzelm@21426
   161
wenzelm@61386
   162
lemma "\<turnstile> <>[]P \<longrightarrow> []<>P" by S43_solve
wenzelm@61386
   163
lemma "\<turnstile> <>[]P \<longrightarrow> [][]<>P" by S43_solve
wenzelm@61386
   164
lemma "\<turnstile> [](<>P \<or> <>Q) \<longrightarrow> []<>P \<or> []<>Q" by S43_solve
wenzelm@61386
   165
lemma "\<turnstile> <>[]P \<and> <>[]Q \<longrightarrow> <>([]P \<and> []Q)" by S43_solve
wenzelm@61386
   166
lemma "\<turnstile> []([]P \<longrightarrow> []Q) \<or> []([]Q \<longrightarrow> []P)" by S43_solve
wenzelm@61386
   167
lemma "\<turnstile> [](<>P \<longrightarrow> <>Q) \<or> [](<>Q \<longrightarrow> <>P)" by S43_solve
wenzelm@61386
   168
lemma "\<turnstile> []([]P \<longrightarrow> Q) \<or> []([]Q \<longrightarrow> P)" by S43_solve
wenzelm@61386
   169
lemma "\<turnstile> [](P \<longrightarrow> <>Q) \<or> [](Q \<longrightarrow> <>P)" by S43_solve
wenzelm@61386
   170
lemma "\<turnstile> [](P \<longrightarrow> []Q \<longrightarrow> R) \<or> [](P \<or> ([]R \<longrightarrow> Q))" by S43_solve
wenzelm@61386
   171
lemma "\<turnstile> [](P \<or> (Q \<longrightarrow> <>C)) \<or> [](P \<longrightarrow> C \<longrightarrow> <>Q)" by S43_solve
wenzelm@61386
   172
lemma "\<turnstile> []([]P \<or> Q) \<and> [](P \<or> []Q) \<longrightarrow> []P \<or> []Q" by S43_solve
wenzelm@61386
   173
lemma "\<turnstile> <>P \<and> <>Q \<longrightarrow> <>(<>P \<and> Q) \<or> <>(P \<and> <>Q)" by S43_solve
wenzelm@61386
   174
lemma "\<turnstile> [](P \<or> Q) \<and> []([]P \<or> Q) \<and> [](P \<or> []Q) \<longrightarrow> []P \<or> []Q" by S43_solve
wenzelm@61386
   175
lemma "\<turnstile> <>P \<and> <>Q \<longrightarrow> <>(P \<and> Q) \<or> <>(<>P \<and> Q) \<or> <>(P \<and> <>Q)" by S43_solve
wenzelm@61386
   176
lemma "\<turnstile> <>[]<>P \<longleftrightarrow> []<>P" by S43_solve
wenzelm@61386
   177
lemma "\<turnstile> []<>[]P \<longleftrightarrow> <>[]P" by S43_solve
wenzelm@21426
   178
wenzelm@21426
   179
(* These are from Hailpern, LNCS 129 *)
wenzelm@21426
   180
wenzelm@61386
   181
lemma "\<turnstile> [](P \<and> Q) \<longleftrightarrow> []P \<and> []Q" by S43_solve
wenzelm@61386
   182
lemma "\<turnstile> <>(P \<or> Q) \<longleftrightarrow> <>P \<or> <>Q" by S43_solve
wenzelm@61386
   183
lemma "\<turnstile> <>(P \<longrightarrow> Q) \<longleftrightarrow> []P \<longrightarrow> <>Q" by S43_solve
wenzelm@21426
   184
wenzelm@61386
   185
lemma "\<turnstile> [](P \<longrightarrow> Q) \<longrightarrow> <>P \<longrightarrow> <>Q" by S43_solve
wenzelm@61386
   186
lemma "\<turnstile> []P \<longrightarrow> []<>P" by S43_solve
wenzelm@61386
   187
lemma "\<turnstile> <>[]P \<longrightarrow> <>P" by S43_solve
wenzelm@61386
   188
lemma "\<turnstile> []<>[]P \<longrightarrow> []<>P" by S43_solve
wenzelm@61386
   189
lemma "\<turnstile> <>[]P \<longrightarrow> <>[]<>P" by S43_solve
wenzelm@61386
   190
lemma "\<turnstile> <>[]P \<longrightarrow> []<>P" by S43_solve
wenzelm@61386
   191
lemma "\<turnstile> []<>[]P \<longleftrightarrow> <>[]P" by S43_solve
wenzelm@61386
   192
lemma "\<turnstile> <>[]<>P \<longleftrightarrow> []<>P" by S43_solve
wenzelm@21426
   193
wenzelm@61386
   194
lemma "\<turnstile> []P \<or> []Q \<longrightarrow> [](P \<or> Q)" by S43_solve
wenzelm@61386
   195
lemma "\<turnstile> <>(P \<and> Q) \<longrightarrow> <>P \<and> <>Q" by S43_solve
wenzelm@61386
   196
lemma "\<turnstile> [](P \<or> Q) \<longrightarrow> []P \<or> <>Q" by S43_solve
wenzelm@61386
   197
lemma "\<turnstile> <>P \<and> []Q \<longrightarrow> <>(P \<and> Q)" by S43_solve
wenzelm@61386
   198
lemma "\<turnstile> [](P \<or> Q) \<longrightarrow> <>P \<or> []Q" by S43_solve
wenzelm@61386
   199
lemma "\<turnstile> [](P \<or> Q) \<longrightarrow> []<>P \<or> []<>Q" by S43_solve
wenzelm@61386
   200
lemma "\<turnstile> <>[]P \<and> <>[]Q \<longrightarrow> <>(P \<and> Q)" by S43_solve
wenzelm@61386
   201
lemma "\<turnstile> <>[](P \<and> Q) \<longleftrightarrow> <>[]P \<and> <>[]Q" by S43_solve
wenzelm@61386
   202
lemma "\<turnstile> []<>(P \<or> Q) \<longleftrightarrow> []<>P \<or> []<>Q" by S43_solve
paulson@2073
   203
paulson@2073
   204
end