-- Mathlib/.lake/packages/lean4/src/lean/lake/Lake/Build/Key.lean
theorem eq_of_quickCmp {k k' : BuildKey}  :
quickCmp k k' = Ordering.eq → k = k'

Proof state:
p t p' t' : Name
x✝ : Ordering
p_eq : p.quickCmp p' = Ordering.eq
⊢ t.quickCmp t' = Ordering.eq → customTarget p t = customTarget p' t'

Tactic:
intro t_eq

Result:
p t p' t' : Name
x✝ : Ordering
p_eq : p.quickCmp p' = Ordering.eq
t_eq : t.quickCmp t' = Ordering.eq
⊢ customTarget p t = customTarget p' t'

Proof state:
m f m' f' : Name
⊢ (match m.quickCmp m' with
      | Ordering.eq => f.quickCmp f'
      | ord => ord) =
      Ordering.eq →
    moduleFacet m f = moduleFacet m' f'

Tactic:
split

Result:
case h_1
m f m' f' : Name
x✝ : Ordering
heq✝ : m.quickCmp m' = Ordering.eq
⊢ f.quickCmp f' = Ordering.eq → moduleFacet m f = moduleFacet m' f'

case h_2
m f m' f' : Name
x✝¹ : Ordering
x✝ : m.quickCmp m' = Ordering.eq → False
⊢ m.quickCmp m' = Ordering.eq → moduleFacet m f = moduleFacet m' f'

Proof state:
case customTarget
k' : BuildKey
p t : Name
⊢ (match customTarget p t with
      | moduleFacet m f =>
        match k' with
        | moduleFacet m' f' =>
          match m.quickCmp m' with
          | Ordering.eq => f.quickCmp f'
          | ord => ord
        | x => Ordering.lt
      | packageFacet p f =>
        match k' with
        | moduleFacet module facet => Ordering.gt
        | packageFacet p' f' =>
          match p.quickCmp p' with
          | Ordering.eq => f.quickCmp f'
          | ord => ord
        | x => Ordering.lt
      | targetFacet p t f =>
        match k' with
        | customTarget package target => Ordering.lt
        | targetFacet p' t' f' =>
          match p.quickCmp p' with
          | Ordering.eq =>
            match t.quickCmp t' with
            | Ordering.eq => f.quickCmp f'
            | ord => ord
          | ord => ord
        | x => Ordering.gt
      | customTarget p t =>
        match k' with
        | customTarget p' t' =>
          match p.quickCmp p' with
          | Ordering.eq => t.quickCmp t'
          | ord => ord
        | x => Ordering.gt) =
      Ordering.eq →
    customTarget p t = k'

Tactic:
cases k'

Result:
case customTarget.moduleFacet
p t module✝ facet✝ : Name
⊢ (match customTarget p t with
      | moduleFacet m f =>
        match moduleFacet module✝ facet✝ with
        | moduleFacet m' f' =>
          match m.quickCmp m' with
          | Ordering.eq => f.quickCmp f'
          | ord => ord
        | x => Ordering.lt
      | packageFacet p f =>
        match moduleFacet module✝ facet✝ with
        | moduleFacet module facet => Ordering.gt
        | packageFacet p' f' =>
          match p.quickCmp p' with
          | Ordering.eq => f.quickCmp f'
          | ord => ord
        | x => Ordering.lt
      | targetFacet p t f =>
        match moduleFacet module✝ facet✝ with
        | customTarget package target => Ordering.lt
        | targetFacet p' t' f' =>
          match p.quickCmp p' with
          | Ordering.eq =>
            match t.quickCmp t' with
            | Ordering.eq => f.quickCmp f'
            | ord => ord
          | ord => ord
        | x => Ordering.gt
      | customTarget p t =>
        match moduleFacet module✝ facet✝ with
        | customTarget p' t' =>
          match p.quickCmp p' with
          | Ordering.eq => t.quickCmp t'
          | ord => ord
        | x => Ordering.gt) =
      Ordering.eq →
    customTarget p t = moduleFacet module✝ facet✝

case customTarget.packageFacet
p t package✝ facet✝ : Name
⊢ (match customTarget p t with
      | moduleFacet m f =>
        match packageFacet package✝ facet✝ with
        | moduleFacet m' f' =>
          match m.quickCmp m' with
          | Ordering.eq => f.quickCmp f'
          | ord => ord
        | x => Ordering.lt
      | packageFacet p f =>
        match packageFacet package✝ facet✝ with
        | moduleFacet module facet => Ordering.gt
        | packageFacet p' f' =>
          match p.quickCmp p' with
          | Ordering.eq => f.quickCmp f'
          | ord => ord
        | x => Ordering.lt
      | targetFacet p t f =>
        match packageFacet package✝ facet✝ with
        | customTarget package target => Ordering.lt
        | targetFacet p' t' f' =>
          match p.quickCmp p' with
          | Ordering.eq =>
            match t.quickCmp t' with
            | Ordering.eq => f.quickCmp f'
            | ord => ord
          | ord => ord
        | x => Ordering.gt
      | customTarget p t =>
        match packageFacet package✝ facet✝ with
        | customTarget p' t' =>
          match p.quickCmp p' with
          | Ordering.eq => t.quickCmp t'
          | ord => ord
        | x => Ordering.gt) =
      Ordering.eq →
    customTarget p t = packageFacet package✝ facet✝

case customTarget.targetFacet
p t package✝ target✝ facet✝ : Name
⊢ (match customTarget p t with
      | moduleFacet m f =>
        match targetFacet package✝ target✝ facet✝ with
        | moduleFacet m' f' =>
          match m.quickCmp m' with
          | Ordering.eq => f.quickCmp f'
          | ord => ord
        | x => Ordering.lt
      | packageFacet p f =>
        match targetFacet package✝ target✝ facet✝ with
        | moduleFacet module facet => Ordering.gt
        | packageFacet p' f' =>
          match p.quickCmp p' with
          | Ordering.eq => f.quickCmp f'
          | ord => ord
        | x => Ordering.lt
      | targetFacet p t f =>
        match targetFacet package✝ target✝ facet✝ with
        | customTarget package target => Ordering.lt
        | targetFacet p' t' f' =>
          match p.quickCmp p' with
          | Ordering.eq =>
            match t.quickCmp t' with
            | Ordering.eq => f.quickCmp f'
            | ord => ord
          | ord => ord
        | x => Ordering.gt
      | customTarget p t =>
        match targetFacet package✝ target✝ facet✝ with
        | customTarget p' t' =>
          match p.quickCmp p' with
          | Ordering.eq => t.quickCmp t'
          | ord => ord
        | x => Ordering.gt) =
      Ordering.eq →
    customTarget p t = targetFacet package✝ target✝ facet✝

case customTarget.customTarget
p t package✝ target✝ : Name
⊢ (match customTarget p t with
      | moduleFacet m f =>
        match customTarget package✝ target✝ with
        | moduleFacet m' f' =>
          match m.quickCmp m' with
          | Ordering.eq => f.quickCmp f'
          | ord => ord
        | x => Ordering.lt
      | packageFacet p f =>
        match customTarget package✝ target✝ with
        | moduleFacet module facet => Ordering.gt
        | packageFacet p' f' =>
          match p.quickCmp p' with
          | Ordering.eq => f.quickCmp f'
          | ord => ord
        | x => Ordering.lt
      | targetFacet p t f =>
        match customTarget package✝ target✝ with
        | customTarget package target => Ordering.lt
        | targetFacet p' t' f' =>
          match p.quickCmp p' with
          | Ordering.eq =>
            match t.quickCmp t' with
            | Ordering.eq => f.quickCmp f'
            | ord => ord
          | ord => ord
        | x => Ordering.gt
      | customTarget p t =>
        match customTarget package✝ target✝ with
        | customTarget p' t' =>
          match p.quickCmp p' with
          | Ordering.eq => t.quickCmp t'
          | ord => ord
        | x => Ordering.gt) =
      Ordering.eq →
    customTarget p t = customTarget package✝ target✝

Proof state:
case h_2
p t f p' t' f' : Name
x✝² : Ordering
p_eq : p.quickCmp p' = Ordering.eq
x✝¹ : Ordering
x✝ : t.quickCmp t' = Ordering.eq → False
⊢ t.quickCmp t' = Ordering.eq → targetFacet p t f = targetFacet p' t' f'

Tactic:
next => intro; contradiction

Result:
no goals

Proof state:
m f m' f' : Name
x✝¹ : Ordering
x✝ : m.quickCmp m' = Ordering.eq → False
a✝ : m.quickCmp m' = Ordering.eq
⊢ moduleFacet m f = moduleFacet m' f'

Tactic:
contradiction

Result:
no goals