My approach to understanding the naming of intervals is based on the appearance of the two notes involved. If they are on the same line or space as each other, then the interval is a unison (of one quality or another). If one note is on a line and the other is on an adjacent space (or vice versa), then the interval is a second (of one quality or another). Space to space or line to line will be a third, fifth, seventh, ninth, etc. In other words, the look of the interval determines the numerical part of its name.
The perfect intervals are unison, fourth, fifth and octave.
Flattening the upper note of a perfect interval results in a a diminished interval.
C to G is a perfect 5th, C to G♭ is a diminished 5th;
C to F is a perfect 4th, C to F♭ is a diminished 4th (sounds like a major 3rd, but looks like a 4th);
Lower C to upper C is a perfect octave, C to C♭ is a diminished octave (sounds like a major 7th, but looks like an octave);
C to the same C is a perfect unison, C to C♭ is a diminished unison.
This might not be the way that everybody was taught and understands it, but it seems to be the explanation. Perhaps the terminology used becomes somewhat ambiguous when the interval is being calculated downwards. If you are using the phrase “transpose by a diminished unison”, then you are going down a semitone. If the phrase is “transpose down by a diminished unison”, then it becomes less clear what is intended.