Break a loop that shows up with Keyed Unification

Without keyed unification, `rewrite` inferred that a particular endpoint
of a particular path was `((1 ∘ x ∘ 1) x2)`.  However, in the goal, this
endpoint was passed as (the judgmentally equivalent) `x2`.  So after
`rewrite` finished filling in its holes, it couldn't find the subterm
anymore, breaking the loop.  With keyed unification, it can find the
subterm, so the rewrite loops.
Factor out transport_to_ap
Merge pull request #554 from JasonGross/break-keyed-unification-loop

Break a loop that shows up with Keyed Unification
Work around bug(?) 3703

This is https://coq.inria.fr/bugs/show_bug.cgi?id=3703, [rewrite] with
Keyed Unification fails to unfold some things that [rewrite] with
unkeyed unification unfolds
Set Keyed Unification and bump Coq submodule

Bumping the submodule gives us some keyed unification and primitive
projection fixes.

This closes #531 and #557.

The comment on the [Set Keyed Unification] directive was written by Mike
Shulman.

Note that we get a host of errors if we bump the submodule without
setting keyed unification; the current version of Coq doesn't attempt to
make [rewrite] work correctly in the presence of primitive projections
without [Set Keyed Unification].

Unfortunately, a few files got significantly slower.

After    | File Name                                                 | Before   || Change
--------------------------------------------------------------------------------------------
3m24.60s | Total                                                     | 2m29.87s || +0m54.73s
--------------------------------------------------------------------------------------------
0m18.80s | categories/Adjoint/Composition/AssociativityLaw           | 0m02.79s || +0m16.01s
0m10.17s | categories/Pseudofunctor/Identity                         | 0m01.01s || +0m09.16s
0m19.13s | categories/ExponentialLaws/Law2/Law                       | 0m12.68s || +0m06.44s
0m11.80s | categories/LaxComma/CoreLaws                              | 0m05.74s || +0m06.06s
0m15.94s | categories/ExponentialLaws/Law3/Law                       | 0m11.32s || +0m04.61s
0m05.03s | categories/Pseudofunctor/FromFunctor                      | 0m01.14s || +0m03.89s
0m03.80s | categories/Adjoint/Composition/IdentityLaws               | 0m01.48s || +0m02.31s
0m12.10s | categories/ExponentialLaws/Law4/Law                       | 0m13.85s || -0m01.75s
0m11.32s | hit/V                                                     | 0m09.99s || +0m01.33s
0m03.40s | categories/Functor/Sum                                    | 0m01.65s || +0m01.75s
0m02.07s | categories/Adjoint/Composition/Core                       | 0m00.88s || +0m01.18s
0m07.15s | categories/Comma/ProjectionFunctors                       | 0m06.70s || +0m00.45s
0m04.04s | categories/Comma/Functorial                               | 0m04.04s || +0m00.00s
0m02.72s | categories/Grothendieck/PseudofunctorToCat                | 0m01.76s || +0m00.96s
0m02.68s | categories/GroupoidCategory/Morphisms                     | 0m02.85s || -0m00.16s
0m02.44s | hit/Flattening                                            | 0m02.76s || -0m00.31s
0m02.43s | categories/ExponentialLaws/Law4/Functors                  | 0m02.04s || +0m00.39s
0m02.41s | contrib/Freudenthal                                       | 0m03.11s || -0m00.69s
0m02.20s | ReflectiveSubuniverse                                     | 0m02.30s || -0m00.09s
0m01.98s | categories/Pseudofunctor/RewriteLaws                      | 0m01.26s || +0m00.72s
0m01.88s | categories/ExponentialLaws/Law1/Law                       | 0m01.13s || +0m00.75s
0m01.79s | categories/Category/Morphisms                             | 0m01.66s || +0m00.13s
0m01.63s | categories/UniversalProperties                            | 0m01.57s || +0m00.05s
0m01.54s | categories/Functor/Pointwise/Properties                   | 0m01.48s || +0m00.06s
0m01.51s | categories/Adjoint/HomCoercions                           | 0m01.60s || -0m00.09s
0m01.49s | hit/epi                                                   | 0m01.52s || -0m00.03s
0m01.40s | categories/Adjoint/UnitCounitCoercions                    | 0m01.12s || +0m00.27s
0m01.36s | categories/Category/Sigma/OnMorphisms                     | 0m00.86s || +0m00.50s
0m01.31s | categories/Comma/InducedFunctors                          | 0m01.26s || +0m00.05s
0m01.10s | categories/Yoneda                                         | 0m01.12s || -0m00.02s
0m00.94s | Basics/PathGroupoids                                      | 0m00.94s || +0m00.00s
0m00.94s | categories/Functor/Composition/Functorial/Attributes      | 0m00.96s || -0m00.02s
0m00.92s | categories/Comma/Core                                     | 0m00.60s || +0m00.32s
0m00.86s | contrib/HoTTBook                                          | 0m00.84s || +0m00.02s
0m00.84s | HSet                                                      | 0m00.90s || -0m00.06s
0m00.84s | Basics/Equivalences                                       | 0m01.12s || -0m00.28s
0m00.82s | categories/LaxComma/CoreParts                             | 0m00.62s || +0m00.19s
0m00.82s | HProp                                                     | 0m00.80s || +0m00.01s
0m00.79s | categories/Functor/Paths                                  | 0m00.66s || +0m00.13s
0m00.73s | types/Sigma                                               | 0m00.82s || -0m00.08s
0m00.71s | hit/Connectedness                                         | 0m00.75s || -0m00.04s
0m00.68s | categories/Comma/Dual                                     | 0m00.70s || -0m00.01s
0m00.66s | categories/Functor/Prod/Universal                         | 0m00.58s || +0m00.08s
0m00.65s | categories/Category/Sum                                   | 0m00.64s || +0m00.01s
0m00.64s | categories/LaxComma/Core                                  | 0m00.62s || +0m00.02s
0m00.64s | categories/Functor/Composition/Functorial/Core            | 0m00.62s || +0m00.02s
0m00.63s | categories/ProductLaws                                    | 0m00.64s || -0m00.01s
0m00.63s | EquivalenceVarieties                                      | 0m00.66s || -0m00.03s
0m00.63s | categories/Structure/IdentityPrinciple                    | 0m00.56s || +0m00.06s
0m00.60s | contrib/HoTTBookExercises                                 | 0m00.60s || +0m00.00s
0m00.59s | categories/Limits/Core                                    | 0m00.61s || -0m00.02s
0m00.58s | categories/Category/Sigma/Core                            | 0m00.55s || +0m00.02s
0m00.54s | categories/ExponentialLaws/Law0                           | 0m00.53s || +0m00.01s
0m00.54s | hit/Spheres                                               | 0m00.59s || -0m00.04s
0m00.52s | Modality                                                  | 0m00.55s || -0m00.03s
0m00.49s | categories/NaturalTransformation/Isomorphisms             | 0m00.60s || -0m00.10s
0m00.48s | hit/quotient                                              | 0m00.41s || +0m00.07s
0m00.47s | categories/Functor/Attributes                             | 0m00.47s || +0m00.00s
0m00.47s | categories/DualFunctor                                    | 0m00.46s || +0m00.00s
0m00.45s | types/Paths                                               | 0m00.48s || -0m00.02s
0m00.45s | categories/InitialTerminalCategory/Pseudofunctors         | 0m00.42s || +0m00.03s
0m00.44s | hit/PropositionalFracture                                 | 0m00.42s || +0m00.02s
0m00.44s | categories/Adjoint/UniversalMorphisms                     | 0m00.38s || +0m00.06s
0m00.42s | categories/ExponentialLaws/Law1/Functors                  | 0m00.37s || +0m00.04s
0m00.41s | categories/Adjoint/Paths                                  | 0m00.29s || +0m00.12s
0m00.40s | types/Prod                                                | 0m00.37s || +0m00.03s
0m00.40s | categories/SetCategory/Morphisms                          | 0m00.38s || +0m00.02s
0m00.38s | categories                                                | 0m00.47s || -0m00.08s
0m00.36s | categories/ExponentialLaws/Law2/Functors                  | 0m00.34s || +0m00.01s
0m00.35s | categories/FunctorCategory/Morphisms                      | 0m00.30s || +0m00.04s
0m00.33s | categories/Functor/Pointwise/Core                         | 0m00.41s || -0m00.07s
0m00.32s | categories/Limits/Functors                                | 0m00.34s || -0m00.02s
0m00.32s | categories/KanExtensions/Functors                         | 0m00.24s || +0m00.08s
0m00.31s | types/Universe                                            | 0m00.28s || +0m00.02s
0m00.31s | hit/Circle                                                | 0m00.32s || -0m00.01s
0m00.31s | categories/FunctorCategory/Dual                           | 0m00.25s || +0m00.06s
0m00.31s | categories/Functor/Prod/Core                              | 0m00.29s || +0m00.02s
0m00.30s | categories/NaturalTransformation/Paths                    | 0m00.25s || +0m00.04s
0m00.30s | categories/Functor/Prod/Functorial                        | 0m00.33s || -0m00.03s
0m00.28s | categories/NaturalTransformation/Prod                     | 0m00.23s || +0m00.05s
0m00.28s | categories/HomFunctor                                     | 0m00.30s || -0m00.01s
0m00.27s | categories/NaturalTransformation/Pointwise                | 0m00.27s || +0m00.00s
0m00.26s | types/Sum                                                 | 0m00.31s || -0m00.04s
0m00.26s | categories/NaturalTransformation/Composition/Laws         | 0m00.24s || +0m00.02s
0m00.26s | ObjectClassifier                                          | 0m00.27s || -0m00.01s
0m00.26s | categories/InitialTerminalCategory/Functors               | 0m00.27s || -0m00.01s
0m00.26s | hit/Join                                                  | 0m00.28s || -0m00.02s
0m00.24s | categories/FundamentalPreGroupoidCategory                 | 0m00.24s || +0m00.00s
0m00.24s | categories/Grothendieck/ToSet                             | 0m00.27s || -0m00.03s
0m00.24s | categories/Category/Sigma/OnObjects                       | 0m00.21s || +0m00.03s
0m00.24s | categories/CategoryOfSections/Core                        | 0m00.14s || +0m00.09s
0m00.24s | categories/Pseudofunctor/Core                             | 0m00.24s || +0m00.00s
0m00.23s | categories/IndiscreteCategory                             | 0m00.18s || +0m00.05s
0m00.23s | categories/PseudonaturalTransformation/Core               | 0m00.24s || -0m00.00s
0m00.23s | categories/KanExtensions/Core                             | 0m00.24s || -0m00.00s
0m00.23s | categories/Comma/Projection                               | 0m00.22s || +0m00.01s
0m00.22s | categories/Notations                                      | 0m00.20s || +0m00.01s
0m00.22s | hit/Suspension                                            | 0m00.19s || +0m00.03s
0m00.22s | Tactics                                                   | 0m00.20s || +0m00.01s
0m00.22s | types/Forall                                              | 0m00.22s || +0m00.00s
0m00.21s | categories/Cat/Core                                       | 0m00.18s || +0m00.03s
0m00.21s | categories/FunctorCategory/Functorial                     | 0m00.24s || -0m00.03s
0m00.20s | categories/ExponentialLaws/Law3/Functors                  | 0m00.20s || +0m00.00s
0m00.20s | types/Arrow                                               | 0m00.15s || +0m00.05s
0m00.20s | categories/Structure/Core                                 | 0m00.23s || -0m00.03s
0m00.20s | categories/Adjoint/UnitCounit                             | 0m00.15s || +0m00.05s
0m00.19s | UnivalenceImpliesFunext                                   | 0m00.17s || +0m00.01s
0m00.19s | categories/Category/Prod                                  | 0m00.20s || -0m00.01s
0m00.19s | categories/Adjoint/Hom                                    | 0m00.16s || +0m00.03s
0m00.19s | categories/Utf8                                           | 0m00.17s || +0m00.01s
0m00.19s | Basics/Fibrations                                         | 0m00.20s || -0m00.01s
0m00.18s | hit/Pushout                                               | 0m00.17s || +0m00.00s
0m00.18s | categories/Functor/Composition/Laws                       | 0m00.15s || +0m00.03s
0m00.18s | categories/Functor                                        | 0m00.17s || +0m00.00s
0m00.18s | hit/Truncations                                           | 0m00.16s || +0m00.01s
0m00.17s | Basics/Overture                                           | 0m00.16s || +0m00.01s
0m00.17s | categories/Comma                                          | 0m00.13s || +0m00.04s
0m00.17s | categories/Adjoint                                        | 0m00.18s || -0m00.00s
0m00.17s | categories/Cat/Morphisms                                  | 0m00.14s || +0m00.03s
0m00.17s | categories/NaturalTransformation/Composition/Core         | 0m00.20s || -0m00.03s
0m00.16s | categories/HomotopyPreCategory                            | 0m00.16s || +0m00.00s
0m00.16s | HoTT                                                      | 0m00.12s || +0m00.04s
0m00.16s | categories/NaturalTransformation/Sum                      | 0m00.15s || +0m00.01s
0m00.16s | categories/Pseudofunctor                                  | 0m00.12s || +0m00.04s
0m00.16s | categories/LaxComma/Utf8                                  | 0m00.18s || -0m00.01s
0m00.16s | categories/NaturalTransformation/Identity                 | 0m00.12s || +0m00.04s
0m00.16s | categories/Functor/Composition                            | 0m00.13s || +0m00.03s
0m00.15s | categories/Functor/Composition/Functorial                 | 0m00.18s || -0m00.03s
0m00.15s | categories/LaxComma/Notations                             | 0m00.13s || +0m00.01s
0m00.15s | categories/LaxComma                                       | 0m00.14s || +0m00.00s
0m00.15s | Basics/Trunc                                              | 0m00.16s || -0m00.01s
0m00.15s | categories/Functor/Utf8                                   | 0m00.13s || +0m00.01s
0m00.15s | categories/Functor/Notations                              | 0m00.16s || -0m00.01s
0m00.15s | categories/NaturalTransformation/Notations                | 0m00.10s || +0m00.04s
0m00.15s | types/Bool                                                | 0m00.15s || +0m00.00s
0m00.15s | categories/NaturalTransformation/Composition/Functorial   | 0m00.14s || +0m00.00s
0m00.14s | categories/InitialTerminalCategory/NaturalTransformations | 0m00.16s || -0m00.01s
0m00.14s | hit/iso                                                   | 0m00.10s || +0m00.04s
0m00.14s | Functorish                                                | 0m00.11s || +0m00.03s
0m00.14s | categories/Grothendieck                                   | 0m00.14s || +0m00.00s
0m00.14s | Basics/FunextVarieties                                    | 0m00.11s || +0m00.03s
0m00.14s | categories/NaturalTransformation/Utf8                     | 0m00.15s || -0m00.00s
0m00.13s | categories/Adjoint/Dual                                   | 0m00.08s || +0m00.05s
0m00.13s | categories/Category                                       | 0m00.15s || -0m00.01s
0m00.13s | categories/FunctorCategory/Utf8                           | 0m00.13s || +0m00.00s
0m00.13s | categories/PseudonaturalTransformation                    | 0m00.08s || +0m00.05s
0m00.13s | categories/NaturalTransformation/Dual                     | 0m00.06s || +0m00.07s
0m00.13s | categories/FunctorCategory                                | 0m00.13s || +0m00.00s
0m00.13s | categories/NaturalTransformation                          | 0m00.12s || +0m00.01s
0m00.13s | categories/Adjoint/Composition                            | 0m00.10s || +0m00.03s
0m00.12s | Conjugation                                               | 0m00.13s || -0m00.01s
0m00.12s | categories/DependentProduct                               | 0m00.16s || -0m00.04s
0m00.12s | categories/ExponentialLaws/Law3                           | 0m00.11s || +0m00.00s
0m00.12s | categories/Grothendieck/ToCat                             | 0m00.15s || -0m00.03s
  N/A    | coq/Init/Peano                                            | 0m00.12s || -0m00.12s
