!This post is in the process of being slowly edited to take into account different regional and transatlantic varieties of English!
The following is a description of the grammar in standard British English.
A special meaning of Only
Only can have several meanings and usages. We're interested in this type of meaning:
- I only go there on Thursdays.
Notice that this has almost a negative flavour. It effectively means:
- I don't go there except for on Thursdays.
With this meaning, using only is basically the equivalent of negating the whole sentence but then adding some sort of exception. Notice that in English we can move the word only to accentuate the focus of the exception. Consider this sentence:
- I only cycle to work on Thursdays.
If the speaker means that Thursday is the only day that she cycles to work, we can move the only to just before the preposition phrase on Thursdays to show that this is the exceptional day:
- I cycle to work only on Thursdays.
Some grammatical stuff
To understand when we use inversion with only in modern English, we need to understand a teeny bit about the structure of sentences. Most English sentences have a Subject and a Predicate, where the Predicate has the form of a verb phrase. Verbs in English often set up special slots for other phrases, very often noun phrases. So the verb LEND sets up a slot for a recipient and another for the thing being given:
- I lent [Bob] [my elephant].
These phrases that fill up these slots are usually called COMPLEMENTS. Some Complements have special names such as Direct object or Predicative Complement. In the sentence above, Bob and my elephant are Complements of the verb LEND.
Aside from Subjects and Complements, there are other extra bits of information that we can stick into the sentence that tell us where, or when, or how and so forth, something happened. These extra phrases have no special relationship with the verb, we can just kind of stick them onto the sentence. These extra bits are sometimes called adverbials, but I prefer the term ADJUNCT (the term adverbial conjures up the idea of adverbs, whereas Adjuncts can be noun phrases, or very often preposition phrases). In the following sentence the Adjunct is the preposition phrase on Thursday:
- I lent Bob my elephant on Thursday.
Inversion with Only
If you remember that sentence a bit further above, I cycle to work only on Thursdays, you might have noticed that we can move this on Thursdays bit to the beginning. We can prepose it:
- I cycle to work [only on Thursdays]
- [Only on Thursdays] do I cycle to work.
Notice that when we prepose the only section we need to move the whole phrase. The word only and the phrase that it applies to. Notice also that we see the word do in the version where we preposed the only-phrase. To understand why, consider the following example:
- Only if we've received the papers can we release the baboon.
In the example above we see the preposed phrase only if we've received the papers. Notice that in the main clause the subject and auxiliary verb have now changed places. Instead of we can release the baboon, we see can we release the baboon (the main auxiliary verbs in English are the common garden verbs BE and HAVE which we use to make different verb constructions, as in we have finished, or I am going - and also modal verbs. The main modal verbs in English are can, could, may, might, will, would, shall, should and must).
When the subject and auxiliary verb change positions like this, we call it subject-auxiliary inversion. In English if we prepose a phrase modified by only, we must also use inversion. Now notice that in the sentence I only cycle to work on Thursdays, there is no auxiliary verb. Present simple and past simple sentences in English do not always need an auxiliary verb. When we need to do inversion with present simple and past simple sentences, we insert a special dummy auxiliary, the verb DO. So in the sentence:
- Only on Thursdays do I cycle to work.
... we see that we have inserted this special auxiliary and then inverted the auxiliary with the subject, I.
Inversion and Subjects
But why do we need inversion in these particular examples, and when can we use this sort of preposing?
Well, notice that the crucial word there is the word preposing. If we prepose a phrase, it means that we move it to the beginning of the sentence. There are some phrases that we can't move to the beginning of the sentence. Most importantly we cannot prepose Subjects. Why? Well, Subjects are already at the beginning of the clause! We cannot move them to the beginning. They're right at the beginning anyway. We only change the order of the subject and the auxiliary if we actually move the only-phrase from its normal position to the front of the sentence. So in the following sentence where only modifies the Subject, Bob ...
... we do not see any inversion. The following sentence is ungrammatical:
And because we do not need inversion when only modifies a Subject, we don't need to use DO as a dummy auxiliary in these sentences either:
- Only nincompoops cycle to work on Thursdays.
The following is not good:
- *Only do nincompoops cycle to work on Thursdays.
Preposing and Adjuncts
What types of only-phrase can we prepose like this? Usually these phrases are Adjuncts. We can sometimes prepose Complements modified by only, but the results are often not very good. When they are kind of acceptable, they will sound archaic or very contrived. Here are some examples:
(? indicates marginal acceptability here).
So long as the preposed phrase is an adjunct, the results are normally fine (although it's probably worth bearing in mind that this style of sentence can be quite formal).
The Original Poster's examples
The Original Poster's first example does not need inversion, because the word only is modifying the Subject of the sentence. This means that there is no preposing. The word males appears in its normal position in the sentence. And because we don't need to invert the Subject and the auxiliary verb, we don't need a special dummy auxiliary DO here to help us do it.
Let's look at the second example:
Only topologically defined sets take advantage of any known internal relations.
The main verb here is take. The Subject in the clause is topologically defined sets. The word only is therefore modifying the Subject, and so we don't need inversion here, and we do not, therefore, need DO-support either.
Basically, only if there is preposing of some phrase do we need to use inversion!