🤖 AI Summary
This work investigates a circular partitioning problem inspired by the Josephus problem, incorporating block-pattern constraints from context-free grammars to determine the existence of valid sentences. By reducing the sentence existence problem under grammatical constraints to a regular language membership problem, the authors propose a novel modeling approach based on generalized run-length encoding and Stirling numbers, establishing—for the first time—a formal connection between circular partitioning and grammaticality under block-pattern constraints. The proposed algorithm leverages deterministic finite automata and standard parsing techniques to achieve polynomial-time decidability. Both theoretical analysis and empirical evaluation, including experiments on historical and synthetic datasets, demonstrate the method’s correctness and computational efficiency.
📝 Abstract
Motivated by a historical combinatorial problem that resembles the well-known Josephus problem, we investigate circular partition algorithms and formulate problems in deterministic finite automata with practical algorithms. The historical problem involves arranging individuals on a circle and eliminating every k-th person until a desired group remains. We analyze both removal and non-removal approaches to circular partitioning, establishing conditions for balanced partitions and providing explicit algorithms. We introduce generalized run-length encodings over partitioned alphabets to capture alternating letter patterns, computing their cardinalities using Stirling numbers of the second kind. Connecting these combinatorial structures to formal language theory, we formulate an existence problem: given a context-free grammar over a dictionary and block-pattern constraints on letters, does a valid sentence exist? We prove decidability in polynomial time by showing block languages are regular and applying standard parsing techniques. Complete algorithms with complexity analysis are provided and validated through implementation on both historical and synthetic instances.