src/HOL/arith_data.ML
changeset 15958 b4ea8bf8e2f7
parent 15923 01d5d0c1c078
child 15965 f422f8283491
equal deleted inserted replaced
15957:f2a0a80d8233 15958:b4ea8bf8e2f7
   299 fun decomp2 inj_consts (rel,lhs,rhs) =
   299 fun decomp2 inj_consts (rel,lhs,rhs) =
   300 let
   300 let
   301 (* Turn term into list of summand * multiplicity plus a constant *)
   301 (* Turn term into list of summand * multiplicity plus a constant *)
   302 fun poly(Const("op +",_) $ s $ t, m, pi) = poly(s,m,poly(t,m,pi))
   302 fun poly(Const("op +",_) $ s $ t, m, pi) = poly(s,m,poly(t,m,pi))
   303   | poly(all as Const("op -",T) $ s $ t, m, pi) =
   303   | poly(all as Const("op -",T) $ s $ t, m, pi) =
   304       if nT T then add_atom(all,m,pi)
   304       if nT T then add_atom(all,m,pi) else poly(s,m,poly(t,ratneg m,pi))
   305       else poly(s,m,poly(t,ratneg m,pi))
   305   | poly(all as Const("uminus",T) $ t, m, pi) =
   306   | poly(Const("uminus",_) $ t, m, pi) = poly(t,ratneg m,pi)
   306       if nT T then add_atom(all,m,pi) else poly(t,ratneg m,pi)
   307   | poly(Const("0",_), _, pi) = pi
   307   | poly(Const("0",_), _, pi) = pi
   308   | poly(Const("1",_), m, (p,i)) = (p,ratadd(i,m))
   308   | poly(Const("1",_), m, (p,i)) = (p,ratadd(i,m))
   309   | poly(Const("Suc",_)$t, m, (p,i)) = poly(t, m, (p,ratadd(i,m)))
   309   | poly(Const("Suc",_)$t, m, (p,i)) = poly(t, m, (p,ratadd(i,m)))
   310   | poly(t as Const("op *",_) $ _ $ _, m, pi as (p,i)) =
   310   | poly(t as Const("op *",_) $ _ $ _, m, pi as (p,i)) =
   311       (case demult inj_consts (t,m) of
   311       (case demult inj_consts (t,m) of