Repository: Qiskit/qiskit

Issue:
Documentation of `is_good_state` parameter of AmplificationProblem is misleading
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues to confirm this idea does not exist. -->

Acconrding to the constructor of [AmplificationProblem](https://qiskit.org/documentation/stubs/qiskit.algorithms.AmplificationProblem.html), the kwarg `is_good_state` is optional, when it fact, it is required.

Usage without `is_good_state` results in `AttributeError: 'NoneType' object has no attribute 'probabilities_dict'`

Reproduce (with qiskit-terra 0.18.0 installed from main branch)
```python3
from qiskit.algorithms import Grover
from qiskit.algorithms import AmplificationProblem
from qiskit.circuit.library import PhaseOracle
from qiskit import BasicAer

input_3sat_instance = '''
c example DIMACS-CNF 3-SAT
p cnf 3 5
-1 -2 -3 0
1 -2 3 0
1 2 -3 0
1 -2 -3 0
-1 2 3 0
'''
with open('dimacs_file.txt', 'w') as fd:
    fd.write(input_3sat_instance)

backend = BasicAer.get_backend('qasm_simulator')
oracle = PhaseOracle.from_dimacs_file('dimacs_file.txt')
grover = Grover(quantum_instance=backend)
problem = AmplificationProblem(oracle)
## following line solves the error
#problem = AmplificationProblem(oracle, is_good_state=oracle.evaluate_bitstring)
result = grover.amplify(problem)

print(result.assignment)
```

### What is the expected enhancement?

Either change the type hint to reflect the requirement or make it actually optional.
See, e.g. the slack comment https://qiskit.slack.com/archives/C7SS31917/p1620999677245200?thread_ts=1620994583.241400&cid=C7SS31917 by @mtreinish 


Discussion:

Resolving patch:
diff --git a/qiskit/algorithms/amplitude_amplifiers/amplification_problem.py b/qiskit/algorithms/amplitude_amplifiers/amplification_problem.py
--- a/qiskit/algorithms/amplitude_amplifiers/amplification_problem.py
+++ b/qiskit/algorithms/amplitude_amplifiers/amplification_problem.py
@@ -50,14 +50,25 @@ def __init__(
             objective_qubits: If set, specifies the indices of the qubits that should be measured.
                 If None, all qubits will be measured. The ``is_good_state`` function will be
                 applied on the measurement outcome of these qubits.
-            is_good_state: A function to check whether a string represents a good state.
+            is_good_state: A function to check whether a string represents a good state. By default
+                if the ``oracle`` argument has an ``evaluate_bitstring`` method (currently only
+                provided by the :class:`~qiskit.circuit.library.PhaseOracle` class) this will be
+                used, otherwise this kwarg is required and **must** be specified.
+
+        Raises:
+            TypeError: if ``is_good_state`` is not provided and is required
         """
         self._oracle = oracle
         self._state_preparation = state_preparation
         self._grover_operator = grover_operator
         self._post_processing = post_processing
         self._objective_qubits = objective_qubits
-        self._is_good_state = is_good_state
+        if is_good_state is not None:
+            self._is_good_state = is_good_state
+        elif hasattr(oracle, "evaluate_bitstring"):
+            self._is_good_state = oracle.evaluate_bitstring
+        else:
+            raise TypeError("A is_good_state function is required with the " "provided oracle")
 
     @property
     def oracle(self) -> Union[QuantumCircuit, Statevector]:


Test patch:
diff --git a/test/python/algorithms/test_grover.py b/test/python/algorithms/test_grover.py
--- a/test/python/algorithms/test_grover.py
+++ b/test/python/algorithms/test_grover.py
@@ -21,7 +21,7 @@
 from qiskit import BasicAer, QuantumCircuit
 from qiskit.utils import QuantumInstance
 from qiskit.algorithms import Grover, AmplificationProblem
-from qiskit.circuit.library import GroverOperator
+from qiskit.circuit.library import GroverOperator, PhaseOracle
 from qiskit.quantum_info import Operator, Statevector
 
 
@@ -42,12 +42,14 @@ def test_groverop_getter(self, kind):
         oracle.cz(0, 1)
 
         if kind == "oracle_only":
-            problem = AmplificationProblem(oracle)
+            problem = AmplificationProblem(oracle, is_good_state=["11"])
             expected = GroverOperator(oracle)
         else:
             stateprep = QuantumCircuit(2)
             stateprep.ry(0.2, [0, 1])
-            problem = AmplificationProblem(oracle, state_preparation=stateprep)
+            problem = AmplificationProblem(
+                oracle, state_preparation=stateprep, is_good_state=["11"]
+            )
             expected = GroverOperator(oracle, stateprep)
 
         self.assertEqual(Operator(expected), Operator(problem.grover_operator))
@@ -93,6 +95,14 @@ def setUp(self):
             BasicAer.get_backend("qasm_simulator"), seed_simulator=12, seed_transpiler=32
         )
 
+    def test_implicit_phase_oracle_is_good_state(self):
+        """Test implicit default for is_good_state with PhaseOracle."""
+        grover = Grover(iterations=2, quantum_instance=self.statevector)
+        oracle = PhaseOracle("x | x")
+        problem = AmplificationProblem(oracle)
+        result = grover.amplify(problem)
+        self.assertEqual(result.top_measurement, "0")
+
     def test_fixed_iterations(self):
         """Test the iterations argument"""
         grover = Grover(iterations=2, quantum_instance=self.statevector)
@@ -197,7 +207,7 @@ def test_construct_circuit(self):
         """Test construct_circuit"""
         oracle = QuantumCircuit(2)
         oracle.cz(0, 1)
-        problem = AmplificationProblem(oracle)
+        problem = AmplificationProblem(oracle, is_good_state=["11"])
         grover = Grover()
         constructed = grover.construct_circuit(problem, 2, measurement=False)