<commit_before>(*  Title:      HOL/Library/Pretty_Int.thy
    ID:         $Id$
    Author:     <NAME>, <NAME>
*)

header {* Pretty integer literals for code generation *}

theory Pretty_Int
imports IntArith
begin

text {*
  HOL numeral expressions are mapped to integer literals
  in target languages, using predefined target language
  operations for abstract integer operations.
*}

code_type int
  (SML "IntInf.int")
  (OCaml "Big'_int.big'_int")
  (Haskell "Integer")

setup {*
  fold (fn target => CodegenSerializer.add_pretty_numeral target
    (@{const_name number_of}, @{typ "int \<Rightarrow> int"})
    @{const_name Numeral.B0} @{const_name Numeral.B1}
    @{const_name Numeral.Pls} @{const_name Numeral.Min}
    @{const_name Numeral.Bit}
  ) ["SML", "OCaml", "Haskell"]
*}

code_const "Numeral.Pls" and "Numeral.Min" and "Numeral.Bit"
  (SML "raise/ Fail/ \"Pls\""
     and "raise/ Fail/ \"Min\""
     and "!((_);/ (_);/ raise/ Fail/ \"Bit\")")
  (OCaml "failwith/ \"Pls\""
     and "failwith/ \"Min\""<commit_msg>fixed omission<commit_after>(*  Title:      HOL/Library/Pretty_Int.thy
    ID:         $Id$
    Author:     <NAME>, <NAME>
*)

header {* Pretty integer literals for code generation *}

theory Pretty_Int
imports IntArith
begin

text {*
  HOL numeral expressions are mapped to integer literals
  in target languages, using predefined target language
  operations for abstract integer operations.
*}

code_type int
  (SML "IntInf.int")
  (OCaml "Big'_int.big'_int")
  (Haskell "Integer")

code_instance int :: eq
  (Haskell -)

setup {*
  fold (fn target => CodegenSerializer.add_pretty_numeral target
    (@{const_name number_of}, @{typ "int \<Rightarrow> int"})
    @{const_name Numeral.B0} @{const_name Numeral.B1}
    @{const_name Numeral.Pls} @{const_name Numeral.Min}
    @{const_name Numeral.Bit}
  ) ["SML", "OCaml", "Haskell"]
*}

code_const "Numeral.Pls" and "Numeral.Min" and "Numeral.Bit"
  (SML "raise/ Fail/ \"Pls\""
     and "raise/ Fail/ \"Min\""
     and "!((_);/ (_);/ raise/ Fail/ \"Bit\")")
  (OCaml "failwith/ \"Pls\""
     and "failwith/ \"Min\""
{'fraction_non_alphanumeric': 0.15550239234449761, 'fraction_numerical': 0.0019138755980861245, 'mean_word_length': 3.4871244635193133, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4914345', 'n_tokens_mistral': 793, 'n_tokens_neox': 750, 'n_words': 200}