Good day Tanner, the last contraddiction is still lagging behind. I've been thinking about this for weeks now and i came to the conclusion it takes something more to conclude the theorem holds. I've been able to find different proofs and only one of them is convincing me. The one found in the book "Distributed Algorithms" by Nancy Lynch, pg. 287.
The proof Lynch gives states that if all processes from level j made it to level j+1 then none of them found to be the victim; but victim must be set to some of their IDs, that's a contraddiction and the branch is discharged. The key problem is having a lemma stating that victim must be some processes that lost the competition for the next level. In my opinion, this is far simpler to see correct than other approaches still i'm having troubles in replicating her approach.
Nancy Lynch provides 2 lemmata, one stating the role of winners and loser, the other that victim is always some loser.
I'm doubful my formalization of the first theorem is correct because using her model i reach at least an unprovable branch.
I wold like to focus on the first one only and i would like a suggestion from somebody more experienced than me.
How would you formalize the following two predicates?
Let's assume:
- P(.) is the predicate we want to prove,
- invariant(P(.)) is an inductive predicate for reachability over the automaton,
- winner(i,c,k) formalizes the winner process i in state c at level k,
- comp(j,c,k) formalizes the competitor process j in state c at level k.
My attempts so far lead to this:
- winner(i:below(N), c:state, k:nat) : bool = c`level(i)>k OR ( c`level(i)=k AND c`pc(i)=CS )
- comp(i:below(N), c:state, k:nat) : bool = winner(i, c, k) OR ( c`level(i)=k AND ( c`pc(i)=check_flag OR c`pc(i)=check_turn ) )
(Winner and comp defs. are given in the book so i simply reported them in PVS.)
WinnerIsNotVictim(c:state) : bool =
%1
FORALL i, j, (k:nat) : ( comp(i, c, k) AND c`pc(i)=check_flag AND
comp(j, c, k) AND member(j, c`S(i)) AND i/=j ) IMPLIES c`turn(k)/=i
AND
%2
FORALL i, j, (k:nat) : ( winner(i, c, k) AND comp(j, c, k) AND i/=j ) IMPLIES c`turn(k)/=i
inv_turn : LEMMA
invariant(ioa_inst, WinnerIsNotVictim)
I strongly suspect this formalization is incorrect, but i can't figure out the right one... I'm open to suggestions.
Regards,
Alberto
PS: in my opinion 1 and 2 should be proved together otherwise the inductive hypothesis ceases to hold, for instance when trying to prove 1 alone and level=k before the level++ transition.