src/CCL/Term.thy
changeset 32154 9721e8e4d48c
parent 32153 a0e57fb1b930
child 35113 1a0c129bb2e0
equal deleted inserted replaced
32153:a0e57fb1b930 32154:9721e8e4d48c
   271   napplyBzero napplyBsucc
   271   napplyBzero napplyBsucc
   272 
   272 
   273 
   273 
   274 subsection {* Constructors are injective *}
   274 subsection {* Constructors are injective *}
   275 
   275 
   276 ML {*
   276 lemma term_injs:
   277 bind_thms ("term_injs", map (mk_inj_rl @{theory}
   277   "(inl(a) = inl(a')) <-> (a=a')"
   278   [@{thm applyB}, @{thm splitB}, @{thm whenBinl}, @{thm whenBinr},
   278   "(inr(a) = inr(a')) <-> (a=a')"
   279     @{thm ncaseBsucc}, @{thm lcaseBcons}])
   279   "(succ(a) = succ(a')) <-> (a=a')"
   280     ["(inl(a) = inl(a')) <-> (a=a')",
   280   "(a$b = a'$b') <-> (a=a' & b=b')"
   281      "(inr(a) = inr(a')) <-> (a=a')",
   281   by (inj_rl applyB splitB whenBinl whenBinr ncaseBsucc lcaseBcons)
   282      "(succ(a) = succ(a')) <-> (a=a')",
       
   283      "(a$b = a'$b') <-> (a=a' & b=b')"])
       
   284 *}
       
   285 
   282 
   286 
   283 
   287 subsection {* Constructors are distinct *}
   284 subsection {* Constructors are distinct *}
   288 
   285 
   289 ML {*
   286 ML {*
   293 *}
   290 *}
   294 
   291 
   295 
   292 
   296 subsection {* Rules for pre-order @{text "[="} *}
   293 subsection {* Rules for pre-order @{text "[="} *}
   297 
   294 
   298 ML {*
   295 lemma term_porews:
   299 
   296   "inl(a) [= inl(a') <-> a [= a'"
   300 local
   297   "inr(b) [= inr(b') <-> b [= b'"
   301   fun mk_thm s =
   298   "succ(n) [= succ(n') <-> n [= n'"
   302     Goal.prove_global @{theory} [] [] (Syntax.read_prop_global @{theory} s)
   299   "x$xs [= x'$xs' <-> x [= x'  & xs [= xs'"
   303       (fn _ =>
   300   by (simp_all add: data_defs ccl_porews)
   304         rewrite_goals_tac @{thms data_defs} THEN
   301 
   305         simp_tac (@{simpset} addsimps @{thms ccl_porews}) 1);
       
   306 in
       
   307   val term_porews =
       
   308     map mk_thm ["inl(a) [= inl(a') <-> a [= a'",
       
   309       "inr(b) [= inr(b') <-> b [= b'",
       
   310       "succ(n) [= succ(n') <-> n [= n'",
       
   311       "x$xs [= x'$xs' <-> x [= x'  & xs [= xs'"]
       
   312 end;
       
   313 
       
   314 bind_thms ("term_porews", term_porews);
       
   315 *}
       
   316 
   302 
   317 subsection {* Rewriting and Proving *}
   303 subsection {* Rewriting and Proving *}
   318 
   304 
   319 ML {*
   305 ML {*
   320   bind_thms ("term_injDs", XH_to_Ds @{thms term_injs});
   306   bind_thms ("term_injDs", XH_to_Ds @{thms term_injs});