src/HOL/ex/LocaleTest2.thy
changeset 61933 cf58b5b794b2
parent 61566 c3d6e570ccef
child 62348 9a5f43dac883
equal deleted inserted replaced
61932:2e48182cc82c 61933:cf58b5b794b2
   464     moreover note total
   464     moreover note total
   465     ultimately show ?thesis by blast
   465     ultimately show ?thesis by blast
   466   qed
   466   qed
   467 qed
   467 qed
   468 
   468 
   469 subsubsection \<open>Total order @{text "<="} on @{typ int}\<close>
   469 subsubsection \<open>Total order \<open><=\<close> on @{typ int}\<close>
   470 
   470 
   471 interpretation int: dpo "op <= :: [int, int] => bool"
   471 interpretation int: dpo "op <= :: [int, int] => bool"
   472   rewrites "(dpo.less (op <=) (x::int) y) = (x < y)"
   472   rewrites "(dpo.less (op <=) (x::int) y) = (x < y)"
   473   txt \<open>We give interpretation for less, but not @{text is_inf} and @{text is_sub}.\<close>
   473   txt \<open>We give interpretation for less, but not \<open>is_inf\<close> and \<open>is_sub\<close>.\<close>
   474 proof -
   474 proof -
   475   show "dpo (op <= :: [int, int] => bool)"
   475   show "dpo (op <= :: [int, int] => bool)"
   476     proof qed auto
   476     proof qed auto
   477   then interpret int: dpo "op <= :: [int, int] => bool" .
   477   then interpret int: dpo "op <= :: [int, int] => bool" .
   478     txt \<open>Gives interpreted version of @{text less_def} (without condition).\<close>
   478     txt \<open>Gives interpreted version of \<open>less_def\<close> (without condition).\<close>
   479   show "(dpo.less (op <=) (x::int) y) = (x < y)"
   479   show "(dpo.less (op <=) (x::int) y) = (x < y)"
   480     by (unfold int.less_def) auto
   480     by (unfold int.less_def) auto
   481 qed
   481 qed
   482 
   482 
   483 thm int.circular
   483 thm int.circular
   520 thm int.meet_left text \<open>from dlat\<close>
   520 thm int.meet_left text \<open>from dlat\<close>
   521 thm int.meet_distr text \<open>from ddlat\<close>
   521 thm int.meet_distr text \<open>from ddlat\<close>
   522 thm int.less_total text \<open>from dlo\<close>
   522 thm int.less_total text \<open>from dlo\<close>
   523 
   523 
   524 
   524 
   525 subsubsection \<open>Total order @{text "<="} on @{typ nat}\<close>
   525 subsubsection \<open>Total order \<open><=\<close> on @{typ nat}\<close>
   526 
   526 
   527 interpretation nat: dpo "op <= :: [nat, nat] => bool"
   527 interpretation nat: dpo "op <= :: [nat, nat] => bool"
   528   rewrites "dpo.less (op <=) (x::nat) y = (x < y)"
   528   rewrites "dpo.less (op <=) (x::nat) y = (x < y)"
   529   txt \<open>We give interpretation for less, but not @{text is_inf} and @{text is_sub}.\<close>
   529   txt \<open>We give interpretation for less, but not \<open>is_inf\<close> and \<open>is_sub\<close>.\<close>
   530 proof -
   530 proof -
   531   show "dpo (op <= :: [nat, nat] => bool)"
   531   show "dpo (op <= :: [nat, nat] => bool)"
   532     proof qed auto
   532     proof qed auto
   533   then interpret nat: dpo "op <= :: [nat, nat] => bool" .
   533   then interpret nat: dpo "op <= :: [nat, nat] => bool" .
   534     txt \<open>Gives interpreted version of @{text less_def} (without condition).\<close>
   534     txt \<open>Gives interpreted version of \<open>less_def\<close> (without condition).\<close>
   535   show "dpo.less (op <=) (x::nat) y = (x < y)"
   535   show "dpo.less (op <=) (x::nat) y = (x < y)"
   536     apply (unfold nat.less_def)
   536     apply (unfold nat.less_def)
   537     apply auto
   537     apply auto
   538     done
   538     done
   539 qed
   539 qed
   571 thm nat.meet_left text \<open>from dlat\<close>
   571 thm nat.meet_left text \<open>from dlat\<close>
   572 thm nat.meet_distr text \<open>from ddlat\<close>
   572 thm nat.meet_distr text \<open>from ddlat\<close>
   573 thm nat.less_total text \<open>from ldo\<close>
   573 thm nat.less_total text \<open>from ldo\<close>
   574 
   574 
   575 
   575 
   576 subsubsection \<open>Lattice @{text "dvd"} on @{typ nat}\<close>
   576 subsubsection \<open>Lattice \<open>dvd\<close> on @{typ nat}\<close>
   577 
   577 
   578 interpretation nat_dvd: dpo "op dvd :: [nat, nat] => bool"
   578 interpretation nat_dvd: dpo "op dvd :: [nat, nat] => bool"
   579   rewrites "dpo.less (op dvd) (x::nat) y = (x dvd y & x ~= y)"
   579   rewrites "dpo.less (op dvd) (x::nat) y = (x dvd y & x ~= y)"
   580   txt \<open>We give interpretation for less, but not @{text is_inf} and @{text is_sub}.\<close>
   580   txt \<open>We give interpretation for less, but not \<open>is_inf\<close> and \<open>is_sub\<close>.\<close>
   581 proof -
   581 proof -
   582   show "dpo (op dvd :: [nat, nat] => bool)"
   582   show "dpo (op dvd :: [nat, nat] => bool)"
   583     proof qed (auto simp: dvd_def)
   583     proof qed (auto simp: dvd_def)
   584   then interpret nat_dvd: dpo "op dvd :: [nat, nat] => bool" .
   584   then interpret nat_dvd: dpo "op dvd :: [nat, nat] => bool" .
   585     txt \<open>Gives interpreted version of @{text less_def} (without condition).\<close>
   585     txt \<open>Gives interpreted version of \<open>less_def\<close> (without condition).\<close>
   586   show "dpo.less (op dvd) (x::nat) y = (x dvd y & x ~= y)"
   586   show "dpo.less (op dvd) (x::nat) y = (x dvd y & x ~= y)"
   587     apply (unfold nat_dvd.less_def)
   587     apply (unfold nat_dvd.less_def)
   588     apply auto
   588     apply auto
   589     done
   589     done
   590 qed
   590 qed
   624 thm nat_dvd.meet_left text \<open>from dlat\<close>
   624 thm nat_dvd.meet_left text \<open>from dlat\<close>
   625 lemma "gcd x y dvd (x::nat)"
   625 lemma "gcd x y dvd (x::nat)"
   626   apply (rule nat_dvd.meet_left) done
   626   apply (rule nat_dvd.meet_left) done
   627 
   627 
   628 
   628 
   629 subsection \<open>Group example with defined operations @{text inv} and @{text unit}\<close>
   629 subsection \<open>Group example with defined operations \<open>inv\<close> and \<open>unit\<close>\<close>
   630 
   630 
   631 subsubsection \<open>Locale declarations and lemmas\<close>
   631 subsubsection \<open>Locale declarations and lemmas\<close>
   632 
   632 
   633 locale Dsemi =
   633 locale Dsemi =
   634   fixes prod (infixl "**" 65)
   634   fixes prod (infixl "**" 65)