l3lab/ntp-mathlib huggingface dataset:
/-- `IndepMatroid.ofBdd` constructs a `FiniteRk` matroid. -/
instance (E : Set α) (Indep : Set α → Prop) indep_empty indep_subset indep_aug subset_ground h_bdd :
    FiniteRk (IndepMatroid.ofBdd
      E Indep indep_empty indep_subset indep_aug subset_ground h_bdd).matroid := by
  obtain ⟨B, hB⟩ := (IndepMatroid.ofBdd E Indep _ _ _ _ _).matroid.exists_base
  

Proof state:
case intro
α : Type u_1
I B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug :
  ∀ ⦃I B : Set α⦄,
    Indep I →
      I ∉ maximals (fun x x_1 => x ⊆ x_1) {I | Indep I} →
        B ∈ maximals (fun x x_1 => x ⊆ x_1) {I | Indep I} → ∃ x ∈ B \ I, Indep (insert x I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
h_bdd : ∃ n, ∀ (I : Set α), Indep I → encard I ≤ ↑n
B : Set α
hB : (IndepMatroid.matroid (IndepMatroid.ofBdd E Indep ?m.110173 ?m.110174 ?m.110175 ?m.110176 ?m.110177)).Base B
⊢ FiniteRk (IndepMatroid.matroid (IndepMatroid.ofBdd E Indep indep_empty indep_subset indep_aug subset_ground h_bdd))

Next tactic:
refine hB.finiteRk_of_finite ?_
/-- `IndepMatroid.ofBdd` constructs a `FiniteRk` matroid. -/
instance (E : Set α) (Indep : Set α → Prop) indep_empty indep_subset indep_aug subset_ground h_bdd :
    FiniteRk (IndepMatroid.ofBdd
      E Indep indep_empty indep_subset indep_aug subset_ground h_bdd).matroid := by
  obtain ⟨B, hB⟩ := (IndepMatroid.ofBdd E Indep _ _ _ _ _).matroid.exists_base
  refine hB.finiteRk_of_finite ?_
  

Proof state:
case intro
α : Type u_1
I B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug :
  ∀ ⦃I B : Set α⦄,
    Indep I →
      I ∉ maximals (fun x x_1 => x ⊆ x_1) {I | Indep I} →
        B ∈ maximals (fun x x_1 => x ⊆ x_1) {I | Indep I} → ∃ x ∈ B \ I, Indep (insert x I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
h_bdd : ∃ n, ∀ (I : Set α), Indep I → encard I ≤ ↑n
B : Set α
hB : (IndepMatroid.matroid (IndepMatroid.ofBdd E Indep indep_empty indep_subset indep_aug subset_ground h_bdd)).Base B
⊢ Set.Finite B

Next tactic:
obtain ⟨n, hn⟩ := h_bdd
/-- `IndepMatroid.ofBdd` constructs a `FiniteRk` matroid. -/
instance (E : Set α) (Indep : Set α → Prop) indep_empty indep_subset indep_aug subset_ground h_bdd :
    FiniteRk (IndepMatroid.ofBdd
      E Indep indep_empty indep_subset indep_aug subset_ground h_bdd).matroid := by
  obtain ⟨B, hB⟩ := (IndepMatroid.ofBdd E Indep _ _ _ _ _).matroid.exists_base
  refine hB.finiteRk_of_finite ?_
  obtain ⟨n, hn⟩ := h_bdd
  

Proof state:
case intro.intro
α : Type u_1
I B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug :
  ∀ ⦃I B : Set α⦄,
    Indep I →
      I ∉ maximals (fun x x_1 => x ⊆ x_1) {I | Indep I} →
        B ∈ maximals (fun x x_1 => x ⊆ x_1) {I | Indep I} → ∃ x ∈ B \ I, Indep (insert x I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
B : Set α
n : ℕ
hn : ∀ (I : Set α), Indep I → encard I ≤ ↑n
hB :
  (IndepMatroid.matroid
        (IndepMatroid.ofBdd E Indep indep_empty indep_subset indep_aug subset_ground
          (_ : ∃ n, ∀ (I : Set α), Indep I → encard I ≤ ↑n))).Base
    B
⊢ Set.Finite B

Next tactic:
exact finite_of_encard_le_coe <| hn B (by simpa using hB.indep)
/-- `IndepMatroid.ofBdd` constructs a `FiniteRk` matroid. -/
instance (E : Set α) (Indep : Set α → Prop) indep_empty indep_subset indep_aug subset_ground h_bdd :
    FiniteRk (IndepMatroid.ofBdd
      E Indep indep_empty indep_subset indep_aug subset_ground h_bdd).matroid := by
  obtain ⟨B, hB⟩ := (IndepMatroid.ofBdd E Indep _ _ _ _ _).matroid.exists_base
  refine hB.finiteRk_of_finite ?_
  obtain ⟨n, hn⟩ := h_bdd
  exact finite_of_encard_le_coe <| hn B (by 

Proof state:
α : Type u_1
I B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug :
  ∀ ⦃I B : Set α⦄,
    Indep I →
      I ∉ maximals (fun x x_1 => x ⊆ x_1) {I | Indep I} →
        B ∈ maximals (fun x x_1 => x ⊆ x_1) {I | Indep I} → ∃ x ∈ B \ I, Indep (insert x I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
B : Set α
n : ℕ
hn : ∀ (I : Set α), Indep I → encard I ≤ ↑n
hB :
  (IndepMatroid.matroid
        (IndepMatroid.ofBdd E Indep indep_empty indep_subset indep_aug subset_ground
          (_ : ∃ n, ∀ (I : Set α), Indep I → encard I ≤ ↑n))).Base
    B
⊢ Indep B

Next tactic:
simpa using hB.indep
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      

Proof state:
α : Type u_1
I B X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
indep_bdd : ∃ n, ∀ (I : Set α), Indep I → encard I ≤ ↑n
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
⊢ ∀ ⦃I B : Set α⦄,
    Indep I →
      I ∉ maximals (fun x x_1 => x ⊆ x_1) {I | Indep I} →
        B ∈ maximals (fun x x_1 => x ⊆ x_1) {I | Indep I} → ∃ x ∈ B \ I, Indep (insert x I)

Next tactic:
simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
      

Proof state:
α : Type u_1
I B X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
indep_bdd : ∃ n, ∀ (I : Set α), Indep I → encard I ≤ ↑n
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
⊢ ∀ ⦃I B : Set α⦄,
    Indep I →
      (Indep I → ∃ x, Indep x ∧ I ⊆ x ∧ ¬I = x) →
        Indep B → (∀ ⦃y : Set α⦄, Indep y → B ⊆ y → B = y) → ∃ x ∈ B, x ∉ I ∧ Indep (insert x I)

Next tactic:
rintro I B hI hImax hB hBmax
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
      rintro I B hI hImax hB hBmax
      

Proof state:
α : Type u_1
I✝ B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
indep_bdd : ∃ n, ∀ (I : Set α), Indep I → encard I ≤ ↑n
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
I B : Set α
hI : Indep I
hImax : Indep I → ∃ x, Indep x ∧ I ⊆ x ∧ ¬I = x
hB : Indep B
hBmax : ∀ ⦃y : Set α⦄, Indep y → B ⊆ y → B = y
⊢ ∃ x ∈ B, x ∉ I ∧ Indep (insert x I)

Next tactic:
obtain ⟨J, hJ, hIJ, hne⟩ := hImax hI
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
      rintro I B hI hImax hB hBmax
      obtain ⟨J, hJ, hIJ, hne⟩ := hImax hI
      

Proof state:
case intro.intro.intro
α : Type u_1
I✝ B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
indep_bdd : ∃ n, ∀ (I : Set α), Indep I → encard I ≤ ↑n
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
I B : Set α
hI : Indep I
hImax : Indep I → ∃ x, Indep x ∧ I ⊆ x ∧ ¬I = x
hB : Indep B
hBmax : ∀ ⦃y : Set α⦄, Indep y → B ⊆ y → B = y
J : Set α
hJ : Indep J
hIJ : I ⊆ J
hne : ¬I = J
⊢ ∃ x ∈ B, x ∉ I ∧ Indep (insert x I)

Next tactic:
obtain ⟨n, h_bdd⟩ := indep_bdd
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
      rintro I B hI hImax hB hBmax
      obtain ⟨J, hJ, hIJ, hne⟩ := hImax hI
      obtain ⟨n, h_bdd⟩ := indep_bdd

      

Proof state:
case intro.intro.intro.intro
α : Type u_1
I✝ B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
I B : Set α
hI : Indep I
hImax : Indep I → ∃ x, Indep x ∧ I ⊆ x ∧ ¬I = x
hB : Indep B
hBmax : ∀ ⦃y : Set α⦄, Indep y → B ⊆ y → B = y
J : Set α
hJ : Indep J
hIJ : I ⊆ J
hne : ¬I = J
n : ℕ
h_bdd : ∀ (I : Set α), Indep I → encard I ≤ ↑n
⊢ ∃ x ∈ B, x ∉ I ∧ Indep (insert x I)

Next tactic:
have hlt : I.encard < J.encard :=
        (finite_of_encard_le_coe (h_bdd J hJ)).encard_lt_encard (hIJ.ssubset_of_ne hne)
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
      rintro I B hI hImax hB hBmax
      obtain ⟨J, hJ, hIJ, hne⟩ := hImax hI
      obtain ⟨n, h_bdd⟩ := indep_bdd

      have hlt : I.encard < J.encard :=
        (finite_of_encard_le_coe (h_bdd J hJ)).encard_lt_encard (hIJ.ssubset_of_ne hne)
      

Proof state:
case intro.intro.intro.intro
α : Type u_1
I✝ B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
I B : Set α
hI : Indep I
hImax : Indep I → ∃ x, Indep x ∧ I ⊆ x ∧ ¬I = x
hB : Indep B
hBmax : ∀ ⦃y : Set α⦄, Indep y → B ⊆ y → B = y
J : Set α
hJ : Indep J
hIJ : I ⊆ J
hne : ¬I = J
n : ℕ
h_bdd : ∀ (I : Set α), Indep I → encard I ≤ ↑n
hlt : encard I < encard J
⊢ ∃ x ∈ B, x ∉ I ∧ Indep (insert x I)

Next tactic:
have hle : J.encard ≤ B.encard
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
      rintro I B hI hImax hB hBmax
      obtain ⟨J, hJ, hIJ, hne⟩ := hImax hI
      obtain ⟨n, h_bdd⟩ := indep_bdd

      have hlt : I.encard < J.encard :=
        (finite_of_encard_le_coe (h_bdd J hJ)).encard_lt_encard (hIJ.ssubset_of_ne hne)
      have hle : J.encard ≤ B.encard
      · 

Proof state:
case hle
α : Type u_1
I✝ B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
I B : Set α
hI : Indep I
hImax : Indep I → ∃ x, Indep x ∧ I ⊆ x ∧ ¬I = x
hB : Indep B
hBmax : ∀ ⦃y : Set α⦄, Indep y → B ⊆ y → B = y
J : Set α
hJ : Indep J
hIJ : I ⊆ J
hne : ¬I = J
n : ℕ
h_bdd : ∀ (I : Set α), Indep I → encard I ≤ ↑n
hlt : encard I < encard J
⊢ encard J ≤ encard B

Next tactic:
refine le_of_not_lt (fun hlt' ↦ ?_)
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
      rintro I B hI hImax hB hBmax
      obtain ⟨J, hJ, hIJ, hne⟩ := hImax hI
      obtain ⟨n, h_bdd⟩ := indep_bdd

      have hlt : I.encard < J.encard :=
        (finite_of_encard_le_coe (h_bdd J hJ)).encard_lt_encard (hIJ.ssubset_of_ne hne)
      have hle : J.encard ≤ B.encard
      · refine le_of_not_lt (fun hlt' ↦ ?_)
        

Proof state:
case hle
α : Type u_1
I✝ B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
I B : Set α
hI : Indep I
hImax : Indep I → ∃ x, Indep x ∧ I ⊆ x ∧ ¬I = x
hB : Indep B
hBmax : ∀ ⦃y : Set α⦄, Indep y → B ⊆ y → B = y
J : Set α
hJ : Indep J
hIJ : I ⊆ J
hne : ¬I = J
n : ℕ
h_bdd : ∀ (I : Set α), Indep I → encard I ≤ ↑n
hlt : encard I < encard J
hlt' : encard B < encard J
⊢ False

Next tactic:
obtain ⟨e, he⟩ := indep_aug hB hJ hlt'
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
      rintro I B hI hImax hB hBmax
      obtain ⟨J, hJ, hIJ, hne⟩ := hImax hI
      obtain ⟨n, h_bdd⟩ := indep_bdd

      have hlt : I.encard < J.encard :=
        (finite_of_encard_le_coe (h_bdd J hJ)).encard_lt_encard (hIJ.ssubset_of_ne hne)
      have hle : J.encard ≤ B.encard
      · refine le_of_not_lt (fun hlt' ↦ ?_)
        obtain ⟨e, he⟩ := indep_aug hB hJ hlt'
        

Proof state:
case hle.intro
α : Type u_1
I✝ B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
I B : Set α
hI : Indep I
hImax : Indep I → ∃ x, Indep x ∧ I ⊆ x ∧ ¬I = x
hB : Indep B
hBmax : ∀ ⦃y : Set α⦄, Indep y → B ⊆ y → B = y
J : Set α
hJ : Indep J
hIJ : I ⊆ J
hne : ¬I = J
n : ℕ
h_bdd : ∀ (I : Set α), Indep I → encard I ≤ ↑n
hlt : encard I < encard J
hlt' : encard B < encard J
e : α
he : e ∈ J ∧ e ∉ B ∧ Indep (insert e B)
⊢ False

Next tactic:
rw [hBmax he.2.2 (subset_insert _ _)] at he
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
      rintro I B hI hImax hB hBmax
      obtain ⟨J, hJ, hIJ, hne⟩ := hImax hI
      obtain ⟨n, h_bdd⟩ := indep_bdd

      have hlt : I.encard < J.encard :=
        (finite_of_encard_le_coe (h_bdd J hJ)).encard_lt_encard (hIJ.ssubset_of_ne hne)
      have hle : J.encard ≤ B.encard
      · refine le_of_not_lt (fun hlt' ↦ ?_)
        obtain ⟨e, he⟩ := indep_aug hB hJ hlt'
        rw [hBmax he.2.2 (subset_insert _ _)] at he
        

Proof state:
case hle.intro
α : Type u_1
I✝ B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
I B : Set α
hI : Indep I
hImax : Indep I → ∃ x, Indep x ∧ I ⊆ x ∧ ¬I = x
hB : Indep B
hBmax : ∀ ⦃y : Set α⦄, Indep y → B ⊆ y → B = y
J : Set α
hJ : Indep J
hIJ : I ⊆ J
hne : ¬I = J
n : ℕ
h_bdd : ∀ (I : Set α), Indep I → encard I ≤ ↑n
hlt : encard I < encard J
hlt' : encard B < encard J
e : α
he : e ∈ J ∧ e ∉ insert e B ∧ Indep (insert e (insert e B))
⊢ False

Next tactic:
exact he.2.1 (mem_insert _ _)
/-- If there is an absolute upper bound on the size of an independent set, then matroids
  can be defined using an 'augmentation' axiom similar to the standard definition of
  finite matroids for independent sets. -/
protected def ofBddAugment (E : Set α) (Indep : Set α → Prop)
    (indep_empty : Indep ∅)
    (indep_subset : ∀ ⦃I J⦄, Indep J → I ⊆ J → Indep I)
    (indep_aug : ∀ ⦃I J⦄, Indep I → Indep J → I.encard < J.encard →
      ∃ e ∈ J, e ∉ I ∧ Indep (insert e I))
    (indep_bdd : ∃ (n : ℕ), ∀ I, Indep I → I.encard ≤ n )
    (subset_ground : ∀ I, Indep I → I ⊆ E) : IndepMatroid α :=
  IndepMatroid.ofBdd (E := E) (Indep := Indep)
    (indep_empty := indep_empty)
    (indep_subset := indep_subset)
    (indep_aug := by
      simp_rw [mem_maximals_setOf_iff, not_and, not_forall, exists_prop,  mem_diff,
        and_imp, and_assoc]
      rintro I B hI hImax hB hBmax
      obtain ⟨J, hJ, hIJ, hne⟩ := hImax hI
      obtain ⟨n, h_bdd⟩ := indep_bdd

      have hlt : I.encard < J.encard :=
        (finite_of_encard_le_coe (h_bdd J hJ)).encard_lt_encard (hIJ.ssubset_of_ne hne)
      have hle : J.encard ≤ B.encard
      · refine le_of_not_lt (fun hlt' ↦ ?_)
        obtain ⟨e, he⟩ := indep_aug hB hJ hlt'
        rw [hBmax he.2.2 (subset_insert _ _)] at he
        exact he.2.1 (mem_insert _ _)
      

Proof state:
case intro.intro.intro.intro
α : Type u_1
I✝ B✝ X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
I B : Set α
hI : Indep I
hImax : Indep I → ∃ x, Indep x ∧ I ⊆ x ∧ ¬I = x
hB : Indep B
hBmax : ∀ ⦃y : Set α⦄, Indep y → B ⊆ y → B = y
J : Set α
hJ : Indep J
hIJ : I ⊆ J
hne : ¬I = J
n : ℕ
h_bdd : ∀ (I : Set α), Indep I → encard I ≤ ↑n
hlt : encard I < encard J
hle : encard J ≤ encard B
⊢ ∃ x ∈ B, x ∉ I ∧ Indep (insert x I)

Next tactic:
exact indep_aug hI hB (hlt.trans_le hle)
instance ofBddAugment_finiteRk (E : Set α) Indep indep_empty indep_subset indep_aug
    indep_bdd subset_ground : FiniteRk (IndepMatroid.ofBddAugment
      E Indep indep_empty indep_subset indep_aug indep_bdd subset_ground).matroid := by
  

Proof state:
α : Type u_1
I B X E : Set α
Indep : Set α → Prop
indep_empty : Indep ∅
indep_subset : ∀ ⦃I J : Set α⦄, Indep J → I ⊆ J → Indep I
indep_aug : ∀ ⦃I J : Set α⦄, Indep I → Indep J → encard I < encard J → ∃ e ∈ J, e ∉ I ∧ Indep (insert e I)
indep_bdd : ∃ n, ∀ (I : Set α), Indep I → encard I ≤ ↑n
subset_ground : ∀ (I : Set α), Indep I → I ⊆ E
⊢ FiniteRk
    (IndepMatroid.matroid
      (IndepMatroid.ofBddAugment E Indep indep_empty indep_subset indep_aug indep_bdd subset_ground))

Next tactic:
rw [IndepMatroid.ofBddAugment]