src/HOL/Library/Char_ord.thy
changeset 67399 eab6ce8368fa
parent 63462 c1fe30f2bc32
child 68028 1f9f973eed2a
equal deleted inserted replaced
67398:5eb932e604a2 67399:eab6ce8368fa
    49 
    49 
    50 context includes literal.lifting
    50 context includes literal.lifting
    51 begin
    51 begin
    52 
    52 
    53 lift_definition less_literal :: "String.literal \<Rightarrow> String.literal \<Rightarrow> bool"
    53 lift_definition less_literal :: "String.literal \<Rightarrow> String.literal \<Rightarrow> bool"
    54   is "ord.lexordp op <" .
    54   is "ord.lexordp (<)" .
    55 
    55 
    56 lift_definition less_eq_literal :: "String.literal \<Rightarrow> String.literal \<Rightarrow> bool"
    56 lift_definition less_eq_literal :: "String.literal \<Rightarrow> String.literal \<Rightarrow> bool"
    57   is "ord.lexordp_eq op <" .
    57   is "ord.lexordp_eq (<)" .
    58 
    58 
    59 instance
    59 instance
    60 proof -
    60 proof -
    61   interpret linorder "ord.lexordp_eq op <" "ord.lexordp op < :: string \<Rightarrow> string \<Rightarrow> bool"
    61   interpret linorder "ord.lexordp_eq (<)" "ord.lexordp (<) :: string \<Rightarrow> string \<Rightarrow> bool"
    62     by (rule linorder.lexordp_linorder[where less_eq="op \<le>"]) unfold_locales
    62     by (rule linorder.lexordp_linorder[where less_eq="(\<le>)"]) unfold_locales
    63   show "PROP ?thesis"
    63   show "PROP ?thesis"
    64     by intro_classes (transfer, simp add: less_le_not_le linear)+
    64     by intro_classes (transfer, simp add: less_le_not_le linear)+
    65 qed
    65 qed
    66 
    66 
    67 end
    67 end
    68 
    68 
    69 end
    69 end
    70 
    70 
    71 lemma less_literal_code [code]:
    71 lemma less_literal_code [code]:
    72   "op < = (\<lambda>xs ys. ord.lexordp op < (String.explode xs) (String.explode ys))"
    72   "(<) = (\<lambda>xs ys. ord.lexordp (<) (String.explode xs) (String.explode ys))"
    73   by (simp add: less_literal.rep_eq fun_eq_iff)
    73   by (simp add: less_literal.rep_eq fun_eq_iff)
    74 
    74 
    75 lemma less_eq_literal_code [code]:
    75 lemma less_eq_literal_code [code]:
    76   "op \<le> = (\<lambda>xs ys. ord.lexordp_eq op < (String.explode xs) (String.explode ys))"
    76   "(\<le>) = (\<lambda>xs ys. ord.lexordp_eq (<) (String.explode xs) (String.explode ys))"
    77   by (simp add: less_eq_literal.rep_eq fun_eq_iff)
    77   by (simp add: less_eq_literal.rep_eq fun_eq_iff)
    78 
    78 
    79 lifting_update literal.lifting
    79 lifting_update literal.lifting
    80 lifting_forget literal.lifting
    80 lifting_forget literal.lifting
    81 
    81