Pith. sign in

REVIEW 4 major objections 4 minor 10 references

Heuristic Algorithm for Generalized Function Matching

T0 review · 4 major / 4 minor · reviewed 2026-08-14 · deepseek-v4-flash

Pith's one-line read A repetition-aware heuristic for generalized function matching can beat the previous greedy algorithm on low-repetition text.

desk verdict A genuinely new but incompletely specified heuristic for non-empty generalized function matching; the ideas are worth referee time, but the paper as written does not yet prove its practical claims. read the letter →

arxiv 1908.01562 v1 pith:6TYIHVCP submitted 2019-08-05 cs.DS

classification cs.DS
keywords stringalgorithmspatternmatchingheuristicsgeneralizedfunctionsuffixtreerepetitionstructuresubsequence
verification ladder T0 review T1 audit T2 compute T3 formal

The pith

A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.

The reading

Generalized function matching asks whether a pattern can be mapped onto a substring of a text by sending each pattern symbol to a non-empty text substring. The NP-completeness of this variant means exact algorithms are impractical, so the paper proposes a heuristic that exploits the text's repetitive structure. It builds a suffix tree, extracts a list of repeated substrings with their occurrence positions, and searches for an assignment of the pattern's repeated symbols that appears as a subsequence of that list. The paper reports that this heuristic finishes faster than the previous greedy algorithm on texts with few repeating substrings, which is common for English text, and on structured patterns like sonnet rhyme schemes. If correct, it provides a practical tool for generalized function matching on inputs that defeat the older algorithm.

What carries the argument

The central mechanism is the repetition structure: a tuple (length, occurrence count, list of starting positions) for each repeated substring of the text, produced by traversing a suffix tree and merged into one position-sorted list with repetition indices. The algorithm maps each repeating pattern symbol to a repetition structure whose occurrence count is at least the symbol's multiplicity, then checks whether the substituted pattern appears as a subsequence of the merged occurrence list. The trimming procedure cuts the lengths of overlapping matches to respect the gaps required by non-repetitive symbols, and repetition splitting halves stored substrings in a fixed pattern to progressively recover suffixes that were discarded during list construction; the claim is that this search-and-trim loop finds all valid matches.

What would settle it

Run the heuristic against exhaustive enumeration on all patterns of length up to 5 over a two-letter alphabet against texts of length up to 12; a single valid match that the heuristic misses would disprove the completeness of the repetition-list method, and if such misses occur on texts with very few repeated substrings, the claimed practical advantage also needs reexamination.

Watch

Extended reading notes

Core claim

The paper's central claim is that generalized function matching with non-empty images—where each pattern symbol must map to a non-empty substring of the text—can be tackled efficiently in practice by focusing on repetitions. The algorithm builds a suffix tree for the text, extracts a list of repeated substrings with their occurrence positions, and separates the pattern into a repetitive subsequence (symbols that occur more than once) and the remaining non-repetitive symbols. It then searches for an assignment of each repetitive symbol to one of the stored repetition structures such that the resulting sequence of occurrence positions appears as a subsequence of a merged, position-sorted occurrence list. A trimming step adjusts overlapping matched substrings so that non-repetitive symbols fit in the gaps, and a repetition-splitting step gradually reintroduces discarded suffixes to recover matches the reduced list may miss. The author claims this approach runs faster than the previous greedy algorithm on texts with few repeated substrings, such as natural language, and on structured patterns such as sonnet rhyme schemes.

Load-bearing premise

The load-bearing assumption is that the suffix-tree repetition list, together with the trimming and repetition-splitting steps, can represent every text substring that a valid match could use; if that fails, the heuristic will miss valid matches.

Editorial extensions

If this is right

  • On texts with a low number of repeating substrings, the heuristic can finish instances where the greedy algorithm's exponential dependence on the pattern alphabet makes it impractical.
  • For patterns that split into blocks with disjoint alphabets, such as the sonnet rhyme template ABABCDCDEFEFGG, the divide-and-conquer decomposition matches each block in sequence, shrinking the search space.
  • Because the algorithm outputs the mapping f and the text partition, it can be used directly in applications that need the actual substring images, not just a match/no-match verdict.
  • A hybrid that picks the faster of the two algorithms per instance solved every tested random instance within one second, suggesting complementary strengths.
  • Given the NP-completeness of non-empty generalized function matching, any practical algorithm must resort to heuristics, so a fast heuristic with this behavior fills a real gap.

