# Williamson ether synthesis

## Status

specified-next: ready to implement as v2 guarded owner-vector rules.

## Scope

- substrate: Alkoxide plus alkyl chloride in a minimal SN2-like model.
- product: Ether plus chloride lone-pair product.
- note: Specified as primitive HEG ownership moves using O, C, H, and Cl labels supported by the current code.

## HEG v2 State Sketches

These panels are rendered from ownership-structured HEG v2 objects. For `specified-next` examples they are state sketches, not yet products of executable v2 rules.

### Williamson substrate HEG sketch

![Williamson substrate HEG sketch](heg_states/williamson_start.png)

Alkoxide-like oxygen plus methyl chloride.

### Williamson route step 1

![Williamson route step 1](heg_states/williamson_step1_attack.png)

Primitive snapshot: alkoxide lone pair has become an O-C shared pair.

### Williamson route product

![Williamson route product](heg_states/williamson_product.png)

O-C sigma pair formed and C-Cl pair converted to chloride lone pair.

## DPO-like Step Panels

Each primitive snapshot is shown as `L/K/R`. Red marks the ownership edge removed from `L`, orange marks the halfedge whose owner changes, and green marks the ownership edge created in `R`. `K` keeps the common atoms, halfedges, pair objects, and unchanged ownership records. For `specified-next` examples this is an explanatory span derived from route snapshots, not yet a checked executable rule application.

### Williamson route step 1

Williamson substrate HEG sketch -> Williamson route step 1

Changed ownership: `h4: a1 -> a3`

| L | K | R |
|---|---|---|
| ![L](heg_steps/williamson_main_step1_left.png) | ![K](heg_steps/williamson_main_step1_interface.png) | ![R](heg_steps/williamson_main_step1_right.png) |

### Williamson route step 2

Williamson route step 1 -> Williamson route product

Changed ownership: `h9: a3 -> a4`

| L | K | R |
|---|---|---|
| ![L](heg_steps/williamson_main_step2_left.png) | ![K](heg_steps/williamson_main_step2_interface.png) | ![R](heg_steps/williamson_main_step2_right.png) |

## Reaction Sketch

![Williamson ether synthesis reaction sketch](reaction_scheme.png)

## Mechanism Flow

![Williamson ether synthesis mechanism flow](mechanism_flow.png)

## Primitive HEG Patterns Used

| pattern | invariant |
|---|---|
| lone pair to shared pair | Halfedge and pair identity are preserved; exactly one Ownership record changes. |
| shared pair to lone pair | Halfedge and pair identity are preserved; exactly one Ownership record changes. |

## Mechanism Steps

### alkoxide lone pair forms O-C sigma pair

- group: SN2 substitution
- primitive: lone pair to shared pair
- resource move: `LP(O_alkoxide) -> sigma(O_alkoxide,C_alkyl)`
- roles: donor: O_alkoxide; acceptor: C_alkyl
- guard note: requires alkoxide lone pair and no existing O-C shared pair
- executable note: -

### C-Cl sigma pair becomes chloride lone pair

- group: leaving group departure
- primitive: shared pair to lone pair
- resource move: `sigma(C_alkyl,Cl) -> LP(Cl)`
- roles: moved endpoint: C_alkyl -> Cl
- guard note: requires C-Cl leaving-group bond
- executable note: -

## Guard Checklist

- substrate carbon should be electrophilic alkyl carbon with leaving group.
- nucleophile oxygen must be alkoxide-like and not already bonded to the alkyl carbon.
- E2 elimination is not this rule; it must be a competing guarded rule.

## Alternative Route Probes

- SN2 substitution vs E2 elimination is the main nontrivial route search once a beta-H abstraction rule is added.
- Ambident nucleophiles would give O- vs C-alkylation alternatives.

## Expansion

No expansion yet; this is a good next target because alternatives are chemically real rather than mere symmetry.

## Interpretation

The chemical rule is treated as a guarded composite of primitive HEG moves. The primitive move tells us what is composable at the electron-resource level; the guards say when that move has the intended chemical meaning.