0m00.12s | TruncType                                                 | 0m00.16s || -0m00.04s
0m00.12s | categories/GroupoidCategory/Core                          | 0m00.12s || +0m00.00s
0m00.12s | categories/KanExtensions                                  | 0m00.12s || +0m00.00s
0m00.12s | Tests                                                     | 0m00.13s || -0m00.01s
0m00.12s | types/Unit                                                | 0m00.12s || +0m00.00s
0m00.12s | categories/Limits                                         | 0m00.14s || -0m00.02s
0m00.11s | categories/Comma/Utf8                                     | 0m00.09s || +0m00.02s
0m00.11s | categories/Cat                                            | 0m00.08s || +0m00.03s
0m00.11s | categories/ExponentialLaws                                | 0m00.14s || -0m00.03s
0m00.11s | categories/InitialTerminalCategory                        | 0m00.08s || +0m00.03s
0m00.11s | categories/Category/Objects                               | 0m00.14s || -0m00.03s
0m00.11s | categories/NatCategory                                    | 0m00.14s || -0m00.03s
0m00.11s | categories/SetCategory                                    | 0m00.07s || +0m00.03s
0m00.11s | categories/SetCategory/Functors/SetProp                   | 0m00.11s || +0m00.00s
0m00.11s | Utf8                                                      | 0m00.13s || -0m00.02s
0m00.11s | categories/FunctorCategory/Core                           | 0m00.13s || -0m00.02s
0m00.10s | categories/Adjoint/Utf8                                   | 0m00.14s || -0m00.04s
0m00.10s | categories/Profunctor/Core                                | 0m00.08s || +0m00.02s
0m00.10s | hit/Interval                                              | 0m00.12s || -0m00.01s
0m00.10s | categories/Profunctor                                     | 0m00.12s || -0m00.01s
0m00.10s | categories/SetCategory/Core                               | 0m00.10s || +0m00.00s
0m00.10s | categories/Profunctor/Notations                           | 0m00.09s || +0m00.01s
0m00.10s | categories/InitialTerminalCategory/Core                   | 0m00.10s || +0m00.00s
0m00.10s | categories/CategoryOfGroupoids                            | 0m00.13s || -0m00.03s
0m00.10s | categories/Adjoint/Notations                              | 0m00.12s || -0m00.01s
0m00.10s | categories/CategoryOfSections                             | 0m00.07s || +0m00.03s
0m00.10s | categories/Category/Univalent                             | 0m00.12s || -0m00.01s
0m00.10s | categories/InitialTerminalCategory/Notations              | 0m00.11s || -0m00.00s
0m00.10s | categories/Profunctor/Representable                       | 0m00.12s || -0m00.01s
0m00.10s | categories/Structure                                      | 0m00.11s || -0m00.00s
0m00.10s | categories/Category/Core                                  | 0m00.09s || +0m00.01s
0m00.10s | hit/TwoSphere                                             | 0m00.08s || +0m00.02s
0m00.10s | categories/Structure/Utf8                                 | 0m00.08s || +0m00.02s
0m00.10s | categories/Adjoint/Composition/LawsTactic                 | 0m00.09s || +0m00.01s
0m00.10s | categories/Category/Pi                                    | 0m00.12s || -0m00.01s
0m00.09s | categories/Category/Utf8                                  | 0m00.10s || -0m00.01s
0m00.09s | categories/ExponentialLaws/Law1                           | 0m00.12s || -0m00.03s
0m00.09s | categories/ExponentialLaws/Law2                           | 0m00.08s || +0m00.00s
0m00.09s | categories/Category/Subcategory                           | 0m00.06s || +0m00.03s
0m00.09s | Misc                                                      | 0m00.11s || -0m00.02s
0m00.09s | hit/unique_choice                                         | 0m00.12s || -0m00.03s
0m00.09s | categories/NaturalTransformation/Composition              | 0m00.10s || -0m00.01s
0m00.09s | categories/GroupoidCategory                               | 0m00.08s || +0m00.00s
0m00.09s | categories/Profunctor/Utf8                                | 0m00.08s || +0m00.00s
0m00.08s | categories/DiscreteCategory                               | 0m00.09s || -0m00.00s
0m00.08s | categories/Adjoint/Core                                   | 0m00.09s || -0m00.00s
0m00.08s | categories/SetCategory/Functors                           | 0m00.09s || -0m00.00s
0m00.08s | categories/Functor/Dual                                   | 0m00.09s || -0m00.00s
0m00.08s | coq/Init/Specif                                           | 0m00.05s || +0m00.03s
0m00.08s | categories/Category/Dual                                  | 0m00.08s || +0m00.00s
0m00.08s | categories/ExponentialLaws/Law4                           | 0m00.09s || -0m00.00s
0m00.08s | hit/IntervalImpliesFunext                                 | 0m00.06s || +0m00.02s
0m00.08s | categories/Adjoint/Identity                               | 0m00.09s || -0m00.00s
0m00.08s | categories/Functor/Core                                   | 0m00.07s || +0m00.00s
0m00.08s | categories/Functor/Pointwise                              | 0m00.10s || -0m00.02s
0m00.08s | categories/Functor/Prod                                   | 0m00.11s || -0m00.03s
0m00.08s | types/Record                                              | 0m00.13s || -0m00.05s
0m00.08s | categories/NaturalTransformation/Core                     | 0m00.12s || -0m00.03s
0m00.08s | categories/Functor/Composition/Core                       | 0m00.07s || +0m00.00s
0m00.08s | Tactics/BinderApply                                       | 0m00.08s || +0m00.00s
0m00.08s | categories/Category/Notations                             | 0m00.08s || +0m00.00s
0m00.08s | categories/Category/Subcategory/Full                      | 0m00.08s || +0m00.00s
0m00.07s | categories/Functor/Identity                               | 0m00.06s || +0m00.01s
0m00.07s | categories/Comma/Notations                                | 0m00.11s || -0m00.03s
0m00.07s | categories/Category/Subcategory/Wide                      | 0m00.08s || -0m00.00s
0m00.07s | coq/Init/Logic_Type                                       | 0m00.06s || +0m00.01s
0m00.07s | UnivalenceAxiom                                           | 0m00.06s || +0m00.01s
0m00.07s | categories/FunctorCategory/Notations                      | 0m00.08s || -0m00.00s
0m00.07s | types/Empty                                               | 0m00.08s || -0m00.00s
0m00.06s | categories/Category/Sigma                                 | 0m00.07s || -0m00.01s
0m00.06s | coq/Init/Datatypes                                        | 0m00.05s || +0m00.00s
0m00.06s | categories/Category/Strict                                | 0m00.06s || +0m00.00s
0m00.06s | Basics/Contractible                                       | 0m00.10s || -0m00.04s
0m00.06s | Basics/Pointed                                            | 0m00.06s || +0m00.00s
0m00.06s | categories/Profunctor/Identity                            | 0m00.11s || -0m00.05s
0m00.06s | coq/Program/Tactics                                       | 0m00.07s || -0m00.01s
0m00.06s | FunextAxiom                                               | 0m00.04s || +0m00.01s
0m00.05s | coq/Init/Notations                                        | 0m00.03s || +0m00.02s
0m00.05s | categories/Structure/Notations                            | 0m00.09s || -0m00.03s
0m00.04s | Basics/UniverseLevel                                      | 0m00.05s || -0m00.01s
0m00.04s | coq/Init/Logic                                            | 0m00.04s || +0m00.00s
0m00.04s | coq/Unicode/Utf8_core                                     | 0m00.04s || +0m00.00s
0m00.04s | coq/Init/Prelude                                          | 0m00.04s || +0m00.00s
0m00.04s | coq/Init/Tactics                                          | 0m00.02s || +0m00.02s
0m00.04s | Basics                                                    | 0m00.07s || -0m00.03s
0m00.03s | coq/Unicode/Utf8                                          | 0m00.02s || +0m00.00s
0m00.02s | coq/Bool/Bool                                             | 0m00.04s || -0m00.02s
Add [simpl erewrite] variants of [simpl rewrite]

Done by copy/paste and s/rewrite/erewrite and s/constr/open_constr/

WIP

WIP
t

WIP

Correct error number

WIP

WIP

Bug 3668 fixed

Minimize diff

WIP

WIP
https://coq.inria.fr/bugs/show_bug.cgi?id=3698
WIP