src/HOL/HOL.thy
changeset 80760 be8c0e039a5e
parent 80701 39cd50407f79
child 80762 db4ac82659f4
equal deleted inserted replaced
80759:4641f0fdaa59 80760:be8c0e039a5e
   127 
   127 
   128 subsubsection \<open>Additional concrete syntax\<close>
   128 subsubsection \<open>Additional concrete syntax\<close>
   129 
   129 
   130 syntax (ASCII) "_Uniq" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(4?< _./ _)" [0, 10] 10)
   130 syntax (ASCII) "_Uniq" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(4?< _./ _)" [0, 10] 10)
   131 syntax "_Uniq" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(2\<exists>\<^sub>\<le>\<^sub>1 _./ _)" [0, 10] 10)
   131 syntax "_Uniq" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(2\<exists>\<^sub>\<le>\<^sub>1 _./ _)" [0, 10] 10)
       
   132 
       
   133 syntax_consts "_Uniq" \<rightleftharpoons> Uniq
       
   134 
   132 translations "\<exists>\<^sub>\<le>\<^sub>1x. P" \<rightleftharpoons> "CONST Uniq (\<lambda>x. P)"
   135 translations "\<exists>\<^sub>\<le>\<^sub>1x. P" \<rightleftharpoons> "CONST Uniq (\<lambda>x. P)"
   133 
   136 
   134 print_translation \<open>
   137 print_translation \<open>
   135  [Syntax_Trans.preserve_binder_abs_tr' \<^const_syntax>\<open>Uniq\<close> \<^syntax_const>\<open>_Uniq\<close>]
   138  [Syntax_Trans.preserve_binder_abs_tr' \<^const_syntax>\<open>Uniq\<close> \<^syntax_const>\<open>_Uniq\<close>]
   136 \<close> \<comment> \<open>to avoid eta-contraction of body\<close>
   139 \<close> \<comment> \<open>to avoid eta-contraction of body\<close>
   139 syntax (ASCII)
   142 syntax (ASCII)
   140   "_Ex1" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(3EX! _./ _)" [0, 10] 10)
   143   "_Ex1" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(3EX! _./ _)" [0, 10] 10)
   141 syntax (input)
   144 syntax (input)
   142   "_Ex1" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(3?! _./ _)" [0, 10] 10)
   145   "_Ex1" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(3?! _./ _)" [0, 10] 10)
   143 syntax "_Ex1" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(3\<exists>!_./ _)" [0, 10] 10)
   146 syntax "_Ex1" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(3\<exists>!_./ _)" [0, 10] 10)
       
   147 
       
   148 syntax_consts "_Ex1" \<rightleftharpoons> Ex1
       
   149 
   144 translations "\<exists>!x. P" \<rightleftharpoons> "CONST Ex1 (\<lambda>x. P)"
   150 translations "\<exists>!x. P" \<rightleftharpoons> "CONST Ex1 (\<lambda>x. P)"
   145 
   151 
   146 print_translation \<open>
   152 print_translation \<open>
   147  [Syntax_Trans.preserve_binder_abs_tr' \<^const_syntax>\<open>Ex1\<close> \<^syntax_const>\<open>_Ex1\<close>]
   153  [Syntax_Trans.preserve_binder_abs_tr' \<^const_syntax>\<open>Ex1\<close> \<^syntax_const>\<open>_Ex1\<close>]
   148 \<close> \<comment> \<open>to avoid eta-contraction of body\<close>
   154 \<close> \<comment> \<open>to avoid eta-contraction of body\<close>
   149 
   155 
   150 
   156 
   151 syntax
   157 syntax
   152   "_Not_Ex" :: "idts \<Rightarrow> bool \<Rightarrow> bool"  ("(3\<nexists>_./ _)" [0, 10] 10)
   158   "_Not_Ex" :: "idts \<Rightarrow> bool \<Rightarrow> bool"  ("(3\<nexists>_./ _)" [0, 10] 10)
   153   "_Not_Ex1" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(3\<nexists>!_./ _)" [0, 10] 10)
   159   "_Not_Ex1" :: "pttrn \<Rightarrow> bool \<Rightarrow> bool"  ("(3\<nexists>!_./ _)" [0, 10] 10)
       
   160 syntax_consts
       
   161   "_Not_Ex" \<rightleftharpoons> Ex and
       
   162   "_Not_Ex1" \<rightleftharpoons> Ex1
   154 translations
   163 translations
   155   "\<nexists>x. P" \<rightleftharpoons> "\<not> (\<exists>x. P)"
   164   "\<nexists>x. P" \<rightleftharpoons> "\<not> (\<exists>x. P)"
   156   "\<nexists>!x. P" \<rightleftharpoons> "\<not> (\<exists>!x. P)"
   165   "\<nexists>!x. P" \<rightleftharpoons> "\<not> (\<exists>!x. P)"
   157 
   166 
   158 
   167 
   169 abbreviation (iff)
   178 abbreviation (iff)
   170   iff :: "[bool, bool] \<Rightarrow> bool"  (infixr "\<longleftrightarrow>" 25)
   179   iff :: "[bool, bool] \<Rightarrow> bool"  (infixr "\<longleftrightarrow>" 25)
   171   where "A \<longleftrightarrow> B \<equiv> A = B"
   180   where "A \<longleftrightarrow> B \<equiv> A = B"
   172 
   181 
   173 syntax "_The" :: "[pttrn, bool] \<Rightarrow> 'a"  ("(3THE _./ _)" [0, 10] 10)
   182 syntax "_The" :: "[pttrn, bool] \<Rightarrow> 'a"  ("(3THE _./ _)" [0, 10] 10)
       
   183 syntax_consts "_The" \<rightleftharpoons> The
   174 translations "THE x. P" \<rightleftharpoons> "CONST The (\<lambda>x. P)"
   184 translations "THE x. P" \<rightleftharpoons> "CONST The (\<lambda>x. P)"
   175 print_translation \<open>
   185 print_translation \<open>
   176   [(\<^const_syntax>\<open>The\<close>, fn _ => fn [Abs abs] =>
   186   [(\<^const_syntax>\<open>The\<close>, fn _ => fn [Abs abs] =>
   177       let val (x, t) = Syntax_Trans.atomic_abs_tr' abs
   187       let val (x, t) = Syntax_Trans.atomic_abs_tr' abs
   178       in Syntax.const \<^syntax_const>\<open>_The\<close> $ x $ t end)]
   188       in Syntax.const \<^syntax_const>\<open>_The\<close> $ x $ t end)]
   225   where "If P x y \<equiv> (THE z::'a. (P = True \<longrightarrow> z = x) \<and> (P = False \<longrightarrow> z = y))"
   235   where "If P x y \<equiv> (THE z::'a. (P = True \<longrightarrow> z = x) \<and> (P = False \<longrightarrow> z = y))"
   226 
   236 
   227 definition Let :: "'a \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b"
   237 definition Let :: "'a \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b"
   228   where "Let s f \<equiv> f s"
   238   where "Let s f \<equiv> f s"
   229 
   239 
       
   240 syntax_consts
       
   241   "_bind" "_binds" "_Let" \<rightleftharpoons> Let
   230 translations
   242 translations
   231   "_Let (_binds b bs) e"  \<rightleftharpoons> "_Let b (_Let bs e)"
   243   "_Let (_binds b bs) e"  \<rightleftharpoons> "_Let b (_Let bs e)"
   232   "let x = a in e"        \<rightleftharpoons> "CONST Let a (\<lambda>x. e)"
   244   "let x = a in e"        \<rightleftharpoons> "CONST Let a (\<lambda>x. e)"
   233 
   245 
   234 axiomatization undefined :: 'a
   246 axiomatization undefined :: 'a