-- 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:
case moduleFacet.customTarget
m f package✝ target✝ : Name
⊢ (match moduleFacet m f 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 →
    moduleFacet m f = customTarget package✝ target✝

Tactic:
(intro; contradiction)

Result:
no goals

Proof state:
k k' : BuildKey
⊢ k.quickCmp k' = Ordering.eq → k = k'

Tactic:
unfold quickCmp

Result:
k k' : BuildKey
⊢ (match k 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 →
    k = k'

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

case h_2
p t p' t' : Name
x✝¹ : Ordering
x✝ : p.quickCmp p' = Ordering.eq → False
⊢ p.quickCmp p' = Ordering.eq → customTarget p t = customTarget p' t'

Tactic:
next p_eq => intro t_eq; rw [eq_of_cmp p_eq, eq_of_cmp t_eq]

Result:
case h_2
p t p' t' : Name
x✝¹ : Ordering
x✝ : p.quickCmp p' = Ordering.eq → False
⊢ p.quickCmp p' = Ordering.eq → customTarget p t = customTarget p' t'

Proof state:
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✝

Tactic:
intro

Result:
case customTarget.targetFacet
p t package✝ target✝ facet✝ : Name
a✝ :
  (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✝