In semantics, contrast is a relationship between two discourse segments.
Contrast is often overtly marked by markers such as but or however, such as in the following examples:
In the first clause, It's raining implies that the speaker knows the weather situation and so will prepare for it, while the second clause I am not taking an umbrella implies that the speaker will still get wet. Both clauses (or discourse segments) refer to related situations, or themes, yet imply a contradiction. It is this relationship of comparing something similar, yet different, that is believed to be typical of contrastive relations. The same type of relationship is shown in (2), where the first sentence can be interpreted as implying that by giving a party for the new students, the hosts will serve drinks. This is of course a defeasible inference based on world knowledge, that is then contradicted in the following sentence.
The majority of the studies done on contrast and contrastive relations in semantics has concentrated on characterizing exactly which semantic relationships could give rise to contrast. Earliest studies in semantics also concentrated on identifying what distinguished clauses joined by and from clauses joined by but.
In discourse theory, and computational discourse, contrast is a major discourse relation, on par with relationship like explanation or narration, and work has concentrated on trying to identify contrast in naturally produced texts, especially in cases where the contrast is not explicitly marked.
In morphology, 'contrast' is identified when two linguistic elements occur in the same environment(s), and replacing one with the other creates a difference in meaning. Two elements that contrast in identical environments make a minimal pair.