Add a write up of the state delta resolution algorithm#3122
Add a write up of the state delta resolution algorithm#3122erikjohnston wants to merge 2 commits intodevelopfrom
Conversation
docs/state_delta_resolution.tex
Outdated
| \begin{algorithmic} | ||
| \STATE $to\_recalculate \leftarrow \text{empty set of state keys}$ | ||
| \STATE $pending \leftarrow G_\delta$ | ||
| \WHILE{$pending$ is empty} |
There was a problem hiding this comment.
\WHILE{$pending$ is not empty}
|
rendered version at https://matrix.org/_matrix/media/v1/download/jki.re/hSmkLkFGVUnrXjtYcjsCUsyS |
docs/state_delta_resolution.tex
Outdated
| \end{split} | ||
| \end{equation} which we call state maps, for $F, G \subset K$. | ||
|
|
||
| We can then compute the set of all ``unconflicted events": |
There was a problem hiding this comment.
better described as "unconflicted state keys" maybe?
docs/state_delta_resolution.tex
Outdated
| \begin{split} | ||
| u_{f,g} : U_{f,g} \longrightarrow &\ E\\ | ||
| x \longmapsto &\ \begin{cases} | ||
| f(x), & \text{if}\ f \in F \\ |
docs/state_delta_resolution.tex
Outdated
| \end{equation} which gets the unconflicted event for a given state key. | ||
|
|
||
|
|
||
| We can also define a function on $C_{f,g} = F \cup G \setminus U_{f,g}$: |
docs/state_delta_resolution.tex
Outdated
| We can also define a function on $C_{f,g} = F \cup G \setminus U_{f,g}$: | ||
| \begin{equation} | ||
| c_{f,g}: C_{f,g} \rightarrow E | ||
| \end{equation} which is used to resolve conflicts between $f$ and $g$. Note that $c_{f,g}$ is either $f(x)$ or $g(x)$. |
There was a problem hiding this comment.
ITYM $c_{f,g}(x)$ is either ...
I don't think it's true that c_{f,g} is either f or g
docs/state_delta_resolution.tex
Outdated
| \end{equation} which we call the resolved state of $f$ and $g$. | ||
|
|
||
| \begin{lemma} | ||
| $\forall x \in U_{f,g} \ s.t.\ g(x) = g'(x)$ then $r_{f,g}(x) = r_{f,g'}(x)$ |
There was a problem hiding this comment.
this could do with clarifying. ITYM:
if $\forall x (g(x) = g'(x)), x \in U_{f_g}$, then ...
docs/state_delta_resolution.tex
Outdated
| \end{split} | ||
| \end{equation} which we call the resolved state of $f$ and $g$. | ||
|
|
||
| \begin{lemma} |
There was a problem hiding this comment.
it looks like you're about to prove this, which is confusing. Suggest just stating it rather than making it a Lemma.
docs/state_delta_resolution.tex
Outdated
| \alpha: E \rightarrow \mathbb{P}(K) | ||
| \end{equation} to be the mapping of an event to the type/state keys needed to auth the event, and | ||
| \begin{equation} | ||
| \alpha_{f,g}(x) = \alpha f(x) \cup \alpha g(x) |
There was a problem hiding this comment.
what's going on here? what does \alpha f(x) mean?
There was a problem hiding this comment.
\alpha f(x) = \alpha(f(x)), i.e. for the event in the state f, \alpha f(x) are its auth state keys
There was a problem hiding this comment.
yup makes sense. more parens ftw.
docs/state_delta_resolution.tex
Outdated
|
|
||
| Further, we can define | ||
| \begin{equation} | ||
| a_{f,g}(x) = \bigcup_{n=0}^\infty (\alpha_{f,g})^n(x) |
There was a problem hiding this comment.
can't you use something other than a? (or something other than \alpha?) They look pretty similar.
docs/state_delta_resolution.tex
Outdated
| Further, we can define | ||
| \begin{equation} | ||
| a_{f,g}(x) = \bigcup_{n=0}^\infty (\alpha_{f,g})^n(x) | ||
| \end{equation} to be the auth chain of $f(x)$ and $g(x)$. This is well defined as there are a finite number of elements in $F \cup G$ and $a_{f,g} \rightarrow F \cup G$. |
There was a problem hiding this comment.
I think more to the point, α → F ∩ G
docs/state_delta_resolution.tex
Outdated
| a_{f,g}(x) = \bigcup_{n=0}^\infty (\alpha_{f,g})^n(x) | ||
| \end{equation} to be the auth chain of $f(x)$ and $g(x)$. This is well defined as there are a finite number of elements in $F \cup G$ and $a_{f,g} \rightarrow F \cup G$. | ||
|
|
||
| If we consider the implementation of $c_{f,g}$ in Synapse we can see that it depends not only on the values of $x$, but also on the resolved state of their auth events, i.e. $r_{f,g}(\alpha_{f,g}(x))$. By ``depends on" we mean that if those are the same for different values of $f$ and $g$, then the result of $c_{f,g}(x)$ is the same. |
There was a problem hiding this comment.
I'm failing to grok the By depends on sentence. "those are the same": which are the same?
the term "depends on" is used heavily in the later proofs, so I think this needs defining more precisely.
There was a problem hiding this comment.
By depends on I mean, say: c_f(x) depends on r_f(x), then forall g where r_f(x) = r_g(x) then c_g(x) = c_f(x).
Its basically saying that c could be written as a pure function from f(x), g(x) and r_{f,g}(\alpha_{f,g}(x))
There was a problem hiding this comment.
(i'd be tempted to abuse a proportionality symbol \propto to represent the 'depends on' relationship.
Or redefine it in terms of independence.
docs/state_delta_resolution.tex
Outdated
| \end{lemma} | ||
|
|
||
| \begin{proof} | ||
| $c_{f,g}(x)$ depends on $x \in a_{f,g}(x)$, and $r_{f,g}(\alpha_{f,g}(x))$. Now: |
There was a problem hiding this comment.
a_{f,g}(x) = x \cup \alpha_{f,g}(x) \cup (\alpha_{f,g})^2(x) \cup ...
docs/state_delta_resolution.tex
Outdated
| $c_{f,g}(x)$ depends on $x \in a_{f,g}(x)$, and $r_{f,g}(\alpha_{f,g}(x))$. Now: | ||
| \[ | ||
| \begin{split} | ||
| r_{f,g}(\alpha_{f,g}(x))\ =\ & u_{f,g}(\alpha_{f,g}(x)) \cup c_{f,g}(\alpha_{f,g}(x))\\ |
There was a problem hiding this comment.
u is only defined over the unconflicted part of the state key space. I think it's clear what you mean, but it might be good to be more precise here.
docs/state_delta_resolution.tex
Outdated
| \begin{split} | ||
| r_{f,g}(\alpha_{f,g}(x))\ =\ & u_{f,g}(\alpha_{f,g}(x)) \cup c_{f,g}(\alpha_{f,g}(x))\\ | ||
| \end{split} | ||
| \] but by definition $u_{f,g}(\alpha_{f,g}(x))$ depends only on $\alpha_{f,g}(x)$, so $r_{f,g}(\alpha_{f,g}(x))$ depends on $a_{f,g}(x)$ and $c_{f,g}\alpha_{f,g}(x)$. |
There was a problem hiding this comment.
could you be consistent about c_{f,g}\alpha_{f,g}(x) vs c_{f,g}(\alpha_{f,g}(x)) ? (with my preference heavily on the former). It's particularly weird to see r with extra parens in the same sentence as c without.
docs/state_delta_resolution.tex
Outdated
| \begin{split} | ||
| r_{f,g}(\alpha_{f,g}(x))\ =\ & u_{f,g}(\alpha_{f,g}(x)) \cup c_{f,g}(\alpha_{f,g}(x))\\ | ||
| \end{split} | ||
| \] but by definition $u_{f,g}(\alpha_{f,g}(x))$ depends only on $\alpha_{f,g}(x)$, so $r_{f,g}(\alpha_{f,g}(x))$ depends on $a_{f,g}(x)$ and $c_{f,g}\alpha_{f,g}(x)$. |
There was a problem hiding this comment.
I think s/depends on a/depends on α/
There was a problem hiding this comment.
could you split the result of what r(...) depends on to a separate \begin{equation}, since you're about to use it for induction?
There was a problem hiding this comment.
Err, yes, (though α is a subset of a, so its correct to say that it depends on a)
docs/state_delta_resolution.tex
Outdated
| \end{split} | ||
| \] but by definition $u_{f,g}(\alpha_{f,g}(x))$ depends only on $\alpha_{f,g}(x)$, so $r_{f,g}(\alpha_{f,g}(x))$ depends on $a_{f,g}(x)$ and $c_{f,g}\alpha_{f,g}(x)$. | ||
|
|
||
| By induction, $c_{f,g}\alpha_{f,g}(x)$ depends on $a_{f,g}(x)$ and $c_{f,g}(\alpha_{f,g})^n(x), \forall n$. Since $(\alpha_{f,g})^n(x)$ repeats and we know $c_{f,g}$ is well defined, we can infer that $c_{f,g}(x)$ depends only on $\bigcup_{n=0}^\infty (\alpha_{f,g})^n(x) = a_{f,g}(x)$. |
There was a problem hiding this comment.
Yes, if you mean the first "depends on". Though as above its correct to say it depends on a too.
|
this would help with #1760 (i think?) as faster state res means that the number of extremities which need to be resolved is less of a consideration (especially if their intermediary resolution results have been cached and can be built on) |
|
For reference why this was closed:
|
No description provided.