170 in K (inst' [d,s] mindvd, FWD (inst' [d,s] bsetndvd) [dd], FWD (inst' [d,s] infDndvd) [dd]) end) |
170 in K (inst' [d,s] mindvd, FWD (inst' [d,s] bsetndvd) [dd], FWD (inst' [d,s] infDndvd) [dd]) end) |
171 | _ => ([], K (inst' [cp] miP, inst' [cp] bsetP, inst' [cp] infDP)) |
171 | _ => ([], K (inst' [cp] miP, inst' [cp] bsetP, inst' [cp] infDP)) |
172 |
172 |
173 (* Canonical linear form for terms, formulae etc.. *) |
173 (* Canonical linear form for terms, formulae etc.. *) |
174 fun provelin ctxt t = Goal.prove ctxt [] [] t |
174 fun provelin ctxt t = Goal.prove ctxt [] [] t |
175 (fn _ => EVERY [simp_tac lin_ss 1, TRY (simple_arith_tac ctxt 1)]); |
175 (fn _ => EVERY [simp_tac lin_ss 1, TRY (linear_arith_tac ctxt 1)]); |
176 fun linear_cmul 0 tm = zero |
176 fun linear_cmul 0 tm = zero |
177 | linear_cmul n tm = case tm of |
177 | linear_cmul n tm = case tm of |
178 Const (@{const_name HOL.plus}, _) $ a $ b => addC $ linear_cmul n a $ linear_cmul n b |
178 Const (@{const_name HOL.plus}, _) $ a $ b => addC $ linear_cmul n a $ linear_cmul n b |
179 | Const (@{const_name HOL.times}, _) $ c $ x => mulC $ numeral1 (fn m => n * m) c $ x |
179 | Const (@{const_name HOL.times}, _) $ c $ x => mulC $ numeral1 (fn m => n * m) c $ x |
180 | Const (@{const_name HOL.minus}, _) $ a $ b => subC $ linear_cmul n a $ linear_cmul n b |
180 | Const (@{const_name HOL.minus}, _) $ a $ b => subC $ linear_cmul n a $ linear_cmul n b |