Repository: PennyLaneAI/pennylane (python)

Issue:
Add a `work_wires` attribute to `GroverOperator`
### Feature details

Add an attribute to `GroverOperator` that outputs its `work_wires`. Similar to `MultiControlledX`:

```
🍞 op = qml.MultiControlledX(wires=[0, 1, 2 ,3], work_wires=[4, 5])
🍞 op.work_wires
Wires([4, 5])
```

### Implementation

🦗 

### How important would you say this feature is?

1: Not important. Would be nice to have.

### Additional information

_No response_

Pull request:
Add `work_wires` property to `GroverOperator`
**Context:**

`qml.GroverOperator` now has a `work_wires` property similar to `MultiControlledX`.

**Benefits:** Nice to have.

**Possible Drawbacks:** None identified.

**Related GitHub Issues:** Fixes #6591 

[sc-78409]


Patch:
diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md
index 8df2567e3..b2a3d3c32 100644
--- a/doc/releases/changelog-dev.md
+++ b/doc/releases/changelog-dev.md
@@ -341,6 +341,9 @@ such as `shots`, `rng` and `prng_key`.
 
 <h4>Other Improvements</h4>
 
+* `qml.GroverOperator` now has a `work_wires` property.
+  [(#6738)](https://github.com/PennyLaneAI/pennylane/pull/6738)
+
 * `Wires` object usage across Pennylane source code has been tidied up.
   [(#6689)](https://github.com/PennyLaneAI/pennylane/pull/6689)
 
diff --git a/pennylane/templates/subroutines/grover.py b/pennylane/templates/subroutines/grover.py
index 1d051fd3f..938db918d 100644
--- a/pennylane/templates/subroutines/grover.py
+++ b/pennylane/templates/subroutines/grover.py
@@ -123,6 +123,11 @@ class GroverOperator(Operation):
 
         super().__init__(wires=wires, id=id)
 
+    @property
+    def work_wires(self):
+        """Additional auxiliary wires that can be used in the decomposition of :class:`~.MultiControlledX`."""
+        return self.hyperparameters["work_wires"]
+
     @property
     def num_params(self):
         return 0


Test patch:
diff --git a/tests/templates/test_subroutines/test_grover.py b/tests/templates/test_subroutines/test_grover.py
index 4839f9cc6..c7ca2a87d 100644
--- a/tests/templates/test_subroutines/test_grover.py
+++ b/tests/templates/test_subroutines/test_grover.py
@@ -31,6 +31,12 @@ def test_repr():
     assert repr(op) == expected
 
 
+def test_work_wire_property():
+    op = qml.GroverOperator(wires=(0, 1, 2), work_wires=(3, 4))
+    expected = qml.wires.Wires((3, 4))
+    assert op.work_wires == expected
+
+
 def test_standard_validity():
     """Test the standard criteria for a valid operation."""
     work_wires = qml.wires.Wires((3, 4))