theorem dual_balanceL (l : Ordnode α) (x : α) (r : Ordnode α) :
    dual (balanceL l x r) = balanceR (dual r) x (dual l) := by
  unfold balanceL balanceR
  cases' r with rs rl rx rr
  · 

Proof state:
case nil
α : Type u_1
l : Ordnode α
x : α
⊢ dual
      (Ordnode.casesOn (motive := fun t => id nil = t → Ordnode α) (id nil)
        (fun h =>
          Ordnode.casesOn (motive := fun t => id l = t → Ordnode α) (id l) (fun h => Ordnode.singleton x)
            (fun ls ll lx lr h =>
              Ordnode.casesOn (motive := fun t => id ll = t → Ordnode α) (id ll)
                (fun h =>
                  Ordnode.casesOn (motive := fun t => lr = t → Ordnode α) lr (fun h => node 2 l x nil)
                    (fun size l lrx r h => node 3 (Ordnode.singleton lx) lrx (Ordnode.singleton x)) (_ : lr = lr))
                (fun lls l x_1 r h =>
                  Ordnode.casesOn (motive := fun t => id lr = t → Ordnode α) (id lr)
                    (fun h => node 3 ll lx (Ordnode.singleton x))
                    (fun lrs lrl lrx lrr h =>
                      if lrs < ratio * lls then node (ls + 1) ll lx (node (lrs + 1) lr x nil)
                      else node (ls + 1) (node (lls + size lrl + 1) ll lx lrl) lrx (node (size lrr + 1) lrr x nil))
                    (_ : id lr = id lr))
                (_ : id ll = id ll))
            (_ : id l = id l))
        (fun rs l_1 x_1 r h =>
          Ordnode.casesOn (motive := fun t => id l = t → Ordnode α) (id l) (fun h => node (rs + 1) nil x nil)
            (fun ls ll lx lr h =>
              if ls > delta * rs then
                Ordnode.casesOn (motive := fun t => id ll = t → Ordnode α) (id ll) (fun h => nil)
                  (fun lls l x_2 r h =>
                    Ordnode.casesOn (motive := fun t => id lr = t → Ordnode α) (id lr) (fun h => nil)
                      (fun lrs lrl lrx lrr h =>
                        if lrs < ratio * lls then node (ls + rs + 1) ll lx (node (rs + lrs + 1) lr x nil)
                        else
                          node (ls + rs + 1) (node (lls + size lrl + 1) ll lx lrl) lrx
                            (node (size lrr + rs + 1) lrr x nil))
                      (_ : id lr = id lr))
                  (_ : id ll = id ll)
              else node (ls + rs + 1) l x nil)
            (_ : id l = id l))
        (_ : id nil = id nil)) =
    Ordnode.casesOn (motive := fun t => id (dual nil) = t → Ordnode α) (id (dual nil))
      (fun h =>
        Ordnode.casesOn (motive := fun t => id (dual l) = t → Ordnode α) (id (dual l)) (fun h => Ordnode.singleton x)
          (fun rs rl rx rr h =>
            Ordnode.casesOn (motive := fun t => id rr = t → Ordnode α) (id rr)
              (fun h =>
                Ordnode.casesOn (motive := fun t => rl = t → Ordnode α) rl (fun h => node 2 nil x (dual l))
                  (fun size l rlx r h => node 3 (Ordnode.singleton x) rlx (Ordnode.singleton rx)) (_ : rl = rl))
              (fun rrs l x_1 r h =>
                Ordnode.casesOn (motive := fun t => id rl = t → Ordnode α) (id rl)
                  (fun h => node 3 (Ordnode.singleton x) rx rr)
                  (fun rls rll rlx rlr h =>
                    if rls < ratio * rrs then node (rs + 1) (node (rls + 1) nil x rl) rx rr
                    else node (rs + 1) (node (size rll + 1) nil x rll) rlx (node (size rlr + rrs + 1) rlr rx rr))
                  (_ : id rl = id rl))
              (_ : id rr = id rr))
          (_ : id (dual l) = id (dual l)))
      (fun ls l_1 x_1 r h =>
        Ordnode.casesOn (motive := fun t => id (dual l) = t → Ordnode α) (id (dual l))
          (fun h => node (ls + 1) (dual nil) x nil)
          (fun rs rl rx rr h =>
            if rs > delta * ls then
              Ordnode.casesOn (motive := fun t => id rr = t → Ordnode α) (id rr) (fun h => nil)
                (fun rrs l x_2 r h =>
                  Ordnode.casesOn (motive := fun t => id rl = t → Ordnode α) (id rl) (fun h => nil)
                    (fun rls rll rlx rlr h =>
                      if rls < ratio * rrs then node (ls + rs + 1) (node (ls + rls + 1) (dual nil) x rl) rx rr
                      else
                        node (ls + rs + 1) (node (ls + size rll + 1) (dual nil) x rll) rlx
                          (node (size rlr + rrs + 1) rlr rx rr))
                    (_ : id rl = id rl))
                (_ : id rr = id rr)
            else node (ls + rs + 1) (dual nil) x (dual l))
          (_ : id (dual l) = id (dual l)))
      (_ : id (dual nil) = id (dual nil))

Next tactic:
cases' l with ls ll lx lr