-- | Runs a model translation such that any new assertions that are added do not
--   end up in the global assertion list, but instead becomes part of the result.
isolateAssertions :: ModelTranslation a -> ModelTranslation (a, [L2.L2Expression])
isolateAssertions f = do
  origAssertions <- L2.l2AllAssertions <$> getL2Model
  modifyL2Model $ \mod -> mod { L2.l2AllAssertions = [] }
  r <- f
  newAssertions <- L2.l2AllAssertions <$> getL2Model
  modifyL2Model $ \mod -> mod { L2.l2AllAssertions = origAssertions }
  return (r, newAssertions)
isolateAssertions :: ModelTranslation a -> ModelTranslation (a, [L2.L2Expression])
isolateAssertions f = do
  origAssertions <- L2.l2AllAssertions <$> getL2Model
  modifyL2Model $ \mod -> mod { L2.l2AllAssertions = [] }
  r <- f
  newAssertions <- L2.l2AllAssertions <$> getL2Model
  modifyL2Model $ \mod -> mod { L2.l2AllAssertions = origAssertions }
  return (r, newAssertions)
isolateAssertions f = do
  origAssertions <- L2.l2AllAssertions <$> getL2Model
  modifyL2Model $ \mod -> mod { L2.l2AllAssertions = [] }
  r <- f
  newAssertions <- L2.l2AllAssertions <$> getL2Model
  modifyL2Model $ \mod -> mod { L2.l2AllAssertions = origAssertions }
  return (r, newAssertions)