Zulip Chat Archive

Stream: mathlib4

Topic: simp for ModelProd


Mario Carneiro (Jun 05 2023 at 21:35):

For Yuri's Q about ModelProd, perhaps no_index might help?

Jireh Loreaux (Jun 05 2023 at 21:37):

What is no_index?

Eric Wieser (Jun 05 2023 at 21:53):

It's an instruction to tell the discrimination tree used for lookup to not "index" the lookup on the term that noindex refers to

Yury G. Kudryashov (Jun 06 2023 at 00:59):

How do I use it? Can't find it in Mathlib 4

Mario Carneiro (Jun 06 2023 at 01:35):

def foo (x : A) : Nat := 0

@[simp] theorem foo_eq (x : A × B) : foo x = 0 := rfl

def ModelProd (A B : Type) := A × B

example : foo (x : ModelProd A B) = 0 := by simp -- fails

@[simp] theorem foo_eq' (x : no_index (A × B)) : foo x = 0 := rfl

example : foo (x : ModelProd A B) = 0 := by simp -- ok

Yury G. Kudryashov (Jun 23 2023 at 03:19):

The problem with this solution is that we have to go over all lemmas that we may want to apply with a type synonym.

Yury G. Kudryashov (Jun 23 2023 at 03:20):

E.g., vector bundles define a type synonym for docs#ContinuousLinearMap and lemmas like docs#ContinuousLinearMap.add_apply don't work on Bundle.ContinuousLinearMaps.

Yury G. Kudryashov (Jun 23 2023 at 03:22):

There are many basic lemmas that we may want to use for Bundle.ContinuousLinearMap, some of them are generated by @[simps] and adding no_index to all of them doesn't look like a good solution.


Last updated: Dec 20 2023 at 11:08 UTC