As pointed out in the comment by @Rob, this is called a Circumzenithal Arc or colloquially, an "upside-down rainbow". Different to usual rainbows (which appear on the opposite side of the sky from the sun), a circumzenithal arc is centered around the zenith of the sky (directly above), and can only appear if the sun's angle is less than $\approx 30°$ to the horizontal.
In order for a circumzenithal arc to form, small ice crystals need to be positioned high in the sky in order to create a field of tiny prisms. Then the sun's rays will enter these ice crystals and refract through them therefore projecting an arc in the sky. If this projection was complete (a full $360°$), it would completely encircle the sky's zenith - hence the term circumzenithal.
Completely circular circumzenithal arcs do occur but are very rare, and so most of them only take up a section of the sky. The circumzenithal arc remains until the sun's angle exceeds $\approx 30°$ to the horizontal.
In most cases, a circumzenithal arc will last about 30 minutes to an hour (sometimes more). They are most common in colder climates (I assume in Montreal - where you took these images - it is fairly cool), where ice crystals abundantly tend to collect in the sky (they can be sometimes be seen in mild temperature zones as well during winter, or periods of cooler weather).
The above link (which explains the phenomena in detail) has more technical details:
The circumzenithal arc, also called the circumzenith arc (CZA),
upside-down rainbow, and the Bravais arc,is an optical phenomenon
similar in appearance to a rainbow, but belonging to the family of
halos arising from refraction of sunlight through ice crystals,
generally in cirrus or cirrostratus clouds, rather than from
raindrops. The arc is located at a considerable distance
(approximately $46°$) above the observed Sun and at most forms a quarter
of a circle centered on the zenith. It has been called 'a smile in the
sky', its first impression being that of an upside-down rainbow. The
CZA is one of the brightest and most colorful members of the halo
family. Its colors, ranging from violet on top to red at the bottom,
are purer than those of a rainbow because there is much less overlap
in their formation.
The intensity distribution along the circumzenithal arc requires
consideration of several effects: Fresnel's reflection and
transmission amplitudes, atmospheric attenuation, chromatic dispersion
(i.e. the width of the arc), azimuthal angular dispersion (ray
bundling), and geometrical constraints. In effect, the CZA is
brightest when the Sun is observed at about $20°$.