src/Doc/Implementation/Prelim.thy
changeset 59902 6afbe5a99139
parent 59859 f9d1442c70f3
child 60948 b710a5087116
equal deleted inserted replaced
59901:840d03805755 59902:6afbe5a99139
   499   show_types} controls output of explicit type constraints for
   499   show_types} controls output of explicit type constraints for
   500   variables in printed terms (cf.\ \secref{sec:read-print}).  Its
   500   variables in printed terms (cf.\ \secref{sec:read-print}).  Its
   501   value can be modified within Isar text like this:
   501   value can be modified within Isar text like this:
   502 \<close>
   502 \<close>
   503 
   503 
       
   504 experiment
       
   505 begin
       
   506 
   504 declare [[show_types = false]]
   507 declare [[show_types = false]]
   505   -- \<open>declaration within (local) theory context\<close>
   508   -- \<open>declaration within (local) theory context\<close>
   506 
   509 
   507 notepad
   510 notepad
   508 begin
   511 begin
   512 
   515 
   513   have "x = x"
   516   have "x = x"
   514     using [[show_types = false]]
   517     using [[show_types = false]]
   515       -- \<open>declaration within proof (backward mode)\<close>
   518       -- \<open>declaration within proof (backward mode)\<close>
   516     ..
   519     ..
       
   520 end
       
   521 
   517 end
   522 end
   518 
   523 
   519 text \<open>Configuration options that are not set explicitly hold a
   524 text \<open>Configuration options that are not set explicitly hold a
   520   default value that can depend on the application context.  This
   525   default value that can depend on the application context.  This
   521   allows to retrieve the value from another slot within the context,
   526   allows to retrieve the value from another slot within the context,
   718 \<close>
   723 \<close>
   719 
   724 
   720 text %mlex \<open>The following simple examples demonstrate how to produce
   725 text %mlex \<open>The following simple examples demonstrate how to produce
   721   fresh names from the initial @{ML Name.context}.\<close>
   726   fresh names from the initial @{ML Name.context}.\<close>
   722 
   727 
   723 ML \<open>
   728 ML_val \<open>
   724   val list1 = Name.invent Name.context "a" 5;
   729   val list1 = Name.invent Name.context "a" 5;
   725   @{assert} (list1 = ["a", "b", "c", "d", "e"]);
   730   @{assert} (list1 = ["a", "b", "c", "d", "e"]);
   726 
   731 
   727   val list2 =
   732   val list2 =
   728     #1 (fold_map Name.variant ["x", "x", "a", "a", "'a", "'a"] Name.context);
   733     #1 (fold_map Name.variant ["x", "x", "a", "a", "'a", "'a"] Name.context);
   730 \<close>
   735 \<close>
   731 
   736 
   732 text \<open>\medskip The same works relatively to the formal context as
   737 text \<open>\medskip The same works relatively to the formal context as
   733   follows.\<close>
   738   follows.\<close>
   734 
   739 
   735 locale ex = fixes a b c :: 'a
   740 experiment fixes a b c :: 'a
   736 begin
   741 begin
   737 
   742 
   738 ML \<open>
   743 ML_val \<open>
   739   val names = Variable.names_of @{context};
   744   val names = Variable.names_of @{context};
   740 
   745 
   741   val list1 = Name.invent names "a" 5;
   746   val list1 = Name.invent names "a" 5;
   742   @{assert} (list1 = ["d", "e", "f", "g", "h"]);
   747   @{assert} (list1 = ["d", "e", "f", "g", "h"]);
   743 
   748 
  1041 
  1046 
  1042 text %mlex \<open>The following example yields the source position of some
  1047 text %mlex \<open>The following example yields the source position of some
  1043   concrete binding inlined into the text:
  1048   concrete binding inlined into the text:
  1044 \<close>
  1049 \<close>
  1045 
  1050 
  1046 ML \<open>Binding.pos_of @{binding here}\<close>
  1051 ML_val \<open>Binding.pos_of @{binding here}\<close>
  1047 
  1052 
  1048 text \<open>\medskip That position can be also printed in a message as
  1053 text \<open>\medskip That position can be also printed in a message as
  1049   follows:\<close>
  1054   follows:\<close>
  1050 
  1055 
  1051 ML_command
  1056 ML_command