Built with Alectryon, running Coq+SerAPI v8.19.0+0.19.3. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
(** * Miscellaneous helper tactics for proving exponential laws *)
[Loading ML file number_string_notation_plugin.cmxs (using legacy method) ... done]
Require Import Functor.Paths NaturalTransformation.Paths.Require Import HoTT.Tactics Basics.PathGroupoids Types.Forall Types.Prod.(** These are probably more general than just exponential laws, but I haven't tried them more widely, yet. *)(** Miscellaneous tactics to try *)Ltacexp_laws_misc_t' :=
idtac;
match goal with
| _ => reflexivity
| _ => progressintros
| _ => progresssimplin *
| _ => apply (@path_forall _); intro
| _ => rewrite !identity_of
| _ => progressautorewrite with morphism
end.(** Safe transformations to simplify complex types in the hypotheses or goal *)Ltacexp_laws_simplify_types' :=
idtac;
match goal with
| [ H : (_ + _) |- _ ] => destruct H
| [ H : Unit |- _ ] => destruct H
| [ H : Empty |- _ ] => destruct H
| [ H : (_ * _) |- _ ] => destruct H
| [ |- _ = _ :> Functor _ _ ] => progress path_functor
| [ |- _ = _ :> NaturalTransformation _ _ ] => progress path_natural_transformation
| [ |- _ = _ :> prod _ _ ] => apply path_prod
end.(** Do some simplifications of contractible types *)Ltacexp_laws_handle_contr' :=
idtac;
match goal with
| [ H : Contr ?T, x : ?T |- _ ] => progressdestruct (contr x)
| [ H : foralla, Contr (?T a), x : ?T _ |- _ ] => progressdestruct (contr x)
| [ H : forallab, Contr (?T a b), x : ?T _ _ |- _ ] => progressdestruct (contr x)
| [ |- context[contr (center ?x)] ]
=> progressletH := freshinassert (H : idpath = contr (center x)) byexact (center _);
destruct H
end.(** Try to simplify [transport] with some heuristics *)Ltacexp_laws_handle_transport' :=
idtac;
match goal with
| _ => progressrewrite?transport_forall_constant, ?path_forall_2_beta, ?transport_const, ?transport_path_prod
| [ |- context [path_functor_uncurried ?F?G (?x; ?y)] ] (* https://coq.inria.fr/bugs/show_bug.cgi?id=3768 *)
=> rewrite (@path_functor_uncurried_fst _ _ _ F G x y)
| [ |- context[transport (funy : Functor ?C?D => ?f (y _0 ?x)%object)] ]
=> rewrite (funab => @transport_compose _ _ a b (funy' => f (y' x)) (@object_of C D))
| [ |- context[transport (funy : Functor ?C?D => ?f (y _0 ?x)%object ?z)] ]
=> rewrite (funab => @transport_compose _ _ a b (funy' => f (y' x) z) (@object_of C D))
| [ |- context[transport (funy : Functor ?C?D => ?f (y _0 ?x)%object ?z)] ]
=> rewrite (funab => @transport_compose _ _ a b (funy' => f (y' x) z) (@object_of C D))
| [ |- context[transport (funy : Functor ?C?D => ?f (?g (y _0 ?x)%object))] ]
=> rewrite (funab => @transport_compose _ _ a b (funy' => f (g (y' x))) (@object_of C D))
| [ |- context[transport (funy : Functor ?C?D => ?f (?g (y _0 ?x)%object) ?z)] ]
=> rewrite (funab => @transport_compose _ _ a b (funy' => f (g (y' x)) z) (@object_of C D))
| _ => progress transport_path_forall_hammer
| [ |- context[components_of (transport ?P?p?z)] ]
=> simplrewrite (@ap_transport _ P _ _ _ p (fun_ => components_of) z)
| [ |- context[object_of (transport ?P?p?z)] ]
=> simplrewrite (@ap_transport _ P _ _ _ p (fun_ => object_of) z)
| [ |- context[morphism_of (transport ?P?p?z)] ]
=> simplrewrite (@ap_transport _ P _ _ _ p (fun_ => morphism_of) z)
| [ |- context[fst (transport ?P?p?z)] ]
=> simplrewrite (@ap_transport _ P _ _ _ p (fun_ => fst) z)
| [ |- context[snd (transport ?P?p?z)] ]
=> simplrewrite (@ap_transport _ P _ _ _ p (fun_ => snd) z)
| [ |- context[pr1 (transport ?P?p?z)] ]
=> simplrewrite (@ap_transport _ P _ _ _ p (fun_ => pr1) z)
end.Ltacexp_laws_t' :=
first [ exp_laws_misc_t'
| exp_laws_simplify_types'
| exp_laws_handle_contr'
| exp_laws_handle_transport' ].Ltacexp_laws_t := repeat exp_laws_t'.