Reading between the lines

Editorial extensions of the paper, not claims the author makes directly.

  • A direct extension would be to replace the suffix-tree occurrence lists with a more compact index such as a suffix automaton; this could reduce the worst-case quadratic space and make the heuristic practical on much longer texts, a path the paper does not explore.
  • The pattern-decomposition idea points toward a general strategy: split the pattern along an alphabet-disjointness graph and match blocks independently; when that graph is sparse, the exponential search over mappings factorizes into smaller searches.
  • The paper's observation that keeping the best of the two algorithms solves all tested instances under one second suggests a hybrid scheduler keyed to a text-repetition statistic; testing such a rule on a broader benchmark would be a natural next step.
  • Because the experiments cap runtime at one second and use short texts, the heuristic's behavior on longer, lower-repetition inputs remains open; measuring repetition-list size and runtime on 100,000-character texts would stress-test the claimed advantage.
Share X Bluesky LinkedIn Reddit HN

Signed reviews

No signed human review yet.

Editorial analysis

A structured set of objections, weighed in public.

Desk editor's note, referee report, and a circularity audit.

Referee Report

4 major / 4 minor

Summary. The paper proposes a heuristic algorithm for generalized function matching with non-empty substring images (f : Sigma_p -> Sigma_t^+). The algorithm builds a suffix tree of the text to extract repetitive substrings, merges their occurrence lists, and then attempts to match the repetitive part of the pattern as a subsequence of this merged list, followed by a trimming step to enforce non-empty images and adjacency constraints. A pattern-decomposition heuristic is also described. The paper claims the algorithm outperforms the previous greedy algorithm of Amir and Nor on certain inputs, notably on texts with few repeating substrings, and reports wall-clock experiments on random strings and a Shakespearean sonnet example.

Significance. If the heuristic were fully specified, correct, and validated, it would be a practically useful contribution to generalized function matching, a problem for which the unrestricted (and injective) variants are NP-hard. The idea of leveraging suffix-tree repetitions and subsequence matching is plausible and could be a useful starting point for engineering faster algorithms. However, as it stands, the practical significance is not established: the algorithm is incompletely specified, its key completeness observations are unproved, and the experimental section does not demonstrate that the heuristic actually finds valid matches as reliably as the baseline it is compared against.

major comments (4)
  1. [Section 2.3] The algorithm is not fully specified: line 16 invokes a trimming subroutine, but the text explicitly says 'the complete trimming procedure is not included (it is lengthy, contains subcases for the beginning and ending of the text etc.)'. Since trimming is the step that enforces non-empty images and adjacency constraints, omitting it means the reader cannot implement, test, or formally reason about the algorithm. This is load-bearing for the central claim that the heuristic is practically useful.
  2. [Section 2.2] The 'key observation' that, for any valid match, the substituted repetitive pattern appears as a subsequence inside the merged repetition list is stated without proof. The assertion that repeated repetition splitting 'recovers all of the discarded information' is also unproved and not obvious, since the splitting method generates suffixes of existing repetitions and does not generate other substrings that might be needed as image strings. Without a proof or at least a formal argument, the completeness of the heuristic is not established, and a faster algorithm that misses valid matches would not satisfy the problem statement.
  3. [Section 4.2] The running-time experiments report only wall-clock times and do not report the number of valid matches found, whether the found matches were verified, or the recall relative to the baseline Amir-Nor algorithm. A faster run that returns no match or an invalid match would not be 'better' in any practically useful sense. The paper's conclusion that 'there are cases where our algorithm is better' is therefore not supported by the experimental evidence as presented.
  4. [Section 2.4] The time complexity formulas contain unclear notation and apparent typos: 'the number of map : Sigma_rep^p -> L functions is O(n|Sigma_p|)' should presumably be O(n^{|Sigma_p|}) or O(|L|^{|Sigma_p|}), and the final expression 'O(mn2m+|Sigma_p|)' is ambiguous. These errors make it difficult to assess the theoretical claims about when the heuristic beats the baseline.
