- An new simp attribute may depend on other existing attributes - Add `[norm]` simp attribute. It is an extension of the default `[simp]` attribute. It should be used to add extra rules for normalizing goals. These extra rules are used to produce normal forms and/or reduce the number of constants used in a goal. Here is an example coming from a discussion with @kha. When working with monads, we may want to eliminate `<$>` by using the lemma `f <$> x = x >>= pure ∘ f`. This lemma is in the `[norm]` simp set, but it is not in `[simp]`
11 lines
381 B
Text
11 lines
381 B
Text
universes u v
|
||
|
||
axiom map_bind_lemma : ∀ {α β : Type u} {m : Type u → Type v} [monad m] (f : α → β) (x : m α), f <$> x = x >>= pure ∘ f
|
||
attribute [norm] function.comp map_bind_lemma
|
||
|
||
example : nat.succ <$> [1, 2] = [2, 3] :=
|
||
begin
|
||
simp with norm,
|
||
guard_target [1, 2] >>= (λ x, pure (nat.succ x)) = [2, 3],
|
||
simp [has_bind.bind, pure, has_pure.pure, list.ret]
|
||
end
|