## 2 Results and Discussion  
First, we have proved that 4,6-dimethylisoxazole[3,4-b]pyridin-3(1\(H\))-one (**1**) undergoes 1,2 nucleophilic addition in a reaction with formaldehyde to afford hemiaminal **2**, the structure of which was unambiguously confirmed by single crystal X-ray analysis (Figure 1). According to our previous studies, the same reaction performed in the presence of secondary amine (HNR1R2) gives rise to the formation 2,2-dialkyl-5,7-dimethyl-2,3-dihydro-[1,2,4]triazole0[4,3-a]pyridin-2-ium-8-carboxylates (**3a,b**), i.e., Safirinium P dyes, by means of the tandem Mannich--electrophilic amination reaction [4]. Hence, acidic isoxazolone **1** in the presence of a base forms salts **1a,b** which further react with formaldehyde to yield iminium salts **1a,b**. Furthermore, the ambident nucleophile and iminium cations give the Mannich addition products (amimals **1a,b**) that spontaneously undergo electrophilic amination reactions via the transition states **1a,b** affording products **3a,b** in a quantitative manner. In order to get a better insight into the above chemical transformations, we have performed theoretical studies with use of DFT B3 LYP [11] and \(\omega\)B97X-D [12] methods as well as a Polarizable Continuum Model (IEF-PCM) [13] implemented in a Gaussian 16 software package [14]. The stationary structures that pertain to the chemical entities presented in Scheme 1 were optimized to confirm that all ground structures, except for the transition states, have only real frequencies. The relative energy comparisons in water and methanol solutions are given in Table 1. As a general observation, pure B3 LYP/PCM density functional without empirical dispersion failed to reasonably reproduce the investigated chemical transformations since the reaction products **2** and **3a,b** were found to be thermodynamically unfavorable in water and methanol with the Gibbs free energies for the latter solvent of 0.6, 5.8, and 0.3 kcal/mol, respectively. This theoretical approach predicted also relatively high energy barriers for the electrophilic amination processes by means of high Gibbs free energies of 28.4 and 22.7 kcal/mol for the transition states **1a,b** in methanol. Since the correct determination of large molecular structures and their properties require inclusion of the van der Waals interactions between molecules, we have added to the B3 LYP/6-31+G(d) functional [PERSON]'s empirical dispersion corrections [15], which were found to reliable in describing large molecular systems [16]. Consequently, the results obtained show that formation Safirinum P dye (**3a**) is thermodynamically favorable with \(\Delta\)G values of \(-4.0\) and \(-3.1\) kcal/mol for reactions carried in water and methanol, respectively. Similarly, the application of dispersion corrections significantly lowered the calculated electrophilic amination barriers revealing transition states with \(\Delta\)G values of 19.1 and 19.5 kcal/mol. The reaction of sterically constrained 1-methylenepyrrolidinium salt **1b**  
Figure 1: Molecular structure of **2**. Displacement ellipsoids are shown at the 50% probability level. is considerably faster and more exothermic than that involving unconstrained iminium salt **1a** (19.5 vs. 15.8 kcal/mol and \(-\)3.1 vs. \(-\)7.6 kcal/mol). Finally, utilization of larger basis set, i.e., 6-311+G(d,p), or application of a range-separated hybrid functional \(\omega\)B97X-Dand results in a further reduction of the discussed \(\Delta\)G values by ca. 4 kcal/mol.