src/HOL/TLA/Intensional.thy
changeset 60587 0318b43ee95c
parent 59582 0fbed69ff081
child 60588 750c533459b1
equal deleted inserted replaced
60586:1d31e3a50373 60587:0318b43ee95c
    37   ""            :: "id => lift"                          ("_")
    37   ""            :: "id => lift"                          ("_")
    38   ""            :: "longid => lift"                      ("_")
    38   ""            :: "longid => lift"                      ("_")
    39   ""            :: "var => lift"                         ("_")
    39   ""            :: "var => lift"                         ("_")
    40   "_applC"      :: "[lift, cargs] => lift"               ("(1_/ _)" [1000, 1000] 999)
    40   "_applC"      :: "[lift, cargs] => lift"               ("(1_/ _)" [1000, 1000] 999)
    41   ""            :: "lift => lift"                        ("'(_')")
    41   ""            :: "lift => lift"                        ("'(_')")
    42   "_lambda"     :: "[idts, 'a] => lift"                  ("(3%_./ _)" [0, 3] 3)
    42   "_lambda"     :: "[idts, 'a] => lift"                  ("(3\<lambda>_./ _)" [0, 3] 3)
    43   "_constrain"  :: "[lift, type] => lift"                ("(_::_)" [4, 0] 3)
    43   "_constrain"  :: "[lift, type] => lift"                ("(_::_)" [4, 0] 3)
    44   ""            :: "lift => liftargs"                    ("_")
    44   ""            :: "lift => liftargs"                    ("_")
    45   "_liftargs"   :: "[lift, liftargs] => liftargs"        ("_,/ _")
    45   "_liftargs"   :: "[lift, liftargs] => liftargs"        ("_,/ _")
    46   "_Valid"      :: "lift => bool"                        ("(|- _)" 5)
    46   "_Valid"      :: "lift => bool"                        ("(|- _)" 5)
    47   "_holdsAt"    :: "['a, lift] => bool"                  ("(_ |= _)" [100,10] 10)
    47   "_holdsAt"    :: "['a, lift] => bool"                  ("(_ |= _)" [100,10] 10)
   153   "_REx1"       :: "[idts, lift] => lift"                ("(3\<exists>!_./ _)" [0, 10] 10)
   153   "_REx1"       :: "[idts, lift] => lift"                ("(3\<exists>!_./ _)" [0, 10] 10)
   154   "_liftLeq"    :: "[lift, lift] => lift"                ("(_/ \<le> _)" [50, 51] 50)
   154   "_liftLeq"    :: "[lift, lift] => lift"                ("(_/ \<le> _)" [50, 51] 50)
   155   "_liftMem"    :: "[lift, lift] => lift"                ("(_/ \<in> _)" [50, 51] 50)
   155   "_liftMem"    :: "[lift, lift] => lift"                ("(_/ \<in> _)" [50, 51] 50)
   156   "_liftNotMem" :: "[lift, lift] => lift"                ("(_/ \<notin> _)" [50, 51] 50)
   156   "_liftNotMem" :: "[lift, lift] => lift"                ("(_/ \<notin> _)" [50, 51] 50)
   157 
   157 
   158 syntax (HTML output)
       
   159   "_liftNeq"    :: "[lift, lift] => lift"                (infixl "\<noteq>" 50)
       
   160   "_liftNot"    :: "lift => lift"                        ("\<not> _" [40] 40)
       
   161   "_liftAnd"    :: "[lift, lift] => lift"                (infixr "\<and>" 35)
       
   162   "_liftOr"     :: "[lift, lift] => lift"                (infixr "\<or>" 30)
       
   163   "_RAll"       :: "[idts, lift] => lift"                ("(3\<forall>_./ _)" [0, 10] 10)
       
   164   "_REx"        :: "[idts, lift] => lift"                ("(3\<exists>_./ _)" [0, 10] 10)
       
   165   "_REx1"       :: "[idts, lift] => lift"                ("(3\<exists>!_./ _)" [0, 10] 10)
       
   166   "_liftLeq"    :: "[lift, lift] => lift"                ("(_/ \<le> _)" [50, 51] 50)
       
   167   "_liftMem"    :: "[lift, lift] => lift"                ("(_/ \<in> _)" [50, 51] 50)
       
   168   "_liftNotMem" :: "[lift, lift] => lift"                ("(_/ \<notin> _)" [50, 51] 50)
       
   169 
       
   170 defs
   158 defs
   171   Valid_def:   "|- A    ==  ALL w. w |= A"
   159   Valid_def:   "|- A    ==  \<forall>w. w |= A"
   172 
   160 
   173   unl_con:     "LIFT #c w  ==  c"
   161   unl_con:     "LIFT #c w  ==  c"
   174   unl_lift:    "lift f x w == f (x w)"
   162   unl_lift:    "lift f x w == f (x w)"
   175   unl_lift2:   "LIFT f<x, y> w == f (x w) (y w)"
   163   unl_lift2:   "LIFT f<x, y> w == f (x w) (y w)"
   176   unl_lift3:   "LIFT f<x, y, z> w == f (x w) (y w) (z w)"
   164   unl_lift3:   "LIFT f<x, y, z> w == f (x w) (y w) (z w)"
   177 
   165 
   178   unl_Rall:    "w |= ALL x. A x  ==  ALL x. (w |= A x)"
   166   unl_Rall:    "w |= \<forall>x. A x  ==  \<forall>x. (w |= A x)"
   179   unl_Rex:     "w |= EX x. A x   ==  EX x. (w |= A x)"
   167   unl_Rex:     "w |= \<exists>x. A x   ==  \<exists> x. (w |= A x)"
   180   unl_Rex1:    "w |= EX! x. A x  ==  EX! x. (w |= A x)"
   168   unl_Rex1:    "w |= \<exists>!x. A x  ==  \<exists>!x. (w |= A x)"
   181 
   169 
   182 
   170 
   183 subsection {* Lemmas and tactics for "intensional" logics. *}
   171 subsection {* Lemmas and tactics for "intensional" logics. *}
   184 
   172 
   185 lemmas intensional_rews [simp] =
   173 lemmas intensional_rews [simp] =
   190   apply (rule eq_reflection)
   178   apply (rule eq_reflection)
   191   apply (rule ext)
   179   apply (rule ext)
   192   apply (erule spec)
   180   apply (erule spec)
   193   done
   181   done
   194 
   182 
   195 lemma intI [intro!]: "(!!w. w |= A) ==> |- A"
   183 lemma intI [intro!]: "(\<And>w. w |= A) ==> |- A"
   196   apply (unfold Valid_def)
   184   apply (unfold Valid_def)
   197   apply (rule allI)
   185   apply (rule allI)
   198   apply (erule meta_spec)
   186   apply (erule meta_spec)
   199   done
   187   done
   200 
   188 
   205 
   193 
   206 (** Lift usual HOL simplifications to "intensional" level. **)
   194 (** Lift usual HOL simplifications to "intensional" level. **)
   207 
   195 
   208 lemma int_simps:
   196 lemma int_simps:
   209   "|- (x=x) = #True"
   197   "|- (x=x) = #True"
   210   "|- (~#True) = #False"  "|- (~#False) = #True"  "|- (~~ P) = P"
   198   "|- (\<not>#True) = #False"  "|- (\<not>#False) = #True"  "|- (\<not>\<not> P) = P"
   211   "|- ((~P) = P) = #False"  "|- (P = (~P)) = #False"
   199   "|- ((\<not>P) = P) = #False"  "|- (P = (\<not>P)) = #False"
   212   "|- (P ~= Q) = (P = (~Q))"
   200   "|- (P \<noteq> Q) = (P = (\<not>Q))"
   213   "|- (#True=P) = P"  "|- (P=#True) = P"
   201   "|- (#True=P) = P"  "|- (P=#True) = P"
   214   "|- (#True --> P) = P"  "|- (#False --> P) = #True"
   202   "|- (#True --> P) = P"  "|- (#False --> P) = #True"
   215   "|- (P --> #True) = #True"  "|- (P --> P) = #True"
   203   "|- (P --> #True) = #True"  "|- (P --> P) = #True"
   216   "|- (P --> #False) = (~P)"  "|- (P --> ~P) = (~P)"
   204   "|- (P --> #False) = (\<not>P)"  "|- (P --> \<not>P) = (\<not>P)"
   217   "|- (P & #True) = P"  "|- (#True & P) = P"
   205   "|- (P & #True) = P"  "|- (#True & P) = P"
   218   "|- (P & #False) = #False"  "|- (#False & P) = #False"
   206   "|- (P & #False) = #False"  "|- (#False & P) = #False"
   219   "|- (P & P) = P"  "|- (P & ~P) = #False"  "|- (~P & P) = #False"
   207   "|- (P & P) = P"  "|- (P & \<not>P) = #False"  "|- (\<not>P & P) = #False"
   220   "|- (P | #True) = #True"  "|- (#True | P) = #True"
   208   "|- (P | #True) = #True"  "|- (#True | P) = #True"
   221   "|- (P | #False) = P"  "|- (#False | P) = P"
   209   "|- (P | #False) = P"  "|- (#False | P) = P"
   222   "|- (P | P) = P"  "|- (P | ~P) = #True"  "|- (~P | P) = #True"
   210   "|- (P | P) = P"  "|- (P | \<not>P) = #True"  "|- (\<not>P | P) = #True"
   223   "|- (! x. P) = P"  "|- (? x. P) = P"
   211   "|- (\<forall>x. P) = P"  "|- (\<exists>x. P) = P"
   224   "|- (~Q --> ~P) = (P --> Q)"
   212   "|- (\<not>Q --> \<not>P) = (P --> Q)"
   225   "|- (P|Q --> R) = ((P-->R)&(Q-->R))"
   213   "|- (P|Q --> R) = ((P-->R)&(Q-->R))"
   226   apply (unfold Valid_def intensional_rews)
   214   apply (unfold Valid_def intensional_rews)
   227   apply blast+
   215   apply blast+
   228   done
   216   done
   229 
   217 
   294   {* Scan.succeed (Thm.rule_attribute (int_rewrite o Context.proof_of)) *}
   282   {* Scan.succeed (Thm.rule_attribute (int_rewrite o Context.proof_of)) *}
   295 attribute_setup flatten = {* Scan.succeed (Thm.rule_attribute (K flatten)) *}
   283 attribute_setup flatten = {* Scan.succeed (Thm.rule_attribute (K flatten)) *}
   296 attribute_setup int_use =
   284 attribute_setup int_use =
   297   {* Scan.succeed (Thm.rule_attribute (int_use o Context.proof_of)) *}
   285   {* Scan.succeed (Thm.rule_attribute (int_use o Context.proof_of)) *}
   298 
   286 
   299 lemma Not_Rall: "|- (~(! x. F x)) = (? x. ~F x)"
   287 lemma Not_Rall: "|- (\<not>(\<forall>x. F x)) = (\<exists>x. \<not>F x)"
   300   by (simp add: Valid_def)
   288   by (simp add: Valid_def)
   301 
   289 
   302 lemma Not_Rex: "|- (~ (? x. F x)) = (! x. ~ F x)"
   290 lemma Not_Rex: "|- (\<not> (\<exists>x. F x)) = (\<forall>x. \<not> F x)"
   303   by (simp add: Valid_def)
   291   by (simp add: Valid_def)
   304 
   292 
   305 end
   293 end