Avoiding Secondary Structures Constraint
- The avoiding secondary structures constraint is a negative-design principle ensuring that a nucleic acid sequence folds uniquely by excluding competing structural configurations.
- It is formalized using combinatorial and thermodynamic frameworks, employing uniqueness-of-fold conditions, energy-based exclusions, and reverse-complement avoidance.
- This approach informs RNA design, DNA coding, and alignment methods through tree representations, formal language filtering, and algorithmic constraints for biochemical specificity.
In the literature considered here, the avoiding secondary structures constraint denotes a family of negative-design requirements for nucleic acids: in RNA design, a sequence must realize a target fold instead of any other structure; in constrained prediction, outputs must exclude invalid pairings and matching violations; and in single-stranded DNA coding, a sequence must avoid internal reverse-complement substrings that can produce stem-loop or hairpin-like self-folding (Bonnet et al., 2017, Chen et al., 2020, Chu et al., 2023). Across these settings, the common mathematical theme is not merely feasibility of a desired structure, but exclusion of competing structures, pairings, or local patterns that would make the target ambiguous, invalid, or biochemically undesirable.
1. Formal meaning of the constraint
In combinatorial RNA design, avoidance is formalized as a uniqueness-of-fold condition. For an energy model , the minimum-free-energy prediction problem is written as
and a target structure is acceptable only if it is the unique optimum and every alternative fold lies at energy at least above it. In the Watson–Crick case with , every competing fold must lose at least one base pair relative to the target (Haleš et al., 2016). The closely related formulation used in the Watson–Crick design-hardness result defines a sequence to be a design for a pseudoknot-free structure when is compatible with and every other compatible structure has strictly more unpaired letters; in that model, 0 is therefore the unique structure with the maximum number of pairs (Bonnet et al., 2017).
The RNA setting is explicitly over the alphabet
1
with the four symbols often re-encoded as 2, where
3
and Watson–Crick pairing is permitted exactly when two letters sum to 4, namely 5 and 6 (Bonnet et al., 2017). In this formulation, avoiding undesired secondary structures means ruling out every alternative pseudoknot-free structure with the same or greater number of pairs.
In DNA coding, the same theme is expressed as an internal pattern-avoidance constraint. A sequence is 7-secondary structure avoidance if it does not contain two non-overlapping reverse-complement consecutive subsequences of length 8; the 2023 coding paper notes that the earlier definition using length at least 9 is equivalent (Chu et al., 2023). The earlier construction paper gives the stronger quantified version directly: for all 0, there must not exist non-overlapping substrings 1 of length 2 such that
3
Here the reverse-complement is defined over
4
with
5
A broader survey treatment also frames secondary-structure avoidance thermodynamically. It introduces a pair-interaction energy
6
together with the Nussinov–Jacobson recurrence
7
and states that a low negative value of 8 is a good indicator of secondary structures (Benerjee et al., 2 Oct 2025). This suggests two complementary views of the constraint: a combinatorial exclusion of forbidden internal patterns, and an energy-based exclusion of strongly self-pairing folds.
2. Structural representations and validity conditions
For pseudoknot-free RNA, the standard representation is the dot-parenthesis string over
9
where removing all dots leaves a well-parenthesized expression; matching parentheses denote paired bases and dots denote unpaired bases (Bonnet et al., 2017). The same noncrossing perfect-matching structure can also be encoded as a rooted plane tree. In the plane-tree model, a primary structure is a word
0
over a complementary alphabet 1, and a plane tree 2 with 3 edges is 4-valid if every edge 5 pairs complementary letters 6 and 7 (Black et al., 2015). This model is deliberately fully paired: every position belongs to some edge, and the paper emphasizes that hairpin loops, bulges, and other unpaired regions are omitted.
Tree representations are also central in RNA designability theory. A structure may be represented as a rooted ordered tree 8 whose vertices are paired nodes 9, unpaired nodes 0, and a virtual root 1; the degree statistic 2 is then the maximum number of paired neighbors of any node (Haleš et al., 2016). This representation supports local obstructions such as 3, a node of degree more than four, and 4, a node with an unpaired child and degree greater than two (Haleš et al., 2016).
Learning-based prediction uses a different representation: the binary base-pairing matrix 5, where 6 means bases 7 and 8 are paired (Chen et al., 2020). In that formulation, structural validity is expressed by explicit constraints. Allowed base pairs are
9
short loops are forbidden by
0
each base may pair with at most one partner,
1
and symmetry is required: 2 Notably, nestedness is not imposed, so valid pseudoknots remain admissible (Chen et al., 2020).
Algorithmic alignment work depends on the classical structural restriction that base pairs are one-to-one and, for secondary structures, non-crossing. It also makes a more refined point: even when the input RNA structures may have crossing base pairs, the aligned base pairs are required to be non-crossing (Chen et al., 2014). This locates the avoiding-secondary-structures constraint not only in design, but also in the representation of admissible search spaces for matching and alignment.
3. Complexity of avoiding competing RNA folds
The most direct hardness result states: 3 This holds in the simple Watson–Crick energy model, with a fixed 4-letter alphabet, and for pseudoknot-free structures (Bonnet et al., 2017). The constrained input consists of a target structure 4 and a partial sequence 5 over
6
where “?” denotes an unspecified position and fixed positions encode unary constraints of the form “index 7 must be labeled by base 8.” Membership in NP follows because one can guess an extension 9 and verify by a modified dynamic program that the target is the unique maximum-pairing compatible structure (Bonnet et al., 2017).
The reduction is from E3-SAT, using variable and clause gadgets arranged so that an alternative higher-pairing fold exists if and only if some clause is unsatisfied. The key parameter choices are
0
Variable gadgets force all 1 dots in a variable region to receive the same label, either all 2 or all 3, encoding true or false. Clause gadgets are engineered so that if all three literals of a clause are false, one can break the clause arch, rematch clause dots against variable dots, gain 4 new pairs, and lose only about 5, yielding a net gain because 6 is slightly less than 7 (Bonnet et al., 2017). The paper is explicit that the hardness theorem is for RNA DESIGN EXTENSION, not for plain RNA DESIGN, and that unconstrained RNA DESIGN remains open.
This negative result is complemented by exact positive structure theorems. For saturated structures, the 2016 combinatorial design paper gives a complete characterization: 8 for an alphabet with 9 complementary pair types, and in the four-letter Watson–Crick case this becomes 0 (Haleš et al., 2016). With unpaired positions, the paper gives necessary obstructions 1 and 2, and a constructive sufficient condition: if the tree representation admits a separated proper coloring, then the structure is 3-designable (Haleš et al., 2016). It also proves stutter closure and a 4 structure-approximating repair algorithm that transforms any structure avoiding 5 and 6 into a designable one by adding at most one base-pair to each stem (Haleš et al., 2016).
A further constructive sufficiency result shows that an infinite class of unsaturated rooted trees is designable. If the target is a P-unsaturated perfect floral tree, then its natural labelling yields a sequence whose target structure is the unique maximum-size arc set; the result extends to all P-unsaturated floral trees and also to the equal-weight 7-permitting variant 8 (Jedwab et al., 2017). The proof uses balanced sets, running-difference parity, and noncrossing arguments to force all deepest leaves to remain unpaired and all remaining depths to pair internally, thereby excluding every competing maximum-size fold.
A different combinatorial perspective comes from the fully paired plane-tree model. There, the main asymptotic theorem is
9
so the proportion of words admitting even one valid plane tree goes to zero as word length increases (Black et al., 2015). This does not solve RNA inverse folding, but it shows that in that restricted model the absence of any valid fully paired structure is asymptotically typical.
4. Constructive recognition and language-theoretic filtering
In the plane-tree setting, validity can be recognized by a greedy stack algorithm. Given
0
one pushes 1 on a stack, scans left to right, and at each step pops if the top of the stack is the complement of the next symbol, otherwise pushes. If the stack empties completely, the induced ordered pairs form a plane tree 2; and if 3 is nonempty then the greedy algorithm produces a valid plane tree 4 (Black et al., 2015). Combined with the converse, this yields an effective recognition criterion for existence versus nonexistence of a valid plane-tree folding. The same paper proves that the graph 5 of valid plane trees under Condon–Heitsch–Hoos local moves is connected, that the greedy tree 6 is the unique sink of the type-2 orientation, and that
7
with equality if and only if
8
(Black et al., 2015). These results identify a canonical “most collapsed” valid structure when valid structures exist.
For constrained sequence generation, a different approach uses formal languages. The formal-language framework builds a context-free grammar 9 that generates exactly the sequences compatible with a target pseudoknot-free structure and positional constraints 0, and a deterministic finite automaton 1 that recognizes sequences containing all mandatory motifs and avoiding all forbidden motifs (Zhou et al., 2013). Because the intersection of a context-free language with a regular language is context-free, one can construct a product grammar 2 with nonterminals 3 such that
4
The resulting framework supports emptiness detection, counting, exhaustive enumeration, uniform random generation, and weighted random generation, and the chapter states linear dependence on sequence length 5 for the core grammar construction (Zhou et al., 2013).
The limitation is explicit: this framework focuses on positive design and “does not explicitly capture negative design goals such as specificity or avoidance of more favorable alternative folds” (Zhou et al., 2013). It can exclude forbidden sequence motifs exactly, and it can enforce compatibility with a chosen target structure, but it does not directly encode “compatible with 6 and incompatible with an arbitrary competitor 7.” In practice, the paper recommends post-generation refolding and filtering.
This suggests a two-layer interpretation of the constraint. Some methods enforce it by exact exclusion of local forbidden patterns or by exact designability criteria on the target tree. Others enforce only a front-end admissible sequence space and leave fold-specific exclusion to downstream screening.
5. DNA secondary-structure avoidance codes
In the DNA-coding literature, the avoiding-secondary-structures constraint is formulated as a finite-state constrained-coding problem. For
8
a length-9 sequence is 00-SSA if it contains no two non-overlapping reverse-complement consecutive subsequences of length 01; equivalently, it avoids non-overlapping reverse-complement consecutive subsequences of length at least 02 (Chu et al., 2023). The asymptotic objective is the capacity
03
where 04 is the largest size of an 05-SSA code of length 06 (Chu et al., 2023).
One explicit construction for arbitrary 07 concatenates blocks from a set 08 chosen so that no pair of blocks contains reverse-complement substrings of length
09
The resulting concatenation code is an 10 SSA code (Nguyen et al., 2023). A second general construction restricts to
11
and requires every length-12 substring to contain an 13. For 14, the resulting family satisfies
15
and, for 16,
17
yielding asymptotic rate 18 bits/nt, improving the earlier 19 bits/nt block construction (Nguyen et al., 2023). The same paper also gives a linear-time encoder with one redundant symbol whenever
20
The 2023 improvement paper reframes the problem through generating sets 21 that contain no reverse-complement pair, and computes code rates from overlap-graph spectral radii (Chu et al., 2023). For odd 22, it introduces the 23-24-dominant construction: every length-25 window must contain more than 26 symbols from 27. For 28, this becomes the binary recurrence
29
with dominant root 30 of
31
and produces the optimal rate 32 bits/nt; for 33, exhaustive search over generating sets gives the optimal rate 34 bits/nt (Chu et al., 2023). The paper’s summary table also reports rates 35, 36, 37, 38, and 39 bits/nt for 40, respectively (Chu et al., 2023).
An algebraic survey chapter embeds this constraint into the broader theory of DNA codes with multiple constraints. It defines 41-free secondary structures, introduces secondary-complement and reverse-secondary-complement substrings, and then gives a concrete 42-based construction using the restricted block set
43
with bijection
44
Its key lemma states that any DNA string defined over 45 does not form any secondary structure with stems of length more than two, because for every admissible length-3 substring 46, neither 47 nor 48 is again admissible (Benerjee et al., 2 Oct 2025). The same chapter explicitly identifies the algebraic treatment of new constraints such as secondary structure formation as an open direction (Benerjee et al., 2 Oct 2025).
6. Learning-based enforcement, exact thermodynamic inference, and scope
Constraint handling in modern prediction systems is often hybrid: some constraints are built into the architecture, while others are enforced only approximately. E2Efold is the clearest example. It predicts a score matrix 49 and then applies an unrolled post-processing network derived from a constrained optimization problem (Chen et al., 2020). The hard mask
50
exactly forbids noncanonical pairs and short loops, while
51
makes the structure symmetric and nonnegative. The remaining one-pair-per-base condition
52
is handled by a primal-dual penalty with multipliers 53, unrolled for
54
iterations (Chen et al., 2020). The paper is explicit that nestedness is not enforced, so pseudoknots are allowed.
Empirically, this constraint-aware architecture improves both validity and accuracy. On the RNAStralign test set, E2Efold reports Precision 55, Recall 56, and F1 57; on ArchiveII without retraining, Precision 58, Recall 59, and F1 60 (Chen et al., 2020). On sequences containing pseudoknots, it reports set F1 61, compared with 62 for RNAstructure, and its ablation result
63
shows that end-to-end training through the constraint-enforcing module matters (Chen et al., 2020). The same paper also notes the key limitation: because the unrolled procedure is run for a fixed finite number of iterations and uses a smooth approximation to sign, one-pair-per-base satisfaction is approximate rather than fully exact.
At the opposite end of the modeling spectrum, the 2026 codon-constrained design framework performs exact Boltzmann inference over synonymous coding sequences and unpseudoknotted structures (Fornace et al., 21 Apr 2026). It defines
64
where 65 is the ensemble free energy of coding RNA 66, and computes not only partition functions but also base-pairing probabilities, base marginals, and codon marginals (Fornace et al., 21 Apr 2026). The paper is framed as stability maximization rather than suppression of structure, and it states that it does not directly solve
67
let alone the reverse “least structured synonymous RNA” problem. However, it gives exactly the diagnostics one would use to identify persistent pairing tendencies under exact codon constraints, including
68
This suggests a precise distinction between exact structure-aware inference and exact anti-structure optimization: the former is available, while the latter remains external to the paper’s main objective (Fornace et al., 21 Apr 2026).
Several limitations recur across the literature. The formal-language design framework can exclude forbidden motifs exactly but does not directly encode specificity against arbitrary alternative folds (Zhou et al., 2013). The valid-plane-tree model proves that valid fully paired structures become asymptotically rare, but it omits unpaired nucleotides, wobble pairing, and realistic loop structures (Black et al., 2015). Structural alignment algorithms rely on one-to-one pairing and non-crossing aligned pairs; the paper explicitly notes that even if the input structures may have crossing base pairs, the aligned pairs are non-crossing (Chen et al., 2014). The codon-constrained thermodynamic framework excludes pseudoknots and does not hard-forbid all secondary structures (Fornace et al., 21 Apr 2026).
Taken together, these results define a layered landscape. At one end are exact combinatorial obstructions and NP-completeness results for uniqueness-of-fold under natural positional constraints. In the middle are constructive criteria—degree bounds, forbidden motifs, separated colorings, floral-tree classes, generating sets, and algebraic block maps—that guarantee avoidance in restricted models. At the other end are differentiable and thermodynamic systems that enforce only part of the constraint space exactly, while using optimization, unrolling, or exact ensemble inference to suppress or diagnose the remaining failure modes. This suggests that the avoiding secondary structures constraint is not a single formal object but a family of closely related exclusion principles whose mathematical content depends on whether the goal is unique target folding, validity of predicted structures, or self-folding avoidance in DNA codes.