Theoretical key
In music theory, a theoretical key is a key whose key signature would have at least one double-flat () or double-sharp (). Double-flats and double-sharps are often used as accidentals, but placing them in the key signature (in music that uses equal temperament) makes the music generally impractical to read. Enharmonic equivalence. For example, the key of G-sharp major is a key of this type, because its corresponding key signature has an F (on its leading-tone), giving it eight sharps. An equal-tempered scale of G-sharp major scale consists of the same pitches  as the A-flat major scale, so that the two scales sound exactly the same; such key pairs are said to be enharmonically equivalent. Consequently, the theoretical key of G-sharp major is usually notated as A-flat major which has four flats. Even when enharmonic equivalence is not resorted to, it is more common to use either no key signature or one with single-sharps and to provide accidentals as needed for the Fs, than to incorporate double-sharps into the key signature. Nevertheless, examples of the latter can be found (see below). Modulation. While a piece of Western  music generally has a home key, a passage within it may modulate to another key, which is usually closely related to the home key (in the Baroque and early Classical eras), that is, close to the original around the circle of fifths. When the key is near the top of the circle (a key signature of zero or few accidentals), the notation of both keys is straightforward. But if the home key is near the bottom of the circle (a key signature of many accidentals), and particularly if the new key is on the opposite side (in the late Classical  and Romantic eras), it becomes necessary to consider enharmonic equivalence (if double accidentals are to be avoided). In each of the bottom three places on the circle of fifths the two enharmonic equivalents can be notated entirely with single accidentals and so do not classify as 'theoretical keys': The need to consider theoretical keys. However, when a parallel key ascends the opposite side of the circle from its home key, then theory suggests that double-sharps and double-flats would have to be incorporated into the notated key signature. The following keys (six of which are the parallel major/minor  keys of those above) would require up to seven double-sharps or double-flats: For example, pieces in the major mode commonly modulate up a fifth to the dominant; for a key with sharps in the signature this leads to a key whose key signature has an additional sharp. A piece in C-sharp that performs this modulation would lead to the theoretical key of G-sharp major, requiring eight sharps, meaning an F in place of the F already present. To write that passage with a new key signature would require recasting the new section using the enharmonically equivalent  key signature of A-flat major. An example of such recasting is Claude Debussy's "Suite bergamasque": in the third movement "Clair de lune" the key shifts for a few measures from D-flat major to D-flat minor (eight flats), but the passage is notated in C-sharp minor (four sharps) for ease of reading; the same happens in the final movement "Passepied", which reaches theoretical G-sharp major written as A-flat major. Notation. Such passages may instead be notated with the use of double-sharp or double-flat accidentals, as in this example from Johann Sebastian Bach 's "Well-Tempered Clavier", in G-sharp major (the overall key is C-sharp major): In very few cases, theoretical keys are in fact used directly, putting the necessary double-accidentals in the key signature. The final pages of John Foulds' "A World Requiem" are written in G major (with F in the key signature), and the third movement of Victor Ewald's Brass Quintet Op. 8 is written in F major (with B in the key signature). Examples of theoretical key signatures are pictured below: There does not appear to be a standard on how to notate theoretical key  signatures: Tunings other than twelve-tone equal-temperament. In a different tuning system (such as 19 tone equal temperament) there may be keys that do require a double-sharp or double-flat in the key signature, and no longer have conventional equivalents. For example, in 19 tone equal temperament, the key of B major (9 flats) is equivalent to A-sharp major (10 sharps). Thus in non-12-tone tuning systems, keys that are enharmonic in a 12 tone system (for example, A-flat and G-sharp major) may be notated completely differently.