In a 2D elastic problem (in-plane), I found my stiffness and mass matrices for a 2D rectangle in which a homogeneous Dirichlet is applied on its left. Here: How to apply Dirichlet boundary conditions using a matrix free method - FEniCS Q&A , it is explained that when a homogeneous DC boundary conditions is applied, the diagonal entries for the relevant dofs are set to 1, and all off-diagonal entries in the same rows are set to zero. First, It would be great if someone can explain why should all the dofs on the diagonal be 1 and the rest zero, applying Dirichlet for a discrete chain gives me something else.
Second, here are first 36 dofs of my stiffness matrix:

Why do the yellow blocks which are showing the coupling of the dofs on the boundary and those on their right side, are zero sub-matrices? Clearly, the degrees of freedom on the boundary are not disconnected to those on their right side.

When you call assemble_system, it applies boundary conditions in a symmetric fashion. This means that instead of only setting the bc rows to an identity/multiple of identity row.
One instead uses lifting, which results in a Matrix where all bc entries are discoupled, and is instead added in the rhs ( b-=Ag) where g is equal to the DirichletBC at respective dofs, 0 otherwise.