Latin did not have a word to answer positively to yes/no questions. Instead, it had different mechanisms to do so: it could either repeat the verb of the question (Do you like apples? I like.) and it could use the verb to do, a bit like English (Do you like apples? I do.). These answers could be reinforced with adverbs like certainly or indeed (Do you like apples? I certainly do!). One of the adverbs that was used with this function was SIC 'thus'. This adverb was to become the affirmative answer word sí in many Romance languages (Catalan sí, French si*, Italian sì, Spanish sí, Portuguese sim, among others).
Since SIC occurred as a reinforcement adverb in answers to yes/no questions, several authors identified this as the context in which it was repurposed as an answer particle. However, a closer look to the distribution of sí in Old Catalan tells a more nuanced story. Much like in Modern French, in 13th century Catalan, sí was used not only to reinforce answers to yes/no questions where the verb was echoed (repeated) or with the verb to do, but also in sentences that responded to overt or covert statements that implied or stated that something was not the case. By using sí, the writer (or at times, speaker, if we assume that the text that has reached us is a faithful rendering of an oral intervention) could indicate that something was indeed the case, even if it was suggested otherwise in the context. For more on the grammaticalisation of sí, see Pujol i Campeny 2019b.
It is very likely that sí was able to become an answer particle after developing this function because Catalan already had a positive answer particle shared with Occitan: hoc (also found with the alternative spellings och and oc).
It was generally thought that in Catalan, hoc was in use until the 16th century, when sí would have made an appearance. However, if we take sociolinguistic and historical variables into the picture, another story emerges: sí was already an active answer particle by the 13th century, and it competed with hoc until the latter disappears in the 16th century. The first attestations of sí appear in legal documents. We have seen in the previous section that legal documents tend to be archaising and obey rigid formal and stylistic conventions. However, when witness statements are included in the text, they tend to (but need not to) reproduce witnesses' answers as faithfully as possible. As it happens, 13th century witness statements of illiterate laymen consistently show the use of sí, while those of literate witnesses present hoc. Therefore, sí was already in use in oral language by the 13th century, but hoc, associated with high literature and literacy, was preferred for formal written registers.
The association of hoc and formal register was not by chance. In the 13th and 14th century Crown of Aragon, the language used by the Cancelleria Reial ('Royal Chancery', a body of scribes that produced the Crown's official documents and letters), acted as a linguistic model for learned texts. While the Cancelleria acted as a linguistic model, hoc was prevalent in written texts. The Cancelleria lost its power after the union between the Crown of Aragon and the Crown of Castille, and immediately after that we see a raise in the use of sí in the second half of the 15th century and its consolidation as the preferred positive answer particle by the 16th.**
*French si is used specifically as a reply to negative questions or statements:
A: Je sais que tu n'aimes pas les pommes.
B: Mais si!
A: I know you don't like apples.
B: But I do!
** Other variables play a part in hiding sí from the written record. For more details see Pujol i Campeny 2020a.