src/HOL/Library/Predicate_Compile_Alternative_Defs.thy
changeset 45461 130c90bb80b4
parent 45231 d85a2fdc586c
child 45970 b6d0cff57d96
equal deleted inserted replaced
45452:414732ebf891 45461:130c90bb80b4
    98   val ooi = Fun (Output, Fun (Output, Fun (Input, Bool)))
    98   val ooi = Fun (Output, Fun (Output, Fun (Input, Bool)))
    99   val plus_nat = Core_Data.functional_compilation @{const_name plus} iio
    99   val plus_nat = Core_Data.functional_compilation @{const_name plus} iio
   100   val minus_nat = Core_Data.functional_compilation @{const_name "minus"} iio
   100   val minus_nat = Core_Data.functional_compilation @{const_name "minus"} iio
   101   fun subtract_nat compfuns (_ : typ) =
   101   fun subtract_nat compfuns (_ : typ) =
   102     let
   102     let
   103       val T = Predicate_Compile_Aux.mk_predT compfuns @{typ nat}
   103       val T = Predicate_Compile_Aux.mk_monadT compfuns @{typ nat}
   104     in
   104     in
   105       absdummy @{typ nat} (absdummy @{typ nat}
   105       absdummy @{typ nat} (absdummy @{typ nat}
   106         (Const (@{const_name "If"}, @{typ bool} --> T --> T --> T) $
   106         (Const (@{const_name "If"}, @{typ bool} --> T --> T --> T) $
   107           (@{term "op > :: nat => nat => bool"} $ Bound 1 $ Bound 0) $
   107           (@{term "op > :: nat => nat => bool"} $ Bound 1 $ Bound 0) $
   108           Predicate_Compile_Aux.mk_bot compfuns @{typ nat} $
   108           Predicate_Compile_Aux.mk_empty compfuns @{typ nat} $
   109           Predicate_Compile_Aux.mk_single compfuns
   109           Predicate_Compile_Aux.mk_single compfuns
   110           (@{term "op - :: nat => nat => nat"} $ Bound 0 $ Bound 1)))
   110           (@{term "op - :: nat => nat => nat"} $ Bound 0 $ Bound 1)))
   111     end
   111     end
   112   fun enumerate_addups_nat compfuns (_ : typ) =
   112   fun enumerate_addups_nat compfuns (_ : typ) =
   113     absdummy @{typ nat} (Predicate_Compile_Aux.mk_iterate_upto compfuns @{typ "nat * nat"}
   113     absdummy @{typ nat} (Predicate_Compile_Aux.mk_iterate_upto compfuns @{typ "nat * nat"}
   116       (@{term "op - :: nat => nat => nat"} $ Bound 1 $ (@{term "Code_Numeral.nat_of"} $ Bound 0))),
   116       (@{term "op - :: nat => nat => nat"} $ Bound 1 $ (@{term "Code_Numeral.nat_of"} $ Bound 0))),
   117       @{term "0 :: code_numeral"}, @{term "Code_Numeral.of_nat"} $ Bound 0))
   117       @{term "0 :: code_numeral"}, @{term "Code_Numeral.of_nat"} $ Bound 0))
   118   fun enumerate_nats compfuns  (_ : typ) =
   118   fun enumerate_nats compfuns  (_ : typ) =
   119     let
   119     let
   120       val (single_const, _) = strip_comb (Predicate_Compile_Aux.mk_single compfuns @{term "0 :: nat"})
   120       val (single_const, _) = strip_comb (Predicate_Compile_Aux.mk_single compfuns @{term "0 :: nat"})
   121       val T = Predicate_Compile_Aux.mk_predT compfuns @{typ nat}
   121       val T = Predicate_Compile_Aux.mk_monadT compfuns @{typ nat}
   122     in
   122     in
   123       absdummy @{typ nat} (absdummy @{typ nat}
   123       absdummy @{typ nat} (absdummy @{typ nat}
   124         (Const (@{const_name If}, @{typ bool} --> T --> T --> T) $
   124         (Const (@{const_name If}, @{typ bool} --> T --> T --> T) $
   125           (@{term "op = :: nat => nat => bool"} $ Bound 0 $ @{term "0::nat"}) $
   125           (@{term "op = :: nat => nat => bool"} $ Bound 0 $ @{term "0::nat"}) $
   126           (Predicate_Compile_Aux.mk_iterate_upto compfuns @{typ nat} (@{term "Code_Numeral.nat_of"},
   126           (Predicate_Compile_Aux.mk_iterate_upto compfuns @{typ nat} (@{term "Code_Numeral.nat_of"},