How do Periodic Boundary Conditions work in FEniCS?

I am executing PBCs on a square RVE of dimension 1 x 1with linear elasticity, my code is as follows

tol_0 = 1E-14
tol_1 = 0.99999999999
class PeriodicBoundary(SubDomain):

    # Left boundary is "target domain" G
    def inside(self, x, on_boundary):
        return bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)

    # Map right boundary (H) to left boundary (G)
    def map(self, x, y):
        y[0] = x[0] - 1
        y[1] = x[1]

# Create periodic boundary condition
pbc = PeriodicBoundary()

V = VectorFunctionSpace(mesh, "P", 2, constrained_domain=pbc)
#mu = 1
#lambda_ = 1.25
mu_values = [0.1,0.9]
lam_values = [1, 5]
mu  = Function(V)
lam = Function(V)
for cell_no in range(len(cell_markers.array())):
    subdomain_no = cell_markers.array()[cell_no]
    #print(subdomain_no)
    subdomain_no = int(subdomain_no-1)
    #print(subdomain_no)
    mu.vector()[cell_no] = mu_values[subdomain_no]
    lam.vector()[cell_no] = lam_values[subdomain_no]

def clamped_boundary_bottom(x, tol):
    return (x[1] < tol_0)
bc_bottom = DirichletBC(V, Constant((0.0, 0.0)), clamped_boundary_bottom)

def clamped_boundary_top(x, on_boundary):
    return (x[1] > tol_1)
bc_top = DirichletBC(V, Constant((0.0, 0.0)), clamped_boundary_top)

def free_boundary(x, on_boundary):
    return (x[1] > tol_1)
bc_free = DirichletBC(V, Constant((0.3,0)), free_boundary)
bcs = [bc_bottom, bc_free]

def epsilon(u):
    return 0.5*(nabla_grad(u) + (nabla_grad(u).T))

I specifically wish to understand the following piece of code , which I got from the periodic Poisson example

class PeriodicBoundary(SubDomain):

    # Left boundary is "target domain" G
    def inside(self, x, on_boundary):
        return bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)

    # Map right boundary (H) to left boundary (G)
    def map(self, x, y):
        y[0] = x[0] - 1
        y[1] = x[1]

# Create periodic boundary condition
pbc = PeriodicBoundary()

V = VectorFunctionSpace(mesh, "P", 2, constrained_domain=pbc)

How exactly is FEniCS mapping the ‘displacements’ , in both x and y directions here and executing the periodic boundary condition?

Also in following image, why are the corner nodes on the top left fixed, while those on the top right are displaced, even though I’ve fixed the top boundary?