Your theory is mostly correct.
- the cap is a cover for a bottle
Yes
- the lid is a cover for a container which is not bottle
Yes
- the lid doesn't have a screw in it. If it has screw, it is called a cap.
No. Lids often have screw tops. That feature isn't relevant.
Coke cans
Soda cans usually have pop-tops, which aren't called lids or caps. Thus, you don't refer to a soda can having a lid or a cap.
Standard cans like pinto beans or mandarin oranges have a lid. The lid requires a can opener, or sometimes has a ring to pull it off. Manufacturers in the USA should strongly consider adding those rings more frequently because they are quite convenient.