Diopter = 1/focal length (in meters)
Diopter is simply the inverse of a lens focal length, in meters. If you have a convex lens with a focal length of 2 meters, it will have a diopter of 1/2, or +0.5. If you take this lens, and hold it so the sun shines through it to form a bright spot on the wall, the lens will cause the rays of light to converge, so the spot will become a point, when the lens is 2 meters from the wall. If the lens focuses light into a point when it is 4 meters from the wall, it has a 4 meter focal length, and a diopter of 1/4, or +0.25.
If you have good distance vision, it means that when your eye is in the relaxed state, any light rays which are coming from far away (and are almost parallel), will be focused on your retina without your eye having to make any effort. If you now put a +1/2 diopter lens in front of your eye, your relaxed focus will be shifted from infinity to the focal length of the lens. Your relaxed focus will now be at a point 2 meters away.
If you suffer from 'old eyes' (presbiopia),
you can see distance fine, but your eye cannot adjust anymore to see up close
for reading. In this case, you will add a positive power lens
where the focal length is such that your relaxed focus moves from
infinity to reading distance. Many people will read at about
20" away, which is approximately 1/2 meters, so you will typically use a
+2 diopter lens in a pair of reading glasses or in bifocals to
accomplish this shift of focus.
Convex lens = positive diopter
Negative diopter lenses also exist. These do not bring incoming light together, but rather spread it apart. You can take the diverging beam coming out of a negative diopter lens, calculate where they would have come from, if you had not used a lens, and thereby calculate the theoretical 'negative' focal length of the lens. These lenses are prescribed for people who are myopic, or nearsighted.
Concave lens = negative diopter
Diopters are additive. If you hold a +0.50 lens and a +0.25 lens in front of each other, you will get the same effect as if you were looking through a +0.75 lens. This is why lenses can help you focus. Your eye is approximately 25mm in diameter, so if you are looking at infinity, the lens of your eye is effectively a 40 diopter lens. When you are young, you can exert the ciliary muscle in your eye to flex the lens to add up to 4 diopters to the lens. This effectively lets you focus as close as 1/4 meter, 25 cm, about 10". As you get older and get presbiopic, the lens gets hard, and you can no longer add 4 diopters, you can maybe add only 2 diopters, or less.
In order to focus at 50cm to read, you can either flex your eye to add the 2 diopters, or you need to add a +2.0 diopter lens in reading glasses, restoring your ability to focus close without the eye making an effort.
For shooting, the correct distance to focus at to balance your depth of field equally between the front sight and the target is called the 'hyperfocal' distance of the front sight, and by lens math it is defined as 2x the distance between your eye and the front sight. Since an AR has a 20" barrel, and you have about 2" of eye relief (22" total), the hyperfocal distance is 44". This is 1.12meters. If you want your eye to remain in the fully relaxed state while shooting (ie it thinks it is focused at infinity), you need a lens which will let you focus at 1.12 meters. The inverse of 1.12 is +0.89, so if your eye is relaxed and exactly focused at infinity, you theoretically need a +0.89 diopter lens to add to your eye's relaxed lens. Obviously, every eye is different, so you actually need to test to determine the exact value that works for you, but in general shooters find that around a +0.75 works best if they can see infinity without correction.