src/HOL/TLA/Intensional.thy
changeset 60591 e0b77517f9a9
parent 60588 750c533459b1
child 60592 c9bd1d902f04
equal deleted inserted replaced
60590:479071e8778f 60591:e0b77517f9a9
    41   ""            :: "lift \<Rightarrow> lift"                        ("'(_')")
    41   ""            :: "lift \<Rightarrow> lift"                        ("'(_')")
    42   "_lambda"     :: "[idts, 'a] \<Rightarrow> lift"                  ("(3\<lambda>_./ _)" [0, 3] 3)
    42   "_lambda"     :: "[idts, 'a] \<Rightarrow> lift"                  ("(3\<lambda>_./ _)" [0, 3] 3)
    43   "_constrain"  :: "[lift, type] \<Rightarrow> lift"                ("(_::_)" [4, 0] 3)
    43   "_constrain"  :: "[lift, type] \<Rightarrow> lift"                ("(_::_)" [4, 0] 3)
    44   ""            :: "lift \<Rightarrow> liftargs"                    ("_")
    44   ""            :: "lift \<Rightarrow> liftargs"                    ("_")
    45   "_liftargs"   :: "[lift, liftargs] \<Rightarrow> liftargs"        ("_,/ _")
    45   "_liftargs"   :: "[lift, liftargs] \<Rightarrow> liftargs"        ("_,/ _")
    46   "_Valid"      :: "lift \<Rightarrow> bool"                        ("(|- _)" 5)
    46   "_Valid"      :: "lift \<Rightarrow> bool"                        ("(\<turnstile> _)" 5)
    47   "_holdsAt"    :: "['a, lift] \<Rightarrow> bool"                  ("(_ |= _)" [100,10] 10)
    47   "_holdsAt"    :: "['a, lift] \<Rightarrow> bool"                  ("(_ \<Turnstile> _)" [100,10] 10)
    48 
    48 
    49   (* Syntax for lifted expressions outside the scope of \<turnstile> or |= *)
    49   (* Syntax for lifted expressions outside the scope of \<turnstile> or |= *)
    50   "_LIFT"       :: "lift \<Rightarrow> 'a"                          ("LIFT _")
    50   "_LIFT"       :: "lift \<Rightarrow> 'a"                          ("LIFT _")
    51 
    51 
    52   (* generic syntax for lifted constants and functions *)
    52   (* generic syntax for lifted constants and functions *)
    55   "_lift2"      :: "['a, lift, lift] \<Rightarrow> lift"            ("(_<_,/ _>)" [1000] 999)
    55   "_lift2"      :: "['a, lift, lift] \<Rightarrow> lift"            ("(_<_,/ _>)" [1000] 999)
    56   "_lift3"      :: "['a, lift, lift, lift] \<Rightarrow> lift"      ("(_<_,/ _,/ _>)" [1000] 999)
    56   "_lift3"      :: "['a, lift, lift, lift] \<Rightarrow> lift"      ("(_<_,/ _,/ _>)" [1000] 999)
    57 
    57 
    58   (* concrete syntax for common infix functions: reuse same symbol *)
    58   (* concrete syntax for common infix functions: reuse same symbol *)
    59   "_liftEqu"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ =/ _)" [50,51] 50)
    59   "_liftEqu"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ =/ _)" [50,51] 50)
    60   "_liftNeq"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ ~=/ _)" [50,51] 50)
    60   "_liftNeq"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ \<noteq>/ _)" [50,51] 50)
    61   "_liftNot"    :: "lift \<Rightarrow> lift"                        ("(~ _)" [40] 40)
    61   "_liftNot"    :: "lift \<Rightarrow> lift"                        ("(\<not> _)" [40] 40)
    62   "_liftAnd"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ &/ _)" [36,35] 35)
    62   "_liftAnd"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ \<and>/ _)" [36,35] 35)
    63   "_liftOr"     :: "[lift, lift] \<Rightarrow> lift"                ("(_ |/ _)" [31,30] 30)
    63   "_liftOr"     :: "[lift, lift] \<Rightarrow> lift"                ("(_ \<or>/ _)" [31,30] 30)
    64   "_liftImp"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ -->/ _)" [26,25] 25)
    64   "_liftImp"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ \<longrightarrow>/ _)" [26,25] 25)
    65   "_liftIf"     :: "[lift, lift, lift] \<Rightarrow> lift"          ("(if (_)/ then (_)/ else (_))" 10)
    65   "_liftIf"     :: "[lift, lift, lift] \<Rightarrow> lift"          ("(if (_)/ then (_)/ else (_))" 10)
    66   "_liftPlus"   :: "[lift, lift] \<Rightarrow> lift"                ("(_ +/ _)" [66,65] 65)
    66   "_liftPlus"   :: "[lift, lift] \<Rightarrow> lift"                ("(_ +/ _)" [66,65] 65)
    67   "_liftMinus"  :: "[lift, lift] \<Rightarrow> lift"                ("(_ -/ _)" [66,65] 65)
    67   "_liftMinus"  :: "[lift, lift] \<Rightarrow> lift"                ("(_ -/ _)" [66,65] 65)
    68   "_liftTimes"  :: "[lift, lift] \<Rightarrow> lift"                ("(_ */ _)" [71,70] 70)
    68   "_liftTimes"  :: "[lift, lift] \<Rightarrow> lift"                ("(_ */ _)" [71,70] 70)
    69   "_liftDiv"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ div _)" [71,70] 70)
    69   "_liftDiv"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ div _)" [71,70] 70)
    70   "_liftMod"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ mod _)" [71,70] 70)
    70   "_liftMod"    :: "[lift, lift] \<Rightarrow> lift"                ("(_ mod _)" [71,70] 70)
    71   "_liftLess"   :: "[lift, lift] \<Rightarrow> lift"                ("(_/ < _)"  [50, 51] 50)
    71   "_liftLess"   :: "[lift, lift] \<Rightarrow> lift"                ("(_/ < _)"  [50, 51] 50)
    72   "_liftLeq"    :: "[lift, lift] \<Rightarrow> lift"                ("(_/ <= _)" [50, 51] 50)
    72   "_liftLeq"    :: "[lift, lift] \<Rightarrow> lift"                ("(_/ \<le> _)" [50, 51] 50)
    73   "_liftMem"    :: "[lift, lift] \<Rightarrow> lift"                ("(_/ : _)" [50, 51] 50)
    73   "_liftMem"    :: "[lift, lift] \<Rightarrow> lift"                ("(_/ \<in> _)" [50, 51] 50)
    74   "_liftNotMem" :: "[lift, lift] \<Rightarrow> lift"                ("(_/ ~: _)" [50, 51] 50)
    74   "_liftNotMem" :: "[lift, lift] \<Rightarrow> lift"                ("(_/ \<notin> _)" [50, 51] 50)
    75   "_liftFinset" :: "liftargs \<Rightarrow> lift"                    ("{(_)}")
    75   "_liftFinset" :: "liftargs \<Rightarrow> lift"                    ("{(_)}")
    76   (** TODO: syntax for lifted collection / comprehension **)
    76   (** TODO: syntax for lifted collection / comprehension **)
    77   "_liftPair"   :: "[lift,liftargs] \<Rightarrow> lift"                   ("(1'(_,/ _'))")
    77   "_liftPair"   :: "[lift,liftargs] \<Rightarrow> lift"                   ("(1'(_,/ _'))")
    78   (* infix syntax for list operations *)
    78   (* infix syntax for list operations *)
    79   "_liftCons" :: "[lift, lift] \<Rightarrow> lift"                  ("(_ #/ _)" [65,66] 65)
    79   "_liftCons" :: "[lift, lift] \<Rightarrow> lift"                  ("(_ #/ _)" [65,66] 65)
    80   "_liftApp"  :: "[lift, lift] \<Rightarrow> lift"                  ("(_ @/ _)" [65,66] 65)
    80   "_liftApp"  :: "[lift, lift] \<Rightarrow> lift"                  ("(_ @/ _)" [65,66] 65)
    81   "_liftList" :: "liftargs \<Rightarrow> lift"                      ("[(_)]")
    81   "_liftList" :: "liftargs \<Rightarrow> lift"                      ("[(_)]")
    82 
    82 
    83   (* Rigid quantification (syntax level) *)
    83   (* Rigid quantification (syntax level) *)
    84   "_ARAll"  :: "[idts, lift] \<Rightarrow> lift"                    ("(3! _./ _)" [0, 10] 10)
    84   "_RAll" :: "[idts, lift] \<Rightarrow> lift"                      ("(3\<forall>_./ _)" [0, 10] 10)
    85   "_AREx"   :: "[idts, lift] \<Rightarrow> lift"                    ("(3? _./ _)" [0, 10] 10)
    85   "_REx"  :: "[idts, lift] \<Rightarrow> lift"                      ("(3\<exists>_./ _)" [0, 10] 10)
    86   "_AREx1"  :: "[idts, lift] \<Rightarrow> lift"                    ("(3?! _./ _)" [0, 10] 10)
    86   "_REx1" :: "[idts, lift] \<Rightarrow> lift"                      ("(3\<exists>!_./ _)" [0, 10] 10)
    87   "_RAll" :: "[idts, lift] \<Rightarrow> lift"                      ("(3ALL _./ _)" [0, 10] 10)
       
    88   "_REx"  :: "[idts, lift] \<Rightarrow> lift"                      ("(3EX _./ _)" [0, 10] 10)
       
    89   "_REx1" :: "[idts, lift] \<Rightarrow> lift"                      ("(3EX! _./ _)" [0, 10] 10)
       
    90 
    87 
    91 translations
    88 translations
    92   "_const"        == "CONST const"
    89   "_const"        == "CONST const"
    93   "_lift"         == "CONST lift"
    90   "_lift"         == "CONST lift"
    94   "_lift2"        == "CONST lift2"
    91   "_lift2"        == "CONST lift2"
    95   "_lift3"        == "CONST lift3"
    92   "_lift3"        == "CONST lift3"
    96   "_Valid"        == "CONST Valid"
    93   "_Valid"        == "CONST Valid"
    97   "_RAll x A"     == "Rall x. A"
    94   "_RAll x A"     == "Rall x. A"
    98   "_REx x  A"     == "Rex x. A"
    95   "_REx x  A"     == "Rex x. A"
    99   "_REx1 x  A"    == "Rex! x. A"
    96   "_REx1 x  A"    == "Rex! x. A"
   100   "_ARAll"        => "_RAll"
    97 
   101   "_AREx"         => "_REx"
    98   "w \<Turnstile> A"        => "A w"
   102   "_AREx1"        => "_REx1"
    99   "LIFT A"        => "A::_\<Rightarrow>_"
   103 
       
   104   "w |= A"        => "A w"
       
   105   "LIFT A"        => "A::_=>_"
       
   106 
   100 
   107   "_liftEqu"      == "_lift2 (op =)"
   101   "_liftEqu"      == "_lift2 (op =)"
   108   "_liftNeq u v"  == "_liftNot (_liftEqu u v)"
   102   "_liftNeq u v"  == "_liftNot (_liftEqu u v)"
   109   "_liftNot"      == "_lift (CONST Not)"
   103   "_liftNot"      == "_lift (CONST Not)"
   110   "_liftAnd"      == "_lift2 (op &)"
   104   "_liftAnd"      == "_lift2 (op \<and>)"
   111   "_liftOr"       == "_lift2 (op | )"
   105   "_liftOr"       == "_lift2 (op \<or>)"
   112   "_liftImp"      == "_lift2 (op -->)"
   106   "_liftImp"      == "_lift2 (op \<longrightarrow>)"
   113   "_liftIf"       == "_lift3 (CONST If)"
   107   "_liftIf"       == "_lift3 (CONST If)"
   114   "_liftPlus"     == "_lift2 (op +)"
   108   "_liftPlus"     == "_lift2 (op +)"
   115   "_liftMinus"    == "_lift2 (op -)"
   109   "_liftMinus"    == "_lift2 (op -)"
   116   "_liftTimes"    == "_lift2 (op *)"
   110   "_liftTimes"    == "_lift2 (op *)"
   117   "_liftDiv"      == "_lift2 (op div)"
   111   "_liftDiv"      == "_lift2 (op div)"
   118   "_liftMod"      == "_lift2 (op mod)"
   112   "_liftMod"      == "_lift2 (op mod)"
   119   "_liftLess"     == "_lift2 (op <)"
   113   "_liftLess"     == "_lift2 (op <)"
   120   "_liftLeq"      == "_lift2 (op <=)"
   114   "_liftLeq"      == "_lift2 (op \<le>)"
   121   "_liftMem"      == "_lift2 (op :)"
   115   "_liftMem"      == "_lift2 (op \<in>)"
   122   "_liftNotMem x xs"   == "_liftNot (_liftMem x xs)"
   116   "_liftNotMem x xs"   == "_liftNot (_liftMem x xs)"
   123   "_liftFinset (_liftargs x xs)"  == "_lift2 (CONST insert) x (_liftFinset xs)"
   117   "_liftFinset (_liftargs x xs)"  == "_lift2 (CONST insert) x (_liftFinset xs)"
   124   "_liftFinset x" == "_lift2 (CONST insert) x (_const {})"
   118   "_liftFinset x" == "_lift2 (CONST insert) x (_const {})"
   125   "_liftPair x (_liftargs y z)"       == "_liftPair x (_liftPair y z)"
   119   "_liftPair x (_liftargs y z)"       == "_liftPair x (_liftPair y z)"
   126   "_liftPair"     == "_lift2 (CONST Pair)"
   120   "_liftPair"     == "_lift2 (CONST Pair)"
   129   "_liftList (_liftargs x xs)"  == "_liftCons x (_liftList xs)"
   123   "_liftList (_liftargs x xs)"  == "_liftCons x (_liftList xs)"
   130   "_liftList x"   == "_liftCons x (_const [])"
   124   "_liftList x"   == "_liftCons x (_const [])"
   131 
   125 
   132 
   126 
   133 
   127 
   134   "w |= ~A"       <= "_liftNot A w"
   128   "w \<Turnstile> \<not>A"       <= "_liftNot A w"
   135   "w |= A & B"    <= "_liftAnd A B w"
   129   "w \<Turnstile> A \<and> B"    <= "_liftAnd A B w"
   136   "w |= A | B"    <= "_liftOr A B w"
   130   "w \<Turnstile> A \<or> B"    <= "_liftOr A B w"
   137   "w |= A --> B"  <= "_liftImp A B w"
   131   "w \<Turnstile> A \<longrightarrow> B"  <= "_liftImp A B w"
   138   "w |= u = v"    <= "_liftEqu u v w"
   132   "w \<Turnstile> u = v"    <= "_liftEqu u v w"
   139   "w |= ALL x. A"   <= "_RAll x A w"
   133   "w \<Turnstile> \<forall>x. A"   <= "_RAll x A w"
   140   "w |= EX x. A"   <= "_REx x A w"
   134   "w \<Turnstile> \<exists>x. A"   <= "_REx x A w"
   141   "w |= EX! x. A"  <= "_REx1 x A w"
   135   "w \<Turnstile> \<exists>!x. A"  <= "_REx1 x A w"
   142 
       
   143 syntax (xsymbols)
       
   144   "_Valid"      :: "lift \<Rightarrow> bool"                        ("(\<turnstile> _)" 5)
       
   145   "_holdsAt"    :: "['a, lift] \<Rightarrow> bool"                  ("(_ \<Turnstile> _)" [100,10] 10)
       
   146   "_liftNeq"    :: "[lift, lift] \<Rightarrow> lift"                (infixl "\<noteq>" 50)
       
   147   "_liftNot"    :: "lift \<Rightarrow> lift"                        ("\<not> _" [40] 40)
       
   148   "_liftAnd"    :: "[lift, lift] \<Rightarrow> lift"                (infixr "\<and>" 35)
       
   149   "_liftOr"     :: "[lift, lift] \<Rightarrow> lift"                (infixr "\<or>" 30)
       
   150   "_liftImp"    :: "[lift, lift] \<Rightarrow> lift"                (infixr "\<longrightarrow>" 25)
       
   151   "_RAll"       :: "[idts, lift] \<Rightarrow> lift"                ("(3\<forall>_./ _)" [0, 10] 10)
       
   152   "_REx"        :: "[idts, lift] \<Rightarrow> lift"                ("(3\<exists>_./ _)" [0, 10] 10)
       
   153   "_REx1"       :: "[idts, lift] \<Rightarrow> lift"                ("(3\<exists>!_./ _)" [0, 10] 10)
       
   154   "_liftLeq"    :: "[lift, lift] \<Rightarrow> lift"                ("(_/ \<le> _)" [50, 51] 50)
       
   155   "_liftMem"    :: "[lift, lift] \<Rightarrow> lift"                ("(_/ \<in> _)" [50, 51] 50)
       
   156   "_liftNotMem" :: "[lift, lift] \<Rightarrow> lift"                ("(_/ \<notin> _)" [50, 51] 50)
       
   157 
   136 
   158 defs
   137 defs
   159   Valid_def:   "\<turnstile> A    ==  \<forall>w. w \<Turnstile> A"
   138   Valid_def:   "\<turnstile> A    ==  \<forall>w. w \<Turnstile> A"
   160 
   139 
   161   unl_con:     "LIFT #c w  ==  c"
   140   unl_con:     "LIFT #c w  ==  c"
   162   unl_lift:    "lift f x w == f (x w)"
   141   unl_lift:    "lift f x w == f (x w)"
   163   unl_lift2:   "LIFT f<x, y> w == f (x w) (y w)"
   142   unl_lift2:   "LIFT f<x, y> w == f (x w) (y w)"
   164   unl_lift3:   "LIFT f<x, y, z> w == f (x w) (y w) (z w)"
   143   unl_lift3:   "LIFT f<x, y, z> w == f (x w) (y w) (z w)"
   165 
   144 
   166   unl_Rall:    "w \<Turnstile> \<forall>x. A x  ==  \<forall>x. (w \<Turnstile> A x)"
   145   unl_Rall:    "w \<Turnstile> \<forall>x. A x  ==  \<forall>x. (w \<Turnstile> A x)"
   167   unl_Rex:     "w \<Turnstile> \<exists>x. A x   ==  \<exists> x. (w \<Turnstile> A x)"
   146   unl_Rex:     "w \<Turnstile> \<exists>x. A x   ==  \<exists>x. (w \<Turnstile> A x)"
   168   unl_Rex1:    "w \<Turnstile> \<exists>!x. A x  ==  \<exists>!x. (w \<Turnstile> A x)"
   147   unl_Rex1:    "w \<Turnstile> \<exists>!x. A x  ==  \<exists>!x. (w \<Turnstile> A x)"
   169 
   148 
   170 
   149 
   171 subsection {* Lemmas and tactics for "intensional" logics. *}
   150 subsection {* Lemmas and tactics for "intensional" logics. *}
   172 
   151 
   200   "\<turnstile> (P \<noteq> Q) = (P = (\<not>Q))"
   179   "\<turnstile> (P \<noteq> Q) = (P = (\<not>Q))"
   201   "\<turnstile> (#True=P) = P"  "\<turnstile> (P=#True) = P"
   180   "\<turnstile> (#True=P) = P"  "\<turnstile> (P=#True) = P"
   202   "\<turnstile> (#True \<longrightarrow> P) = P"  "\<turnstile> (#False \<longrightarrow> P) = #True"
   181   "\<turnstile> (#True \<longrightarrow> P) = P"  "\<turnstile> (#False \<longrightarrow> P) = #True"
   203   "\<turnstile> (P \<longrightarrow> #True) = #True"  "\<turnstile> (P \<longrightarrow> P) = #True"
   182   "\<turnstile> (P \<longrightarrow> #True) = #True"  "\<turnstile> (P \<longrightarrow> P) = #True"
   204   "\<turnstile> (P \<longrightarrow> #False) = (\<not>P)"  "\<turnstile> (P \<longrightarrow> \<not>P) = (\<not>P)"
   183   "\<turnstile> (P \<longrightarrow> #False) = (\<not>P)"  "\<turnstile> (P \<longrightarrow> \<not>P) = (\<not>P)"
   205   "\<turnstile> (P & #True) = P"  "\<turnstile> (#True & P) = P"
   184   "\<turnstile> (P \<and> #True) = P"  "\<turnstile> (#True \<and> P) = P"
   206   "\<turnstile> (P & #False) = #False"  "\<turnstile> (#False & P) = #False"
   185   "\<turnstile> (P \<and> #False) = #False"  "\<turnstile> (#False \<and> P) = #False"
   207   "\<turnstile> (P & P) = P"  "\<turnstile> (P & \<not>P) = #False"  "\<turnstile> (\<not>P & P) = #False"
   186   "\<turnstile> (P \<and> P) = P"  "\<turnstile> (P \<and> \<not>P) = #False"  "\<turnstile> (\<not>P \<and> P) = #False"
   208   "\<turnstile> (P | #True) = #True"  "\<turnstile> (#True | P) = #True"
   187   "\<turnstile> (P \<or> #True) = #True"  "\<turnstile> (#True \<or> P) = #True"
   209   "\<turnstile> (P | #False) = P"  "\<turnstile> (#False | P) = P"
   188   "\<turnstile> (P \<or> #False) = P"  "\<turnstile> (#False \<or> P) = P"
   210   "\<turnstile> (P | P) = P"  "\<turnstile> (P | \<not>P) = #True"  "\<turnstile> (\<not>P | P) = #True"
   189   "\<turnstile> (P \<or> P) = P"  "\<turnstile> (P \<or> \<not>P) = #True"  "\<turnstile> (\<not>P \<or> P) = #True"
   211   "\<turnstile> (\<forall>x. P) = P"  "\<turnstile> (\<exists>x. P) = P"
   190   "\<turnstile> (\<forall>x. P) = P"  "\<turnstile> (\<exists>x. P) = P"
   212   "\<turnstile> (\<not>Q \<longrightarrow> \<not>P) = (P \<longrightarrow> Q)"
   191   "\<turnstile> (\<not>Q \<longrightarrow> \<not>P) = (P \<longrightarrow> Q)"
   213   "\<turnstile> (P|Q \<longrightarrow> R) = ((P\<longrightarrow>R)&(Q\<longrightarrow>R))"
   192   "\<turnstile> (P\<or>Q \<longrightarrow> R) = ((P\<longrightarrow>R)\<and>(Q\<longrightarrow>R))"
   214   apply (unfold Valid_def intensional_rews)
   193   apply (unfold Valid_def intensional_rews)
   215   apply blast+
   194   apply blast+
   216   done
   195   done
   217 
   196 
   218 declare int_simps [THEN inteq_reflection, simp]
   197 declare int_simps [THEN inteq_reflection, simp]