Zulip Chat Archive

Stream: general

Topic: Help wanted (make `ContextFreeRule.Rewrites` decidable)


Martin Dvořák (Oct 13 2023 at 19:39):

I'd like to delegate this task to somebody who (unlike me) knows what they are doing...

instance (r : ContextFreeRule T N) [DecidableEq T] [DecidableEq N] : DecidableRel r.Rewrites :=
  sorry

It should go into this place:
https://github.com/leanprover-community/mathlib4/blob/11add7feea9488bd2250bf2122566d4d92e675a2/Mathlib/Computability/ContextFreeGrammar.lean#L51

Eric Wieser (Oct 13 2023 at 23:08):

You need to write an algorithm to decide whether a string matches

Eric Wieser (Oct 13 2023 at 23:08):

I had a go at this last week, and it was harder than expected

Eric Wieser (Oct 13 2023 at 23:11):

The easy way out here is to prove that r.Rewrites x y (docs#ContextFreeRule.Rewrites) is the same as "there exists index of a symbol that was replaced", because lean will then generate an algorithm for you that iterates over all indices (though I think this will be O(x.length^2) due to the involvement of list indexing)


Last updated: Dec 20 2023 at 11:08 UTC