src/FOL/ex/LocaleTest.thy
changeset 33460 6c273b0e0e26
parent 32802 b52aa3bc7362
child 33461 afaa9538e82c
equal deleted inserted replaced
32984:2ef1adff7eee 33460:6c273b0e0e26
   120 term extra_type.test thm extra_type.test_def
   120 term extra_type.test thm extra_type.test_def
   121 
   121 
   122 interpretation var?: extra_type "0" "%x y. x = 0" .
   122 interpretation var?: extra_type "0" "%x y. x = 0" .
   123 
   123 
   124 thm var.test_def
   124 thm var.test_def
       
   125 
       
   126 
       
   127 text {* Under which circumstances term syntax remains active. *}
       
   128 
       
   129 locale "syntax" =
       
   130   fixes p1 :: "'a => 'b"
       
   131     and p2 :: "'b => o"
       
   132 begin
       
   133 
       
   134 definition d1 :: "'a => o" where "d1(x) <-> ~ p2(p1(x))"
       
   135 definition d2 :: "'b => o" where "d2(x) <-> ~ p2(x)"
       
   136 
       
   137 thm d1_def d2_def
       
   138 
       
   139 end
       
   140 
       
   141 thm syntax.d1_def syntax.d2_def
       
   142 
       
   143 locale syntax' = "syntax" p1 p2 for p1 :: "'a => 'a" and p2 :: "'a => o"
       
   144 begin
       
   145 
       
   146 thm d1_def d2_def  (* should print as "d1(?x) <-> ..." and "d2(?x) <-> ..." *)
       
   147 
       
   148 ML {*
       
   149 if Display.string_of_thm @{context} @{thm d1_def} <>
       
   150  "\^E\^Fterm\^E\^E\^Fconst\^Fname=local.d1\^Ed1\^E\^F\^E(\^E\^Fvar\^E?x\^E\^F\^E) <-> ~ \^E\^Ffixed\^Fname=p2\^E\^E\^Ffree\^Ep2\^E\^F\^E\^E\^F\^E(\^E\^Ffixed\^Fname=p1\^E\^E\^Ffree\^Ep1\^E\^F\^E\^E\^F\^E(\^E\^Fvar\^E?x\^E\^F\^E))\^E\^F\^E" 
       
   151 then error "Theorem syntax 'd1(?x) <-> ~ p2(p1(?x))' expected." else ();
       
   152 if Display.string_of_thm @{context} @{thm d2_def} <>
       
   153  "\^E\^Fterm\^E\^E\^Fconst\^Fname=local.d2\^Ed2\^E\^F\^E(\^E\^Fvar\^E?x\^E\^F\^E) <-> ~ \^E\^Ffixed\^Fname=p2\^E\^E\^Ffree\^Ep2\^E\^F\^E\^E\^F\^E(\^E\^Fvar\^E?x\^E\^F\^E)\^E\^F\^E"
       
   154 then error "Theorem syntax 'd2(?x) <-> ~ p2(?x)' expected." else ();
       
   155 *}
       
   156 
       
   157 end
       
   158 
       
   159 locale syntax'' = "syntax" p3 p2 for p3 :: "'a => 'b" and p2 :: "'b => o"
       
   160 begin
       
   161 
       
   162 thm d1_def d2_def
       
   163   (* should print as "syntax.d1(p3, p2, ?x) <-> ..." and "d2(?x) <-> ..." *)
       
   164 
       
   165 ML {*
       
   166 if Display.string_of_thm @{context} @{thm d1_def} <>
       
   167  "\^E\^Fterm\^E\^E\^Fconst\^Fname=LocaleTest.syntax.d1\^Esyntax.d1\^E\^F\^E(\^E\^Ffixed\^Fname=p3\^E\^E\^Ffree\^Ep3\^E\^F\^E\^E\^F\^E, \^E\^Ffixed\^Fname=p2\^E\^E\^Ffree\^Ep2\^E\^F\^E\^E\^F\^E, \^E\^Fvar\^E?x\^E\^F\^E) <-> ~ \^E\^Ffixed\^Fname=p2\^E\^E\^Ffree\^Ep2\^E\^F\^E\^E\^F\^E(\^E\^Ffixed\^Fname=p3\^E\^E\^Ffree\^Ep3\^E\^F\^E\^E\^F\^E(\^E\^Fvar\^E?x\^E\^F\^E))\^E\^F\^E"
       
   168 then error "Theorem syntax 'syntax.d1(p3, p2, ?x) <-> ~ p2(p3(?x))' expected."
       
   169 else ();
       
   170 if Display.string_of_thm @{context} @{thm d2_def} <>
       
   171  "\^E\^Fterm\^E\^E\^Fconst\^Fname=local.d2\^Ed2\^E\^F\^E(\^E\^Fvar\^E?x\^E\^F\^E) <-> ~ \^E\^Ffixed\^Fname=p2\^E\^E\^Ffree\^Ep2\^E\^F\^E\^E\^F\^E(\^E\^Fvar\^E?x\^E\^F\^E)\^E\^F\^E"
       
   172 then error "Theorem syntax 'd2(?x) <-> ~ p2(?x)' expected." else ();
       
   173 *}
       
   174 
       
   175 end
   125 
   176 
   126 
   177 
   127 section {* Foundational versions of theorems *}
   178 section {* Foundational versions of theorems *}
   128 
   179 
   129 thm logic.assoc
   180 thm logic.assoc