Basically for this question I need a confirmation that all of my listed assumptions are fairly accurate.
The bitcoin network measures how much time it took to create the last 2016 blocks in a blockchain. If it took significantly more than 2 weeks, the challenge difficulty is reduced. If it took significantly less than 2 weeks, the difficulty is increased.
Who performs these measurements? Every miner for themselves? I assume, since they operate on the same algorithm, they automatically change the goal for their algorithm from time to time without having to verify their assumptions with anyone.
For example, for some time a certain miner has been trying to provide responses to challenges so that the
hash(challenge+proof) has 40 leading zeros.
After each new block is being inserted in the blockchain, a miner measures the time it took to produce last 2016 blocks.
If the measured time is higher than a certain treshold, difficulty should decrease.
From then on, the miner simply starts submitting proofs of work that result in 39 leading zeros.
The miner is counting on the fact that the other miners had the same conclusion and that they will accept his answer, his proof of work?
Even though the miners didn't have an official agreement - "From now on, we are all solving an easier task. Ok? - Ok! - Lets go!"