diff -r 69880fdc8310 -r efb7fd4a6d1f src/Doc/Implementation/Prelim.thy --- a/src/Doc/Implementation/Prelim.thy Fri Jul 17 20:35:43 2020 +0200 +++ b/src/Doc/Implementation/Prelim.thy Mon Jul 20 23:45:29 2020 +0200 @@ -269,23 +269,27 @@ \begin{tabular}{ll} \\ T\ & representing type \\ \\ empty: T\ & empty default value \\ - \\ extend: T \ T\ & re-initialize on import \\ - \\ merge: T \ T \ T\ & join on import \\ + \\ extend: T \ T\ & obsolete (identity function) \\ + \\ merge: T \ T \ T\ & merge data \\ \end{tabular} \<^medskip> The \empty\ value acts as initial default for \<^emph>\any\ theory that does not - declare actual data content; \extend\ acts like a unitary version of - \merge\. + declare actual data content; \extend\ is obsolete: it needs to be the + identity function. - Implementing \merge\ can be tricky. The general idea is that \merge (data\<^sub>1, - data\<^sub>2)\ inserts those parts of \data\<^sub>2\ into \data\<^sub>1\ that are not yet - present, while keeping the general order of things. The \<^ML>\Library.merge\ - function on plain lists may serve as canonical template. + The \merge\ operation needs to join the data from two theories in a + conservative manner. The standard scheme for \merge (data\<^sub>1, data\<^sub>2)\ + inserts those parts of \data\<^sub>2\ into \data\<^sub>1\ that are not yet present, + while keeping the general order of things. The \<^ML>\Library.merge\ + function on plain lists may serve as canonical template. Particularly note + that shared parts of the data must not be duplicated by naive concatenation, + or a theory graph that resembles a chain of diamonds would cause an + exponential blowup! - Particularly note that shared parts of the data must not be duplicated by - naive concatenation, or a theory graph that is like a chain of diamonds - would cause an exponential blowup! + Sometimes, the data consists of a single item that cannot be ``merged'' in a + sensible manner. Then the standard scheme degenerates to the projection to + \data\<^sub>1\, ignoring \data\<^sub>2\ outright. \ paragraph \Proof context data\