(* The internal lemmas for the have tactics.                                  *)

Definition ssr_have Plemma Pgoal (step : Plemma) rest : Pgoal := rest step.Definition ssr_have_let Pgoal Plemma step
  (rest : let x : Plemma := step in Pgoal) : Pgoal := rest.Definition ssr_suff Plemma Pgoal step (rest : Plemma) : Pgoal := step rest.Definition ssr_wlog := ssr_suff.(* Internal N-ary congruence lemmas for the congr tactic.                     *)

Fixpoint nary_congruence_statement (n : nat)
         : (forall B, (B -> B -> Prop) -> Prop) -> Prop :=
  match n with
  | O => fun k => forall B, k B (fun x1 x2 : B => x1 = x2)
  | S n' =>
    let k' A B e (f1 f2 : A -> B) :=
      forall x1 x2, x1 = x2 -> (e (f1 x1) (f2 x2) : Prop) in
    fun k => forall A, nary_congruence_statement n' (fun B e => k _ (k' A B e))
  end.

Lemma nary_congruence n (k := fun B e => forall y : B, (e y y : Prop)) : nary_congruence_statement n k.