-- Module: Mathlib.RingTheory.Spectrum.Prime.LTSeries
Goal:
R : Type u_1
inst : CommRing R
inst_1 : IsNoetherianRing R
p : LTSeries (PrimeSpectrum R)
x : R
hx :
  x ∈
    (RelSeries.last (r :=
        {x : PrimeSpectrum R × PrimeSpectrum R |
          match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
          | (a, b) => a < b})
        p).asIdeal
n : ℕ
hp :
  p.length (r :=
      {x : PrimeSpectrum R × PrimeSpectrum R |
        match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
        | (a, b) => a < b}) =
    n
succ :
  ∀ (n : ℕ)
    (hn :
      ∀ (p : LTSeries (PrimeSpectrum R))
        (hx :
          x ∈
            (RelSeries.last (r :=
                {x : PrimeSpectrum R × PrimeSpectrum R |
                  match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                  | (a, b) => a < b})
                p).asIdeal)
        (hp :
          p.length (r :=
              {x : PrimeSpectrum R × PrimeSpectrum R |
                match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                | (a, b) => a < b}) =
            n),
        ∃ (q : LTSeries (PrimeSpectrum R)),
          x ∈
              (q.toFun (r :=
                  {x : PrimeSpectrum R × PrimeSpectrum R |
                    match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                    | (a, b) => a < b})
                  1).asIdeal ∧
            n =
                q.length (r :=
                  {x : PrimeSpectrum R × PrimeSpectrum R |
                    match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                    | (a, b) => a < b}) ∧
              RelSeries.head (r :=
                    {x : PrimeSpectrum R × PrimeSpectrum R |
                      match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                      | (a, b) => a < b})
                    p =
                  RelSeries.head (r :=
                    {x : PrimeSpectrum R × PrimeSpectrum R |
                      match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                      | (a, b) => a < b})
                    q ∧
                RelSeries.last (r :=
                    {x : PrimeSpectrum R × PrimeSpectrum R |
                      match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                      | (a, b) => a < b})
                    p =
                  RelSeries.last (r :=
                    {x : PrimeSpectrum R × PrimeSpectrum R |
                      match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                      | (a, b) => a < b})
                    q)
    (p : LTSeries (PrimeSpectrum R))
    (hx :
      x ∈
        (RelSeries.last (r :=
            {x : PrimeSpectrum R × PrimeSpectrum R |
              match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
              | (a, b) => a < b})
            p).asIdeal)
    (hp :
      p.length (r :=
          {x : PrimeSpectrum R × PrimeSpectrum R |
            match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
            | (a, b) => a < b}) =
        n + 1),
    ∃ (q : LTSeries (PrimeSpectrum R)),
      x ∈
          (q.toFun (r :=
              {x : PrimeSpectrum R × PrimeSpectrum R |
                match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                | (a, b) => a < b})
              1).asIdeal ∧
        n + 1 =
            q.length (r :=
              {x : PrimeSpectrum R × PrimeSpectrum R |
                match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                | (a, b) => a < b}) ∧
          RelSeries.head (r :=
                {x : PrimeSpectrum R × PrimeSpectrum R |
                  match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                  | (a, b) => a < b})
                p =
              RelSeries.head (r :=
                {x : PrimeSpectrum R × PrimeSpectrum R |
                  match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                  | (a, b) => a < b})
                q ∧
            RelSeries.last (r :=
                {x : PrimeSpectrum R × PrimeSpectrum R |
                  match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                  | (a, b) => a < b})
                p =
              RelSeries.last (r :=
                {x : PrimeSpectrum R × PrimeSpectrum R |
                  match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                  | (a, b) => a < b})
                q
⊢ ∃ (q : LTSeries (PrimeSpectrum R)),
    x ∈
        (q.toFun (r :=
            {x : PrimeSpectrum R × PrimeSpectrum R |
              match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
              | (a, b) => a < b})
            1).asIdeal ∧
      n =
          q.length (r :=
            {x : PrimeSpectrum R × PrimeSpectrum R |
              match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
              | (a, b) => a < b}) ∧
        RelSeries.head (r :=
              {x : PrimeSpectrum R × PrimeSpectrum R |
                match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                | (a, b) => a < b})
              p =
            RelSeries.head (r :=
              {x : PrimeSpectrum R × PrimeSpectrum R |
                match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                | (a, b) => a < b})
              q ∧
          RelSeries.last (r :=
              {x : PrimeSpectrum R × PrimeSpectrum R |
                match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                | (a, b) => a < b})
              p =
            RelSeries.last (r :=
              {x : PrimeSpectrum R × PrimeSpectrum R |
                match (motive := PrimeSpectrum R × PrimeSpectrum R → Prop) x with
                | (a, b) => a < b})
              q

Tactic:
induction n generalizing p with
  | zero =>
    use RelSeries.singleton _ p.last
    simp only [RelSeries.singleton_toFun, hx, RelSeries.singleton_length, RelSeries.head,
      RelSeries.last_singleton, and_true, true_and]
    rw [show 0 = Fin.last p.length from Fin.zero_eq_mk.mpr hp, RelSeries.last]
  | succ n hn => ?_

Premises used: and_true, RelSeries.last, RelSeries.singleton_toFun, RelSeries.singleton_length, RelSeries.head, RelSeries.singleton, RelSeries.last_singleton, true_and