print translation for ALL x <= n. P x
authorkleing
Wed, 14 Jan 2004 07:53:27 +0100
changeset 14357 e49d5d5ae66a
parent 14356 9e3ce012f843
child 14358 233c5bd5b539
print translation for ALL x <= n. P x
doc-src/TutorialI/Types/Overloading2.thy
src/HOL/HOL.thy
--- a/doc-src/TutorialI/Types/Overloading2.thy	Wed Jan 14 04:41:16 2004 +0100
+++ b/doc-src/TutorialI/Types/Overloading2.thy	Wed Jan 14 07:53:27 2004 +0100
@@ -32,14 +32,12 @@
 defined on all numeric types and sometimes on other types as well, for example
 $-$ and @{text"\<le>"} on sets.
 
-In addition there is a special input syntax for bounded quantifiers:
+In addition there is a special syntax for bounded quantifiers:
 \begin{center}
 \begin{tabular}{lcl}
-@{text"\<forall>x \<le> y. P x"} & @{text"\<rightharpoonup>"} & @{prop"\<forall>x. x \<le> y \<longrightarrow> P x"} \\
-@{text"\<exists>x \<le> y. P x"} & @{text"\<rightharpoonup>"} & @{prop"\<exists>x. x \<le> y \<and> P x"}
+@{prop"\<forall>x \<le> y. P x"} & @{text"\<rightleftharpoons>"} & @{prop [source] "\<forall>x. x \<le> y \<longrightarrow> P x"} \\
+@{prop"\<exists>x \<le> y. P x"} & @{text"\<rightleftharpoons>"} & @{prop [source] "\<exists>x. x \<le> y \<and> P x"}
 \end{tabular}
 \end{center}
 And analogously for @{text"<"} instead of @{text"\<le>"}.
-The form on the left is translated into the one on the right upon input.
-For technical reasons, it is not translated back upon output.
 *}(*<*)end(*>*)
--- a/src/HOL/HOL.thy	Wed Jan 14 04:41:16 2004 +0100
+++ b/src/HOL/HOL.thy	Wed Jan 14 07:53:27 2004 +0100
@@ -969,4 +969,26 @@
  "ALL x<=y. P"  =>  "ALL x. x <= y --> P"
  "EX x<=y. P"   =>  "EX x. x <= y & P"
 
+print_translation {*
+let
+  fun all_tr' [Const ("_bound",_) $ Free (v,_), 
+               Const("op -->",_) $ (Const ("op <",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = 
+  (if v=v' then Syntax.const "_lessAll" $ Syntax.mark_bound v' $ n $ P else raise Match)
+
+  | all_tr' [Const ("_bound",_) $ Free (v,_), 
+               Const("op -->",_) $ (Const ("op <=",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = 
+  (if v=v' then Syntax.const "_leAll" $ Syntax.mark_bound v' $ n $ P else raise Match);
+
+  fun ex_tr' [Const ("_bound",_) $ Free (v,_), 
+               Const("op &",_) $ (Const ("op <",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = 
+  (if v=v' then Syntax.const "_lessEx" $ Syntax.mark_bound v' $ n $ P else raise Match)
+
+  | ex_tr' [Const ("_bound",_) $ Free (v,_), 
+               Const("op &",_) $ (Const ("op <=",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = 
+  (if v=v' then Syntax.const "_leEx" $ Syntax.mark_bound v' $ n $ P else raise Match)
+in
+[("ALL ", all_tr'), ("EX ", ex_tr')]
 end
+*}
+
+end