equal
deleted
inserted
replaced
197 | t => Rat.rat_of_int (snd (HOLogic.dest_number t))) |
197 | t => Rat.rat_of_int (snd (HOLogic.dest_number t))) |
198 handle TERM _ => error "ring_dest_const") |
198 handle TERM _ => error "ring_dest_const") |
199 fun mk_const phi cT x = |
199 fun mk_const phi cT x = |
200 let val (a, b) = Rat.quotient_of_rat x |
200 let val (a, b) = Rat.quotient_of_rat x |
201 in if b = 1 then Numeral.mk_cnumber cT a |
201 in if b = 1 then Numeral.mk_cnumber cT a |
202 else Thm.capply |
202 else Thm.apply |
203 (Thm.capply (Drule.cterm_rule (instantiate' [SOME cT] []) @{cpat "op /"}) |
203 (Thm.apply (Drule.cterm_rule (instantiate' [SOME cT] []) @{cpat "op /"}) |
204 (Numeral.mk_cnumber cT a)) |
204 (Numeral.mk_cnumber cT a)) |
205 (Numeral.mk_cnumber cT b) |
205 (Numeral.mk_cnumber cT b) |
206 end |
206 end |
207 in funs key |
207 in funs key |
208 {is_const = K numeral_is_const, |
208 {is_const = K numeral_is_const, |
723 end; |
723 end; |
724 |
724 |
725 (* Power of polynomial (optimized for the monomial and trivial cases). *) |
725 (* Power of polynomial (optimized for the monomial and trivial cases). *) |
726 |
726 |
727 fun num_conv n = |
727 fun num_conv n = |
728 nat_add_conv (Thm.capply @{cterm Suc} (Numeral.mk_cnumber @{ctyp nat} (dest_numeral n - 1))) |
728 nat_add_conv (Thm.apply @{cterm Suc} (Numeral.mk_cnumber @{ctyp nat} (dest_numeral n - 1))) |
729 |> Thm.symmetric; |
729 |> Thm.symmetric; |
730 |
730 |
731 |
731 |
732 val polynomial_pow_conv = |
732 val polynomial_pow_conv = |
733 let |
733 let |