minor comments (4)
  1. [Section 2.2] The claim that 'in case of same starting positions, the position of the shorter repeated string appears first' is not justified; the reason this ordering is needed for the subsequence matching should be explained.
  2. [Section 4.1] The sonnet experiment is purely qualitative; it is fine as a demonstration but should be explicitly labeled as a toy example and not used as evidence of practical speed or correctness.
  3. [References] The introduction cites Amir and Nor (JDA 2007), but the reference list entry [2] gives a 2004 publication; please harmonize the year and venue.
  4. [Section 3] The pattern-decomposition heuristic is described but never evaluated; either add a small experiment showing its effect or clearly mark it as future work.

Circularity Check

0 steps flagged · score 0.0 of 10

No circularity found; the algorithm's reported behavior is not forced by its inputs, and the identified weaknesses are completeness gaps rather than circular reasoning.

full rationale

The paper does not derive a target result from an input that already contains it. The central algorithmic claim is that a suffix-tree repetition list plus a subsequence search can heuristically solve generalized function matching for non-empty images. The 'key observation' that a repetitive pattern match implies a subsequence inside the merged repetition list is an unproved completeness assumption, not an equivalence by construction: it asserts a sufficient condition for a successful search, and the paper explicitly notes that discarding suffix repetitions 'leads to missing some solutions.' This is a correctness/completeness risk, not circularity. No parameter is fitted to the output: the pattern and text in the toy Shakespeare experiment are externally supplied, and the running-time comparisons in Section 4.2 measure wall-clock time against an independently coded Amir-Nor implementation; the use of the authors' own 'optimized implementation' is a benchmarking concern, not a definitional reduction. The paper also contains no load-bearing self-citation chain: all cited prior work is external (Ukkonen, Amir and Nor, Clifford et al., Ordyniak and Popa), and no uniqueness theorem or ansatz is imported from the authors' prior publications. Because the reported speed advantage is not assured to correspond to a fully specified algorithm (the trimming procedure is omitted and completeness is unproved), the paper has an evident completeness gap, but that gap does not make the derivation circular. Therefore the circularity score is 0.

Assumptions & free parameters 0 free parameters · 5 assumptions · 0 invented entities

The algorithm rests on unproven structural assumptions about the suffix-tree repetition list, the subsequence property of valid matches, and the completeness of trimming and splitting. These are heuristic assumptions, not fitted parameters or invented physical entities. No free numerical parameters are fitted to data.

assumptions (5)
  • standard math Ukkonen's suffix tree construction and traversal produce a complete list of repeated substrings with occurrence counts.
    Section 2.2, Text Processing, builds the repetition list by traversing a suffix tree; this is standard but the heuristic depends on it being correct.
  • domain assumption Every valid non-empty GFM match maps each repeating pattern symbol to a text substring that occurs at least as many times as the symbol occurs in the pattern.
    Identical pattern symbols must map to identical text substrings at distinct pattern positions, so the image substring must appear at least that many times. This is true by definition but not spelled out as a proof.
  • ad hoc to paper For any valid match, there exists a substitution of repeating pattern symbols by repetition structures such that the substituted pattern appears as a subsequence in the merged repetition list.
    Section 2.2, Subsequence Matching, calls this 'the key observation' and states it without proof. It is the completeness assumption of the heuristic.
  • ad hoc to paper The omitted trimming procedure can enforce non-empty mappings and adjacency constraints without discarding valid matches.
    Section 2.3 says 'Correctness is only ensured by employing the previously described trimming procedure', but the complete trimming procedure is not included in the paper.
  • ad hoc to paper Repeatedly splitting repetition structures recovers all information discarded when suffixes with equal occurrence counts were removed.
    Section 2.2, Repetition Splitting, asserts that performing the split multiple times recovers all discarded information, but no proof is given.

how reviews work

0 comments
Cite this review

Pith. "Pith review of Heuristic Algorithm for Generalized Function Matching." pith.science (2026). https://pith.science/paper/6TYIHVCP

@misc{pith2026190801562,
  author       = {Pith},
  title        = {Pith review of: Heuristic Algorithm for Generalized Function Matching},
  year         = {2026},
  howpublished = {\url{https://pith.science/paper/6TYIHVCP}},
  note         = {Machine review of arXiv:1908.01562}
}
abstract

The problem of generalized function matching can be defined as follows: given a pattern $p=p_1 \cdots p_m$ and a text $t=t_1 \cdots t_n$, find a mapping $f:\Sigma_p\rightarrow\Sigma_t^{*}$ and all text locations $i$ such that $f(p_1) f(p_2) \cdots f(p_m) = t_i \cdots t_j$, a substring of $t$. By modifying the restrictions of the matching function $f$, one can obtain different matching problems, many of which have important applications. When $f:\Sigma_p\rightarrow\Sigma_t$ we are faced with problems found in the well-established field of combinatorial pattern matching. If the single character constraint is lifted and $f:\Sigma_p\rightarrow\Sigma_t^{*}$, we obtain generalized function matching as introduced by Amir and Nor (JDA 2007). If we further constrain $f$ to be injective, then we arrive at generalized parametrized matching as defined by Clifford et al. (SPIRE 2009). There are a number of important applications for pattern matching in computational biology, text editors and data compression, to name a few. Therefore, many efficient algorithms have been developed for a wide variety of specific problems including finding tandem repeats in DNA sequences, optimizing embedded systems by reusing code etc. In this work we present a heuristic algorithm illustrating a practical approach to tackling a variant of generalized function matching where $f:\Sigma_p\rightarrow\Sigma_t^{+}$ and demonstrate its performance on human-produced text as well as random strings.

Figures

Figures reproduced from arXiv: 1908.01562 by the authors.

Figure 3
Figure 3. Algorithm running time for uniformly random pattern strings and only one uniformly random text string with the following parameters: [PITH_FULL_IMAGE:figures/full_fig_p008_3.png] view at source ↗

Discussion (0). Continue with ORCID to comment.

Reference graph

Works this paper leans on

10 extracted references · 3 canonical work pages

  1. [1]

    write newline

    " write newline "" before.all 'output.state := FUNCTION n.dashify 't := "" t empty not t #1 #1 substring "-" = t #1 #2 substring "--" = not "--" * t #2 global.max substring 't := t #1 #1 substring "-" = "-" * t #2 global.max substring 't := while if t #1 #1 substring * t #2 global.max substring 't := if while FUNCTION word.in bbl.in ":" * " " * FUNCTION f...

  2. [2]

    , author Aumann, Y

    author Amir, A. , author Aumann, Y. , author Cole, R. , author Lewenstein, M. , author Porat, E. , year 2003 . title Function matching: Algorithms, applications, and a lower bound , pp. pages 929--942 . :10.1007/3-540-45061-0\_72

  3. [3]

    , author Nor, I

    author Amir, A. , author Nor, I. , year 2004 . title Generalized function matching , pp. pages 361--378 . :10.1007/978-3-540-30551-4\_6

  4. [4]

    , author Popa, A

    author Clifford, R. , author Popa, A. , year 2010 . title (in)approximability results for pattern matching problems , pp. pages 52--62

  5. [5]

    , author Wettroth Harrow, A

    author Clifford, R. , author Wettroth Harrow, A. , author Popa, A. , author Sach, B. , year 2009 . title Generalised matching , pp. pages 295--301 . :10.1007/978-3-642-03784-9\_29

  6. [6]

    , author Popa, A

    author Ordyniak, S. , author Popa, A. , year 2014 . title A parameterized study of maximum generalized pattern matching problems , in: booktitle Parameterized and Exact Computation , publisher Springer International Publishing , address Cham . pp. pages 270--281 . :10.1007/978-3-319-13524-3\_23

  7. [7]

    , author Popa, A

    author Ordyniak, S. , author Popa, A. , year 2015 . title A parameterized study of maximum generalized pattern matching problems . journal Algorithmica volume 75 , pages 1--26 . :10.1007/s00453-015-0008-8

  8. [8]

    Baker, B

    author S. Baker, B. , year 1993 . title Theory of parameterized pattern matching: Algorithms and applications , pp. pages 71--80 . :10.1145/167088.167115

Show all 10 references
  1. [9]

    , year 1995

    author Ukkonen, E. , year 1995 . title On-line construction of suffix trees . journal Algorithmica volume 14 , pages 11 . :10.1007/BF01206331

  2. [10]

    , year 2002

    author Wattenberg, M. , year 2002 . title Arc diagrams: Visualizing structure in strings , pp. pages 110 -- 116 . :10.1109/INFVIS.2002.1173155

Pith tools

Reviewed August 14, 2026 · model on record in the stance chip above.