set_theory.listsMathlib.SetTheory.Lists

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

docs(set_theory/lists): update docs (#18346)
Diff
@@ -37,11 +37,8 @@ This calls for a two-steps definition of ZFA lists:
 * `lists' α tt`: Proper ZFA prelists. Defined inductively from the empty ZFA prelist (`lists'.nil`)
   and from appending a ZFA prelist to a proper ZFA prelist (`lists'.cons a l`).
 * `lists α`: ZFA lists. Sum of the atoms and proper ZFA prelists.
-
-## TODO
-
-The next step is to define ZFA sets as lists quotiented by `lists.equiv`.
-(-/
+* `finsets`: ZFA sets. Defined as `lists` quotiented by `lists.equiv`, the extensional equivalence.
+-/
 
 variables {α : Type*}
 

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -184,7 +184,7 @@ theorem mem_cons {a y l} : a ∈ @cons α y l ↔ a ~ y ∨ a ∈ l := by
 theorem cons_subset {a} {l₁ l₂ : Lists' α true} : Lists'.cons a l₁ ⊆ l₂ ↔ a ∈ l₂ ∧ l₁ ⊆ l₂ :=
   by
   refine' ⟨fun h => _, fun ⟨⟨a', m, e⟩, s⟩ => subset.cons e m s⟩
-  generalize h' : Lists'.cons a l₁ = l₁' at h 
+  generalize h' : Lists'.cons a l₁ = l₁' at h
   cases' h with l a' a'' l l' e m s; · cases a; cases h'
   cases a; cases a'; cases h'; exact ⟨⟨_, m, e⟩, s⟩
 #align lists'.cons_subset Lists'.cons_subset
@@ -195,7 +195,7 @@ theorem ofList_subset {l₁ l₂ : List (Lists α)} (h : l₁ ⊆ l₂) :
     Lists'.ofList l₁ ⊆ Lists'.ofList l₂ := by
   induction l₁; · exact subset.nil
   refine' subset.cons (Lists.Equiv.refl _) _ (l₁_ih (List.subset_of_cons_subset h))
-  simp at h ; simp [h]
+  simp at h; simp [h]
 #align lists'.of_list_subset Lists'.ofList_subset
 -/
 
@@ -219,7 +219,7 @@ theorem subset_nil {l : Lists' α true} : l ⊆ Lists'.nil → l = Lists'.nil :=
 theorem mem_of_subset' {a} {l₁ l₂ : Lists' α true} (s : l₁ ⊆ l₂) (h : a ∈ l₁.toList) : a ∈ l₂ :=
   by
   induction' s with _ a a' l l' e m s IH; · cases h
-  simp at h ; rcases h with (rfl | h)
+  simp at h; rcases h with (rfl | h)
   exacts [⟨_, m, e⟩, IH h]
 #align lists'.mem_of_subset' Lists'.mem_of_subset'
 -/
@@ -231,7 +231,7 @@ theorem subset_def {l₁ l₂ : Lists' α true} : l₁ ⊆ l₂ ↔ ∀ a ∈ l
     rw [← of_to_list l₁]
     revert H; induction to_list l₁ <;> intro
     · exact subset.nil
-    · simp at H ; exact cons_subset.2 ⟨H.1, ih H.2⟩⟩
+    · simp at H; exact cons_subset.2 ⟨H.1, ih H.2⟩⟩
 #align lists'.subset_def Lists'.subset_def
 -/
 
@@ -371,7 +371,7 @@ theorem Equiv.trans : ∀ {l₁ l₂ l₃ : Lists α}, l₁ ~ l₂ → l₂ ~ l
   suffices PProd (∀ l₁, trans l₁) (∀ (l : Lists' α tt), ∀ l' ∈ l.toList, trans l') by exact this.1
   apply induction_mut
   · intro a l₂ l₃ h₁ h₂
-    rwa [← equiv_atom.1 h₁] at h₂ 
+    rwa [← equiv_atom.1 h₁] at h₂
   · intro l₁ IH l₂ l₃ h₁ h₂
     cases' h₁ with _ _ l₂; · exact h₂
     cases' h₂ with _ _ l₃; · exact h₁
Diff
@@ -428,11 +428,13 @@ theorem lt_sizeof_cons' {b} (a : Lists' α b) (l) :
 #align lists.lt_sizeof_cons' Lists.lt_sizeof_cons'
 -/
 
+/- ./././Mathport/Syntax/Translate/Command.lean:299:8: warning: using_well_founded used, estimated equivalent -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
+/- ./././Mathport/Syntax/Translate/Command.lean:299:8: warning: using_well_founded used, estimated equivalent -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
+/- ./././Mathport/Syntax/Translate/Command.lean:299:8: warning: using_well_founded used, estimated equivalent -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
-/- ./././Mathport/Syntax/Translate/Command.lean:298:8: warning: using_well_founded used, estimated equivalent -/
 #print Lists.Equiv.decidable /-
 mutual
   @[instance]
@@ -460,6 +462,7 @@ mutual
             default_dec_tac
         subset.decidable l₂ l₁
       exact decidable_of_iff' _ equiv.antisymm_iff
+  termination_by x => WellFounded.wrap (measure_wf equiv.decidable_meas) x
   @[instance]
   def Subset.decidable [DecidableEq α] : ∀ l₁ l₂ : Lists' α true, Decidable (l₁ ⊆ l₂)
     | Lists'.nil, l₂ => isTrue Subset.nil
@@ -480,6 +483,7 @@ mutual
             default_dec_tac
         subset.decidable l₁ l₂
       exact decidable_of_iff' _ (@Lists'.cons_subset _ ⟨_, _⟩ _ _)
+  termination_by x => WellFounded.wrap (measure_wf equiv.decidable_meas) x
   @[instance]
   def mem.decidable [DecidableEq α] : ∀ (a : Lists α) (l : Lists' α true), Decidable (a ∈ l)
     | a, Lists'.nil => isFalse <| by rintro ⟨_, ⟨⟩, _⟩
@@ -501,9 +505,8 @@ mutual
         mem.decidable a l₂
       refine' decidable_of_iff' (a ~ ⟨_, b⟩ ∨ a ∈ l₂) _
       rw [← Lists'.mem_cons]; rfl
+  termination_by x => WellFounded.wrap (measure_wf equiv.decidable_meas) x
 end
-termination_by
-  _ x => WellFounded.wrap (measure_wf equiv.decidable_meas) x
 #align lists.equiv.decidable Lists.Equiv.decidable
 #align lists.subset.decidable Lists.Subset.decidable
 #align lists.mem.decidable Lists.mem.decidable
Diff
@@ -432,6 +432,7 @@ theorem lt_sizeof_cons' {b} (a : Lists' α b) (l) :
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
+/- ./././Mathport/Syntax/Translate/Command.lean:298:8: warning: using_well_founded used, estimated equivalent -/
 #print Lists.Equiv.decidable /-
 mutual
   @[instance]
@@ -501,7 +502,8 @@ mutual
       refine' decidable_of_iff' (a ~ ⟨_, b⟩ ∨ a ∈ l₂) _
       rw [← Lists'.mem_cons]; rfl
 end
-termination_by' ⟨_, measure_wf equiv.decidable_meas⟩
+termination_by
+  _ x => WellFounded.wrap (measure_wf equiv.decidable_meas) x
 #align lists.equiv.decidable Lists.Equiv.decidable
 #align lists.subset.decidable Lists.Subset.decidable
 #align lists.mem.decidable Lists.mem.decidable
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2018 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 -/
-import Mathbin.Data.List.Basic
+import Data.List.Basic
 
 #align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
 
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2018 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module set_theory.lists
-! leanprover-community/mathlib commit 497d1e06409995dd8ec95301fa8d8f3480187f4c
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.List.Basic
 
+#align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
+
 /-!
 # A computable model of ZFA without infinity
 
Diff
@@ -152,7 +152,6 @@ end
 #align lists'.subset Lists'.Subset
 -/
 
--- mathport name: «expr ~ »
 local infixl:50 " ~ " => Lists.Equiv
 
 /-- Equivalence of ZFA lists. Defined inductively. -/
@@ -171,15 +170,20 @@ equivalent as a ZFA list to this ZFA list. -/
 instance {b} : Membership (Lists α) (Lists' α b) :=
   ⟨fun a l => ∃ a' ∈ l.toList, a ~ a'⟩
 
+#print Lists'.mem_def /-
 theorem mem_def {b a} {l : Lists' α b} : a ∈ l ↔ ∃ a' ∈ l.toList, a ~ a' :=
   Iff.rfl
 #align lists'.mem_def Lists'.mem_def
+-/
 
+#print Lists'.mem_cons /-
 @[simp]
 theorem mem_cons {a y l} : a ∈ @cons α y l ↔ a ~ y ∨ a ∈ l := by
   simp [mem_def, or_and_right, exists_or]
 #align lists'.mem_cons Lists'.mem_cons
+-/
 
+#print Lists'.cons_subset /-
 theorem cons_subset {a} {l₁ l₂ : Lists' α true} : Lists'.cons a l₁ ⊆ l₂ ↔ a ∈ l₂ ∧ l₁ ⊆ l₂ :=
   by
   refine' ⟨fun h => _, fun ⟨⟨a', m, e⟩, s⟩ => subset.cons e m s⟩
@@ -187,6 +191,7 @@ theorem cons_subset {a} {l₁ l₂ : Lists' α true} : Lists'.cons a l₁ ⊆ l
   cases' h with l a' a'' l l' e m s; · cases a; cases h'
   cases a; cases a'; cases h'; exact ⟨⟨_, m, e⟩, s⟩
 #align lists'.cons_subset Lists'.cons_subset
+-/
 
 #print Lists'.ofList_subset /-
 theorem ofList_subset {l₁ l₂ : List (Lists α)} (h : l₁ ⊆ l₂) :
@@ -213,13 +218,16 @@ theorem subset_nil {l : Lists' α true} : l ⊆ Lists'.nil → l = Lists'.nil :=
 #align lists'.subset_nil Lists'.subset_nil
 -/
 
+#print Lists'.mem_of_subset' /-
 theorem mem_of_subset' {a} {l₁ l₂ : Lists' α true} (s : l₁ ⊆ l₂) (h : a ∈ l₁.toList) : a ∈ l₂ :=
   by
   induction' s with _ a a' l l' e m s IH; · cases h
   simp at h ; rcases h with (rfl | h)
   exacts [⟨_, m, e⟩, IH h]
 #align lists'.mem_of_subset' Lists'.mem_of_subset'
+-/
 
+#print Lists'.subset_def /-
 theorem subset_def {l₁ l₂ : Lists' α true} : l₁ ⊆ l₂ ↔ ∀ a ∈ l₁.toList, a ∈ l₂ :=
   ⟨fun H a => mem_of_subset' H, fun H =>
     by
@@ -228,6 +236,7 @@ theorem subset_def {l₁ l₂ : Lists' α true} : l₁ ⊆ l₂ ↔ ∀ a ∈ l
     · exact subset.nil
     · simp at H ; exact cons_subset.2 ⟨H.1, ih H.2⟩⟩
 #align lists'.subset_def Lists'.subset_def
+-/
 
 end Lists'
 
@@ -404,19 +413,23 @@ def Equiv.decidableMeas :
 
 open WellFoundedTactics
 
+#print Lists.sizeof_pos /-
 theorem sizeof_pos {b} (l : Lists' α b) : 0 < SizeOf.sizeOf l := by
   cases l <;>
     run_tac
       andthen unfold_sizeof trivial_nat_lt
 #align lists.sizeof_pos Lists.sizeof_pos
+-/
 
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.unfold_sizeof -/
+#print Lists.lt_sizeof_cons' /-
 theorem lt_sizeof_cons' {b} (a : Lists' α b) (l) :
     SizeOf.sizeOf (⟨b, a⟩ : Lists α) < SizeOf.sizeOf (Lists'.cons' a l) := by
   run_tac
     unfold_sizeof;
   apply sizeof_pos
 #align lists.lt_sizeof_cons' Lists.lt_sizeof_cons'
+-/
 
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
@@ -503,14 +516,18 @@ end Lists
 
 namespace Lists'
 
+#print Lists'.mem_equiv_left /-
 theorem mem_equiv_left {l : Lists' α true} : ∀ {a a'}, a ~ a' → (a ∈ l ↔ a' ∈ l) :=
   suffices ∀ {a a'}, a ~ a' → a ∈ l → a' ∈ l from fun a a' e => ⟨this e, this e.symm⟩
   fun a₁ a₂ e₁ ⟨a₃, m₃, e₂⟩ => ⟨_, m₃, e₁.symm.trans e₂⟩
 #align lists'.mem_equiv_left Lists'.mem_equiv_left
+-/
 
+#print Lists'.mem_of_subset /-
 theorem mem_of_subset {a} {l₁ l₂ : Lists' α true} (s : l₁ ⊆ l₂) : a ∈ l₁ → a ∈ l₂
   | ⟨a', m, e⟩ => (mem_equiv_left e).2 (mem_of_subset' s m)
 #align lists'.mem_of_subset Lists'.mem_of_subset
+-/
 
 #print Lists'.Subset.trans /-
 theorem Subset.trans {l₁ l₂ l₃ : Lists' α true} (h₁ : l₁ ⊆ l₂) (h₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃ :=
Diff
@@ -67,7 +67,7 @@ inductive Lists'.{u} (α : Type u) : Bool → Type u
 to an element of `α`, or a "proper" ZFA list, inductively defined from the empty ZFA list and from
 appending a ZFA list to a proper ZFA list. -/
 def Lists (α : Type _) :=
-  Σb, Lists' α b
+  Σ b, Lists' α b
 #align lists Lists
 -/
 
@@ -127,7 +127,7 @@ theorem of_toList : ∀ l : Lists' α true, ofList (toList l) = l :=
   fun b h l => by
   induction l; · cases h; · exact rfl
   case cons' b a l IH₁ IH₂ =>
-    intro ; change l' with cons' a l
+    intro; change l' with cons' a l
     simpa [cons] using IH₂ rfl
 #align lists'.of_to_list Lists'.of_toList
 -/
@@ -183,7 +183,7 @@ theorem mem_cons {a y l} : a ∈ @cons α y l ↔ a ~ y ∨ a ∈ l := by
 theorem cons_subset {a} {l₁ l₂ : Lists' α true} : Lists'.cons a l₁ ⊆ l₂ ↔ a ∈ l₂ ∧ l₁ ⊆ l₂ :=
   by
   refine' ⟨fun h => _, fun ⟨⟨a', m, e⟩, s⟩ => subset.cons e m s⟩
-  generalize h' : Lists'.cons a l₁ = l₁' at h
+  generalize h' : Lists'.cons a l₁ = l₁' at h 
   cases' h with l a' a'' l l' e m s; · cases a; cases h'
   cases a; cases a'; cases h'; exact ⟨⟨_, m, e⟩, s⟩
 #align lists'.cons_subset Lists'.cons_subset
@@ -193,7 +193,7 @@ theorem ofList_subset {l₁ l₂ : List (Lists α)} (h : l₁ ⊆ l₂) :
     Lists'.ofList l₁ ⊆ Lists'.ofList l₂ := by
   induction l₁; · exact subset.nil
   refine' subset.cons (Lists.Equiv.refl _) _ (l₁_ih (List.subset_of_cons_subset h))
-  simp at h; simp [h]
+  simp at h ; simp [h]
 #align lists'.of_list_subset Lists'.ofList_subset
 -/
 
@@ -216,8 +216,8 @@ theorem subset_nil {l : Lists' α true} : l ⊆ Lists'.nil → l = Lists'.nil :=
 theorem mem_of_subset' {a} {l₁ l₂ : Lists' α true} (s : l₁ ⊆ l₂) (h : a ∈ l₁.toList) : a ∈ l₂ :=
   by
   induction' s with _ a a' l l' e m s IH; · cases h
-  simp at h; rcases h with (rfl | h)
-  exacts[⟨_, m, e⟩, IH h]
+  simp at h ; rcases h with (rfl | h)
+  exacts [⟨_, m, e⟩, IH h]
 #align lists'.mem_of_subset' Lists'.mem_of_subset'
 
 theorem subset_def {l₁ l₂ : Lists' α true} : l₁ ⊆ l₂ ↔ ∀ a ∈ l₁.toList, a ∈ l₂ :=
@@ -226,7 +226,7 @@ theorem subset_def {l₁ l₂ : Lists' α true} : l₁ ⊆ l₂ ↔ ∀ a ∈ l
     rw [← of_to_list l₁]
     revert H; induction to_list l₁ <;> intro
     · exact subset.nil
-    · simp at H; exact cons_subset.2 ⟨H.1, ih H.2⟩⟩
+    · simp at H ; exact cons_subset.2 ⟨H.1, ih H.2⟩⟩
 #align lists'.subset_def Lists'.subset_def
 
 end Lists'
@@ -308,7 +308,7 @@ def inductionMut (C : Lists α → Sort _) (D : Lists' α true → Sort _) (C0 :
         | tt, l => D l
         | ff, l => PUnit)
     by exact ⟨fun ⟨b, l⟩ => (this _).1, fun l => (this l).2⟩
-  intros ; induction' l with a b a l IH₁ IH₂
+  intros; induction' l with a b a l IH₁ IH₂
   · exact ⟨C0 _, ⟨⟩⟩
   · exact ⟨C1 _ D0, D0⟩
   · suffices; · exact ⟨C1 _ this, this⟩
@@ -354,7 +354,7 @@ theorem equiv_atom {a} {l : Lists α} : atom a ~ l ↔ atom a = l :=
 
 #print Lists.Equiv.symm /-
 theorem Equiv.symm {l₁ l₂ : Lists α} (h : l₁ ~ l₂) : l₂ ~ l₁ := by
-  cases' h with _ _ _ h₁ h₂ <;> [rfl;exact equiv.antisymm h₂ h₁]
+  cases' h with _ _ _ h₁ h₂ <;> [rfl; exact equiv.antisymm h₂ h₁]
 #align lists.equiv.symm Lists.Equiv.symm
 -/
 
@@ -365,7 +365,7 @@ theorem Equiv.trans : ∀ {l₁ l₂ l₃ : Lists α}, l₁ ~ l₂ → l₂ ~ l
   suffices PProd (∀ l₁, trans l₁) (∀ (l : Lists' α tt), ∀ l' ∈ l.toList, trans l') by exact this.1
   apply induction_mut
   · intro a l₂ l₃ h₁ h₂
-    rwa [← equiv_atom.1 h₁] at h₂
+    rwa [← equiv_atom.1 h₁] at h₂ 
   · intro l₁ IH l₂ l₃ h₁ h₂
     cases' h₁ with _ _ l₂; · exact h₂
     cases' h₂ with _ _ l₃; · exact h₁
@@ -393,8 +393,8 @@ section Decidable
 #print Lists.Equiv.decidableMeas /-
 @[simp]
 def Equiv.decidableMeas :
-    (PSum (Σ'l₁ : Lists α, Lists α) <|
-        PSum (Σ'l₁ : Lists' α true, Lists' α true) (Σ'a : Lists α, Lists' α true)) →
+    (PSum (Σ' l₁ : Lists α, Lists α) <|
+        PSum (Σ' l₁ : Lists' α true, Lists' α true) (Σ' a : Lists α, Lists' α true)) →
       ℕ
   | PSum.inl ⟨l₁, l₂⟩ => SizeOf.sizeOf l₁ + SizeOf.sizeOf l₂
   | PSum.inr <| PSum.inl ⟨l₁, l₂⟩ => SizeOf.sizeOf l₁ + SizeOf.sizeOf l₂
@@ -490,7 +490,8 @@ mutual
         mem.decidable a l₂
       refine' decidable_of_iff' (a ~ ⟨_, b⟩ ∨ a ∈ l₂) _
       rw [← Lists'.mem_cons]; rfl
-end termination_by' ⟨_, measure_wf equiv.decidable_meas⟩
+end
+termination_by' ⟨_, measure_wf equiv.decidable_meas⟩
 #align lists.equiv.decidable Lists.Equiv.decidable
 #align lists.subset.decidable Lists.Subset.decidable
 #align lists.mem.decidable Lists.mem.decidable
Diff
@@ -171,33 +171,15 @@ equivalent as a ZFA list to this ZFA list. -/
 instance {b} : Membership (Lists α) (Lists' α b) :=
   ⟨fun a l => ∃ a' ∈ l.toList, a ~ a'⟩
 
-/- warning: lists'.mem_def -> Lists'.mem_def is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {b : Bool} {a : Lists.{u1} α} {l : Lists'.{u1} α b}, Iff (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α b) (Lists'.hasMem.{u1} α b) a l) (Exists.{succ u1} (Lists.{u1} α) (fun (a' : Lists.{u1} α) => Exists.{0} (Membership.Mem.{u1, u1} (Lists.{u1} α) (List.{u1} (Lists.{u1} α)) (List.hasMem.{u1} (Lists.{u1} α)) a' (Lists'.toList.{u1} α b l)) (fun (H : Membership.Mem.{u1, u1} (Lists.{u1} α) (List.{u1} (Lists.{u1} α)) (List.hasMem.{u1} (Lists.{u1} α)) a' (Lists'.toList.{u1} α b l)) => Lists.Equiv.{u1} α a a')))
-but is expected to have type
-  forall {α : Type.{u1}} {b : Bool} {a : Lists.{u1} α} {l : Lists'.{u1} α b}, Iff (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α b) (Lists'.instMembershipListsLists'.{u1} α b) a l) (Exists.{succ u1} (Lists.{u1} α) (fun (a' : Lists.{u1} α) => And (Membership.mem.{u1, u1} (Lists.{u1} α) (List.{u1} (Lists.{u1} α)) (List.instMembershipList.{u1} (Lists.{u1} α)) a' (Lists'.toList.{u1} α b l)) (Lists.Equiv.{u1} α a a')))
-Case conversion may be inaccurate. Consider using '#align lists'.mem_def Lists'.mem_defₓ'. -/
 theorem mem_def {b a} {l : Lists' α b} : a ∈ l ↔ ∃ a' ∈ l.toList, a ~ a' :=
   Iff.rfl
 #align lists'.mem_def Lists'.mem_def
 
-/- warning: lists'.mem_cons -> Lists'.mem_cons is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {a : Lists.{u1} α} {y : Lists.{u1} α} {l : Lists'.{u1} α Bool.true}, Iff (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a (Lists'.cons.{u1} α y l)) (Or (Lists.Equiv.{u1} α a y) (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a l))
-but is expected to have type
-  forall {α : Type.{u1}} {a : Lists.{u1} α} {y : Lists.{u1} α} {l : Lists'.{u1} α Bool.true}, Iff (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a (Lists'.cons.{u1} α y l)) (Or (Lists.Equiv.{u1} α a y) (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a l))
-Case conversion may be inaccurate. Consider using '#align lists'.mem_cons Lists'.mem_consₓ'. -/
 @[simp]
 theorem mem_cons {a y l} : a ∈ @cons α y l ↔ a ~ y ∨ a ∈ l := by
   simp [mem_def, or_and_right, exists_or]
 #align lists'.mem_cons Lists'.mem_cons
 
-/- warning: lists'.cons_subset -> Lists'.cons_subset is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {a : Lists.{u1} α} {l₁ : Lists'.{u1} α Bool.true} {l₂ : Lists'.{u1} α Bool.true}, Iff (HasSubset.Subset.{u1} (Lists'.{u1} α Bool.true) (Lists'.hasSubset.{u1} α) (Lists'.cons.{u1} α a l₁) l₂) (And (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a l₂) (HasSubset.Subset.{u1} (Lists'.{u1} α Bool.true) (Lists'.hasSubset.{u1} α) l₁ l₂))
-but is expected to have type
-  forall {α : Type.{u1}} {a : Lists.{u1} α} {l₁ : Lists'.{u1} α Bool.true} {l₂ : Lists'.{u1} α Bool.true}, Iff (HasSubset.Subset.{u1} (Lists'.{u1} α Bool.true) (Lists'.instHasSubsetLists'True.{u1} α) (Lists'.cons.{u1} α a l₁) l₂) (And (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a l₂) (HasSubset.Subset.{u1} (Lists'.{u1} α Bool.true) (Lists'.instHasSubsetLists'True.{u1} α) l₁ l₂))
-Case conversion may be inaccurate. Consider using '#align lists'.cons_subset Lists'.cons_subsetₓ'. -/
 theorem cons_subset {a} {l₁ l₂ : Lists' α true} : Lists'.cons a l₁ ⊆ l₂ ↔ a ∈ l₂ ∧ l₁ ⊆ l₂ :=
   by
   refine' ⟨fun h => _, fun ⟨⟨a', m, e⟩, s⟩ => subset.cons e m s⟩
@@ -231,12 +213,6 @@ theorem subset_nil {l : Lists' α true} : l ⊆ Lists'.nil → l = Lists'.nil :=
 #align lists'.subset_nil Lists'.subset_nil
 -/
 
-/- warning: lists'.mem_of_subset' -> Lists'.mem_of_subset' is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {a : Lists.{u1} α} {l₁ : Lists'.{u1} α Bool.true} {l₂ : Lists'.{u1} α Bool.true}, (HasSubset.Subset.{u1} (Lists'.{u1} α Bool.true) (Lists'.hasSubset.{u1} α) l₁ l₂) -> (Membership.Mem.{u1, u1} (Lists.{u1} α) (List.{u1} (Lists.{u1} α)) (List.hasMem.{u1} (Lists.{u1} α)) a (Lists'.toList.{u1} α Bool.true l₁)) -> (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a l₂)
-but is expected to have type
-  forall {α : Type.{u1}} {a : Lists.{u1} α} {l₁ : Lists'.{u1} α Bool.true} {l₂ : Lists'.{u1} α Bool.true}, (HasSubset.Subset.{u1} (Lists'.{u1} α Bool.true) (Lists'.instHasSubsetLists'True.{u1} α) l₁ l₂) -> (Membership.mem.{u1, u1} (Lists.{u1} α) (List.{u1} (Lists.{u1} α)) (List.instMembershipList.{u1} (Lists.{u1} α)) a (Lists'.toList.{u1} α Bool.true l₁)) -> (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a l₂)
-Case conversion may be inaccurate. Consider using '#align lists'.mem_of_subset' Lists'.mem_of_subset'ₓ'. -/
 theorem mem_of_subset' {a} {l₁ l₂ : Lists' α true} (s : l₁ ⊆ l₂) (h : a ∈ l₁.toList) : a ∈ l₂ :=
   by
   induction' s with _ a a' l l' e m s IH; · cases h
@@ -244,12 +220,6 @@ theorem mem_of_subset' {a} {l₁ l₂ : Lists' α true} (s : l₁ ⊆ l₂) (h :
   exacts[⟨_, m, e⟩, IH h]
 #align lists'.mem_of_subset' Lists'.mem_of_subset'
 
-/- warning: lists'.subset_def -> Lists'.subset_def is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l₁ : Lists'.{u1} α Bool.true} {l₂ : Lists'.{u1} α Bool.true}, Iff (HasSubset.Subset.{u1} (Lists'.{u1} α Bool.true) (Lists'.hasSubset.{u1} α) l₁ l₂) (forall (a : Lists.{u1} α), (Membership.Mem.{u1, u1} (Lists.{u1} α) (List.{u1} (Lists.{u1} α)) (List.hasMem.{u1} (Lists.{u1} α)) a (Lists'.toList.{u1} α Bool.true l₁)) -> (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a l₂))
-but is expected to have type
-  forall {α : Type.{u1}} {l₁ : Lists'.{u1} α Bool.true} {l₂ : Lists'.{u1} α Bool.true}, Iff (HasSubset.Subset.{u1} (Lists'.{u1} α Bool.true) (Lists'.instHasSubsetLists'True.{u1} α) l₁ l₂) (forall (a : Lists.{u1} α), (Membership.mem.{u1, u1} (Lists.{u1} α) (List.{u1} (Lists.{u1} α)) (List.instMembershipList.{u1} (Lists.{u1} α)) a (Lists'.toList.{u1} α Bool.true l₁)) -> (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a l₂))
-Case conversion may be inaccurate. Consider using '#align lists'.subset_def Lists'.subset_defₓ'. -/
 theorem subset_def {l₁ l₂ : Lists' α true} : l₁ ⊆ l₂ ↔ ∀ a ∈ l₁.toList, a ∈ l₂ :=
   ⟨fun H a => mem_of_subset' H, fun H =>
     by
@@ -434,24 +404,12 @@ def Equiv.decidableMeas :
 
 open WellFoundedTactics
 
-/- warning: lists.sizeof_pos -> Lists.sizeof_pos is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {b : Bool} (l : Lists'.{u1} α b), LT.lt.{0} Nat Nat.hasLt (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) (SizeOf.sizeOf.{succ u1} (Lists'.{u1} α b) (Lists'.hasSizeofInst.{u1} α (defaultHasSizeof.{succ u1} α) b) l)
-but is expected to have type
-  forall {α : Type.{u1}} {b : Bool} (l : Lists'.{u1} α b), LT.lt.{0} Nat instLTNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) (SizeOf.sizeOf.{succ u1} (Lists'.{u1} α b) (Lists'._sizeOf_inst.{u1} α b (instSizeOf.{succ u1} α)) l)
-Case conversion may be inaccurate. Consider using '#align lists.sizeof_pos Lists.sizeof_posₓ'. -/
 theorem sizeof_pos {b} (l : Lists' α b) : 0 < SizeOf.sizeOf l := by
   cases l <;>
     run_tac
       andthen unfold_sizeof trivial_nat_lt
 #align lists.sizeof_pos Lists.sizeof_pos
 
-/- warning: lists.lt_sizeof_cons' -> Lists.lt_sizeof_cons' is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {b : Bool} (a : Lists'.{u1} α b) (l : Lists'.{u1} α Bool.true), LT.lt.{0} Nat Nat.hasLt (SizeOf.sizeOf.{succ u1} (Sigma.{0, u1} Bool (fun (b : Bool) => Lists'.{u1} α b)) (Sigma.hasSizeof.{0, u1} Bool (fun (b : Bool) => Lists'.{u1} α b) Bool.hasSizeof (fun (a : Bool) => Lists'.hasSizeofInst.{u1} α (defaultHasSizeof.{succ u1} α) a)) (Sigma.mk.{0, u1} Bool (fun (b : Bool) => Lists'.{u1} α b) b a)) (SizeOf.sizeOf.{succ u1} (Lists'.{u1} α Bool.true) (Lists'.hasSizeofInst.{u1} α (defaultHasSizeof.{succ u1} α) Bool.true) (Lists'.cons'.{u1} α b a l))
-but is expected to have type
-  forall {α : Type.{u1}} {b : Bool} (a : Lists'.{u1} α b) (l : Lists'.{u1} α Bool.true), LT.lt.{0} Nat instLTNat (SizeOf.sizeOf.{succ u1} (Sigma.{0, u1} Bool (fun (b : Bool) => Lists'.{u1} α b)) (Sigma._sizeOf_inst.{0, u1} Bool (fun (b : Bool) => Lists'.{u1} α b) Bool._sizeOf_inst (fun (a : Bool) => Lists'._sizeOf_inst.{u1} α a (instSizeOf.{succ u1} α))) (Sigma.mk.{0, u1} Bool (fun (b : Bool) => Lists'.{u1} α b) b a)) (SizeOf.sizeOf.{succ u1} (Lists'.{u1} α Bool.true) (Lists'._sizeOf_inst.{u1} α Bool.true (instSizeOf.{succ u1} α)) (Lists'.cons'.{u1} α b a l))
-Case conversion may be inaccurate. Consider using '#align lists.lt_sizeof_cons' Lists.lt_sizeof_cons'ₓ'. -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.unfold_sizeof -/
 theorem lt_sizeof_cons' {b} (a : Lists' α b) (l) :
     SizeOf.sizeOf (⟨b, a⟩ : Lists α) < SizeOf.sizeOf (Lists'.cons' a l) := by
@@ -463,12 +421,6 @@ theorem lt_sizeof_cons' {b} (a : Lists' α b) (l) :
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
-/- warning: lists.mem.decidable -> Lists.mem.decidable is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (a : Lists.{u1} α) (l : Lists'.{u1} α Bool.true), Decidable (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a l)
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (a : Lists.{u1} α) (l : Lists'.{u1} α Bool.true), Decidable (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a l)
-Case conversion may be inaccurate. Consider using '#align lists.mem.decidable Lists.mem.decidableₓ'. -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
 #print Lists.Equiv.decidable /-
 mutual
@@ -550,23 +502,11 @@ end Lists
 
 namespace Lists'
 
-/- warning: lists'.mem_equiv_left -> Lists'.mem_equiv_left is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {l : Lists'.{u1} α Bool.true} {a : Lists.{u1} α} {a' : Lists.{u1} α}, (Lists.Equiv.{u1} α a a') -> (Iff (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a l) (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a' l))
-but is expected to have type
-  forall {α : Type.{u1}} {l : Lists'.{u1} α Bool.true} {a : Lists.{u1} α} {a' : Lists.{u1} α}, (Lists.Equiv.{u1} α a a') -> (Iff (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a l) (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a' l))
-Case conversion may be inaccurate. Consider using '#align lists'.mem_equiv_left Lists'.mem_equiv_leftₓ'. -/
 theorem mem_equiv_left {l : Lists' α true} : ∀ {a a'}, a ~ a' → (a ∈ l ↔ a' ∈ l) :=
   suffices ∀ {a a'}, a ~ a' → a ∈ l → a' ∈ l from fun a a' e => ⟨this e, this e.symm⟩
   fun a₁ a₂ e₁ ⟨a₃, m₃, e₂⟩ => ⟨_, m₃, e₁.symm.trans e₂⟩
 #align lists'.mem_equiv_left Lists'.mem_equiv_left
 
-/- warning: lists'.mem_of_subset -> Lists'.mem_of_subset is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {a : Lists.{u1} α} {l₁ : Lists'.{u1} α Bool.true} {l₂ : Lists'.{u1} α Bool.true}, (HasSubset.Subset.{u1} (Lists'.{u1} α Bool.true) (Lists'.hasSubset.{u1} α) l₁ l₂) -> (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a l₁) -> (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a l₂)
-but is expected to have type
-  forall {α : Type.{u1}} {a : Lists.{u1} α} {l₁ : Lists'.{u1} α Bool.true} {l₂ : Lists'.{u1} α Bool.true}, (HasSubset.Subset.{u1} (Lists'.{u1} α Bool.true) (Lists'.instHasSubsetLists'True.{u1} α) l₁ l₂) -> (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a l₁) -> (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a l₂)
-Case conversion may be inaccurate. Consider using '#align lists'.mem_of_subset Lists'.mem_of_subsetₓ'. -/
 theorem mem_of_subset {a} {l₁ l₂ : Lists' α true} (s : l₁ ⊆ l₂) : a ∈ l₁ → a ∈ l₂
   | ⟨a', m, e⟩ => (mem_equiv_left e).2 (mem_of_subset' s m)
 #align lists'.mem_of_subset Lists'.mem_of_subset
Diff
@@ -202,9 +202,7 @@ theorem cons_subset {a} {l₁ l₂ : Lists' α true} : Lists'.cons a l₁ ⊆ l
   by
   refine' ⟨fun h => _, fun ⟨⟨a', m, e⟩, s⟩ => subset.cons e m s⟩
   generalize h' : Lists'.cons a l₁ = l₁' at h
-  cases' h with l a' a'' l l' e m s;
-  · cases a
-    cases h'
+  cases' h with l a' a'' l l' e m s; · cases a; cases h'
   cases a; cases a'; cases h'; exact ⟨⟨_, m, e⟩, s⟩
 #align lists'.cons_subset Lists'.cons_subset
 
@@ -258,8 +256,7 @@ theorem subset_def {l₁ l₂ : Lists' α true} : l₁ ⊆ l₂ ↔ ∀ a ∈ l
     rw [← of_to_list l₁]
     revert H; induction to_list l₁ <;> intro
     · exact subset.nil
-    · simp at H
-      exact cons_subset.2 ⟨H.1, ih H.2⟩⟩
+    · simp at H; exact cons_subset.2 ⟨H.1, ih H.2⟩⟩
 #align lists'.subset_def Lists'.subset_def
 
 end Lists'
@@ -341,12 +338,10 @@ def inductionMut (C : Lists α → Sort _) (D : Lists' α true → Sort _) (C0 :
         | tt, l => D l
         | ff, l => PUnit)
     by exact ⟨fun ⟨b, l⟩ => (this _).1, fun l => (this l).2⟩
-  intros
-  induction' l with a b a l IH₁ IH₂
+  intros ; induction' l with a b a l IH₁ IH₂
   · exact ⟨C0 _, ⟨⟩⟩
   · exact ⟨C1 _ D0, D0⟩
-  · suffices
-    · exact ⟨C1 _ this, this⟩
+  · suffices; · exact ⟨C1 _ this, this⟩
     exact D1 ⟨_, _⟩ _ IH₁.1 IH₂.2
 #align lists.induction_mut Lists.inductionMut
 -/
@@ -402,10 +397,8 @@ theorem Equiv.trans : ∀ {l₁ l₂ l₃ : Lists α}, l₁ ~ l₂ → l₂ ~ l
   · intro a l₂ l₃ h₁ h₂
     rwa [← equiv_atom.1 h₁] at h₂
   · intro l₁ IH l₂ l₃ h₁ h₂
-    cases' h₁ with _ _ l₂
-    · exact h₂
-    cases' h₂ with _ _ l₃
-    · exact h₁
+    cases' h₁ with _ _ l₂; · exact h₂
+    cases' h₂ with _ _ l₃; · exact h₁
     cases' equiv.antisymm_iff.1 h₁ with hl₁ hr₁
     cases' equiv.antisymm_iff.1 h₂ with hl₂ hr₂
     apply equiv.antisymm_iff.2 <;> constructor <;> apply Lists'.subset_def.2
@@ -418,8 +411,7 @@ theorem Equiv.trans : ∀ {l₁ l₂ l₃ : Lists α}, l₁ ~ l₂ → l₂ ~ l
       rcases Lists'.mem_of_subset' hr₁ m₂ with ⟨a₁, m₁, e₂₁⟩
       exact ⟨a₁, m₁, (IH _ m₁ e₂₁.symm e₃₂.symm).symm⟩
   · rintro _ ⟨⟩
-  · intro a l IH₁ IH₂
-    simpa [IH₁] using IH₂
+  · intro a l IH₁ IH₂; simpa [IH₁] using IH₂
 #align lists.equiv.trans Lists.Equiv.trans
 -/
 
@@ -462,10 +454,9 @@ but is expected to have type
 Case conversion may be inaccurate. Consider using '#align lists.lt_sizeof_cons' Lists.lt_sizeof_cons'ₓ'. -/
 /- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.unfold_sizeof -/
 theorem lt_sizeof_cons' {b} (a : Lists' α b) (l) :
-    SizeOf.sizeOf (⟨b, a⟩ : Lists α) < SizeOf.sizeOf (Lists'.cons' a l) :=
-  by
+    SizeOf.sizeOf (⟨b, a⟩ : Lists α) < SizeOf.sizeOf (Lists'.cons' a l) := by
   run_tac
-    unfold_sizeof
+    unfold_sizeof;
   apply sizeof_pos
 #align lists.lt_sizeof_cons' Lists.lt_sizeof_cons'
 
Diff
@@ -389,7 +389,7 @@ theorem equiv_atom {a} {l : Lists α} : atom a ~ l ↔ atom a = l :=
 
 #print Lists.Equiv.symm /-
 theorem Equiv.symm {l₁ l₂ : Lists α} (h : l₁ ~ l₂) : l₂ ~ l₁ := by
-  cases' h with _ _ _ h₁ h₂ <;> [rfl, exact equiv.antisymm h₂ h₁]
+  cases' h with _ _ _ h₁ h₂ <;> [rfl;exact equiv.antisymm h₂ h₁]
 #align lists.equiv.symm Lists.Equiv.symm
 -/
 
Diff
@@ -460,7 +460,7 @@ lean 3 declaration is
 but is expected to have type
   forall {α : Type.{u1}} {b : Bool} (a : Lists'.{u1} α b) (l : Lists'.{u1} α Bool.true), LT.lt.{0} Nat instLTNat (SizeOf.sizeOf.{succ u1} (Sigma.{0, u1} Bool (fun (b : Bool) => Lists'.{u1} α b)) (Sigma._sizeOf_inst.{0, u1} Bool (fun (b : Bool) => Lists'.{u1} α b) Bool._sizeOf_inst (fun (a : Bool) => Lists'._sizeOf_inst.{u1} α a (instSizeOf.{succ u1} α))) (Sigma.mk.{0, u1} Bool (fun (b : Bool) => Lists'.{u1} α b) b a)) (SizeOf.sizeOf.{succ u1} (Lists'.{u1} α Bool.true) (Lists'._sizeOf_inst.{u1} α Bool.true (instSizeOf.{succ u1} α)) (Lists'.cons'.{u1} α b a l))
 Case conversion may be inaccurate. Consider using '#align lists.lt_sizeof_cons' Lists.lt_sizeof_cons'ₓ'. -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic well_founded_tactics.unfold_sizeof -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.unfold_sizeof -/
 theorem lt_sizeof_cons' {b} (a : Lists' α b) (l) :
     SizeOf.sizeOf (⟨b, a⟩ : Lists α) < SizeOf.sizeOf (Lists'.cons' a l) :=
   by
@@ -469,16 +469,16 @@ theorem lt_sizeof_cons' {b} (a : Lists' α b) (l) :
   apply sizeof_pos
 #align lists.lt_sizeof_cons' Lists.lt_sizeof_cons'
 
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
 /- warning: lists.mem.decidable -> Lists.mem.decidable is a dubious translation:
 lean 3 declaration is
   forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (a : Lists.{u1} α) (l : Lists'.{u1} α Bool.true), Decidable (Membership.Mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.hasMem.{u1} α Bool.true) a l)
 but is expected to have type
   forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α] (a : Lists.{u1} α) (l : Lists'.{u1} α Bool.true), Decidable (Membership.mem.{u1, u1} (Lists.{u1} α) (Lists'.{u1} α Bool.true) (Lists'.instMembershipListsLists'.{u1} α Bool.true) a l)
 Case conversion may be inaccurate. Consider using '#align lists.mem.decidable Lists.mem.decidableₓ'. -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic well_founded_tactics.default_dec_tac -/
 #print Lists.Equiv.decidable /-
 mutual
   @[instance]
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 
 ! This file was ported from Lean 3 source module set_theory.lists
-! leanprover-community/mathlib commit 0ebfdb71919ac6ca5d7fbc61a082fa2519556818
+! leanprover-community/mathlib commit 497d1e06409995dd8ec95301fa8d8f3480187f4c
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -42,11 +42,8 @@ This calls for a two-steps definition of ZFA lists:
 * `lists' α tt`: Proper ZFA prelists. Defined inductively from the empty ZFA prelist (`lists'.nil`)
   and from appending a ZFA prelist to a proper ZFA prelist (`lists'.cons a l`).
 * `lists α`: ZFA lists. Sum of the atoms and proper ZFA prelists.
-
-## TODO
-
-The next step is to define ZFA sets as lists quotiented by `lists.equiv`.
-(-/
+* `finsets`: ZFA sets. Defined as `lists` quotiented by `lists.equiv`, the extensional equivalence.
+-/
 
 
 variable {α : Type _}
Diff
@@ -366,11 +366,11 @@ def mem (a : Lists α) : Lists α → Prop
 instance : Membership (Lists α) (Lists α) :=
   ⟨mem⟩
 
-#print Lists.is_list_of_mem /-
-theorem is_list_of_mem {a : Lists α} : ∀ {l : Lists α}, a ∈ l → IsList l
+#print Lists.isList_of_mem /-
+theorem isList_of_mem {a : Lists α} : ∀ {l : Lists α}, a ∈ l → IsList l
   | ⟨_, Lists'.nil⟩, _ => rfl
   | ⟨_, Lists'.cons' _ _⟩, _ => rfl
-#align lists.is_list_of_mem Lists.is_list_of_mem
+#align lists.is_list_of_mem Lists.isList_of_mem
 -/
 
 #print Lists.Equiv.antisymm_iff /-

Changes in mathlib4

mathlib3
mathlib4
chore: Split Data.{Nat,Int}{.Order}.Basic in group vs ring instances (#11924)

Scatter the content of Data.Nat.Basic across:

  • Data.Nat.Defs for the lemmas having no dependencies
  • Algebra.Group.Nat for the monoid instances and the few miscellaneous lemmas needing them.
  • Algebra.Ring.Nat for the semiring instance and the few miscellaneous lemmas following it.

Similarly, scatter

  • Data.Int.Basic across Data.Int.Defs, Algebra.Group.Int, Algebra.Ring.Int
  • Data.Nat.Order.Basic across Data.Nat.Defs, Algebra.Order.Group.Nat, Algebra.Order.Ring.Nat
  • Data.Int.Order.Basic across Data.Int.Defs, Algebra.Order.Group.Int, Algebra.Order.Ring.Int

Also move a few lemmas from Data.Nat.Order.Lemmas to Data.Nat.Defs.

Before pre_11924

After post_11924

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 -/
 import Mathlib.Data.Sigma.Basic
-import Mathlib.Data.Nat.Order.Basic
+import Mathlib.Algebra.Order.Ring.Nat
 
 #align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
 
chore: remove unneeded decreasing_by and termination_by (#11386)

The termination checker has been getting more capable, and many of the termination_by or decreasing_by clauses in Mathlib are no longer needed.

(Note that termination_by? will show the automatically derived termination expression, so no information is being lost by removing these.)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -358,7 +358,7 @@ instance instSetoidLists : Setoid (Lists α) :=
 section Decidable
 
 /-- Auxiliary function to prove termination of decidability checking -/
-@[simp, deprecated] -- Porting note: replaced by termination_by
+@[simp, deprecated]
 def Equiv.decidableMeas :
     (PSum (Σ' _l₁ : Lists α, Lists α) <|
         PSum (Σ' _l₁ : Lists' α true, Lists' α true) (Σ' _a : Lists α, Lists' α true)) →
chore: squeeze some non-terminal simps (#11247)

This PR accompanies #11246, squeezing some non-terminal simps highlighted by the linter until I decided to stop!

Diff
@@ -176,7 +176,7 @@ theorem ofList_subset {l₁ l₂ : List (Lists α)} (h : l₁ ⊆ l₂) :
     Lists'.ofList l₁ ⊆ Lists'.ofList l₂ := by
   induction' l₁ with _ _ l₁_ih; · exact Subset.nil
   refine' Subset.cons (Lists.Equiv.refl _) _ (l₁_ih (List.subset_of_cons_subset h))
-  simp at h; simp [h]
+  simp only [List.cons_subset] at h; simp [h]
 #align lists'.of_list_subset Lists'.ofList_subset
 
 @[refl]
@@ -387,7 +387,7 @@ mutual
       decidable_of_iff' (l₁ = l₂) <| by
         cases l₁
         apply equiv_atom.trans
-        simp [atom]
+        simp only [atom]
         constructor <;> (rintro ⟨rfl⟩; rfl)
     | ⟨false, l₁⟩, ⟨true, l₂⟩ => isFalse <| by rintro ⟨⟩
     | ⟨true, l₁⟩, ⟨false, l₂⟩ => isFalse <| by rintro ⟨⟩
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -358,7 +358,7 @@ instance instSetoidLists : Setoid (Lists α) :=
 section Decidable
 
 /-- Auxiliary function to prove termination of decidability checking -/
-@[simp, deprecated] -- porting note: replaced by termination_by
+@[simp, deprecated] -- Porting note: replaced by termination_by
 def Equiv.decidableMeas :
     (PSum (Σ' _l₁ : Lists α, Lists α) <|
         PSum (Σ' _l₁ : Lists' α true, Lists' α true) (Σ' _a : Lists α, Lists' α true)) →
chore: more backporting of simp changes from #10995 (#11001)

Co-authored-by: Patrick Massot <patrickmassot@free.fr> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -117,7 +117,7 @@ theorem of_toList : ∀ l : Lists' α true, ofList (toList l) = l :=
       -- change l' with cons' a l
       --
       -- This can be removed.
-      simpa [cons] using IH rfl
+      simpa [cons, l'] using IH rfl
 #align lists'.of_to_list Lists'.of_toList
 
 end Lists'
chore: classify added to ease automation porting notes (#10689)
  • Classifies by adding issue number (#10688) to porting notes claiming anything semantically equivalent to added to ease automation.
  • Enforce singular convention converting "porting notes" to "porting note".
Diff
@@ -83,7 +83,7 @@ def toList : ∀ {b}, Lists' α b → List (Lists α)
   | _, cons' a l => ⟨_, a⟩ :: l.toList
 #align lists'.to_list Lists'.toList
 
--- Porting notes (#10618): removed @[simp]
+-- Porting note (#10618): removed @[simp]
 -- simp can prove this: by simp only [@Lists'.toList, @Sigma.eta]
 theorem toList_cons (a : Lists α) (l) : toList (cons a l) = a :: l.toList := by simp
 #align lists'.to_list_cons Lists'.toList_cons
chore: classify simp can do this porting notes (#10619)

Classify by adding issue number (#10618) to porting notes claiming anything semantically equivalent to simp can prove this or simp can simplify this.

Diff
@@ -83,7 +83,7 @@ def toList : ∀ {b}, Lists' α b → List (Lists α)
   | _, cons' a l => ⟨_, a⟩ :: l.toList
 #align lists'.to_list Lists'.toList
 
--- Porting note: removed @[simp]
+-- Porting notes (#10618): removed @[simp]
 -- simp can prove this: by simp only [@Lists'.toList, @Sigma.eta]
 theorem toList_cons (a : Lists α) (l) : toList (cons a l) = a :: l.toList := by simp
 #align lists'.to_list_cons Lists'.toList_cons
chore: change from plural to singular in porting notes (#10761)
Diff
@@ -83,7 +83,7 @@ def toList : ∀ {b}, Lists' α b → List (Lists α)
   | _, cons' a l => ⟨_, a⟩ :: l.toList
 #align lists'.to_list Lists'.toList
 
--- porting notes: removed @[simp]
+-- Porting note: removed @[simp]
 -- simp can prove this: by simp only [@Lists'.toList, @Sigma.eta]
 theorem toList_cons (a : Lists α) (l) : toList (cons a l) = a :: l.toList := by simp
 #align lists'.to_list_cons Lists'.toList_cons
@@ -476,7 +476,7 @@ instance : Inhabited (Finsets α) :=
 
 instance [DecidableEq α] : DecidableEq (Finsets α) := by
   unfold Finsets
-  -- porting notes: infer_instance does not work for some reason
+  -- Porting note: infer_instance does not work for some reason
   exact (Quotient.decidableEq (d := fun _ _ => Lists.Equiv.decidable _ _))
 
 end Finsets
chore: move to v4.6.0-rc1, merging adaptations from bump/v4.6.0 (#10176)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>

Diff
@@ -403,6 +403,7 @@ mutual
           by decreasing_tactic
         Subset.decidable l₂ l₁
       exact decidable_of_iff' _ Equiv.antisymm_iff
+  termination_by x y => sizeOf x + sizeOf y
   instance Subset.decidable : ∀ l₁ l₂ : Lists' α true, Decidable (l₁ ⊆ l₂)
     | Lists'.nil, l₂ => isTrue Lists'.Subset.nil
     | @Lists'.cons' _ b a l₁, l₂ => by
@@ -415,6 +416,7 @@ mutual
           by decreasing_tactic
         Subset.decidable l₁ l₂
       exact decidable_of_iff' _ (@Lists'.cons_subset _ ⟨_, _⟩ _ _)
+  termination_by x y => sizeOf x + sizeOf y
   instance mem.decidable : ∀ (a : Lists α) (l : Lists' α true), Decidable (a ∈ l)
     | a, Lists'.nil => isFalse <| by rintro ⟨_, ⟨⟩, _⟩
     | a, Lists'.cons' b l₂ => by
@@ -429,11 +431,8 @@ mutual
         mem.decidable a l₂
       refine' decidable_of_iff' (a ~ ⟨_, b⟩ ∨ a ∈ l₂) _
       rw [← Lists'.mem_cons]; rfl
+  termination_by x y => sizeOf x + sizeOf y
 end
-termination_by
-  Subset.decidable x y => sizeOf x + sizeOf y
-  Equiv.decidable x y => sizeOf x + sizeOf y
-  mem.decidable x y => sizeOf x + sizeOf y
 #align lists.equiv.decidable Lists.Equiv.decidable
 #align lists.subset.decidable Lists.Subset.decidable
 #align lists.mem.decidable Lists.mem.decidable
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -3,7 +3,8 @@ Copyright (c) 2018 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 -/
-import Mathlib.Data.List.Basic
+import Mathlib.Data.Sigma.Basic
+import Mathlib.Data.Nat.Order.Basic
 
 #align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
 
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -369,7 +369,7 @@ def Equiv.decidableMeas :
 
 theorem sizeof_pos {b} (l : Lists' α b) : 0 < SizeOf.sizeOf l := by
   cases l <;> simp only [Lists'.atom.sizeOf_spec, Lists'.nil.sizeOf_spec, Lists'.cons'.sizeOf_spec,
-    true_or, add_pos_iff]
+    true_or, add_pos_iff, zero_lt_one]
 #align lists.sizeof_pos Lists.sizeof_pos
 
 theorem lt_sizeof_cons' {b} (a : Lists' α b) (l) :
chore: bump std (#7694)

Some deleted lemmas have been upstreamed to Std.

Note that the statements of List.zipWith_map_left (and _right) have been changed, requiring slight changes here.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr>

Diff
@@ -437,6 +437,9 @@ termination_by
 #align lists.subset.decidable Lists.Subset.decidable
 #align lists.mem.decidable Lists.mem.decidable
 
+-- This is an autogenerated declaration, so there's nothing we can do about it.
+attribute [nolint nonClassInstance] Lists.Equiv.decidable._unary._mutual
+
 end Decidable
 
 end Lists
style: fix multiple spaces before colon (#7411)

Purely cosmetic PR

Diff
@@ -402,7 +402,7 @@ mutual
           by decreasing_tactic
         Subset.decidable l₂ l₁
       exact decidable_of_iff' _ Equiv.antisymm_iff
-  instance Subset.decidable  : ∀ l₁ l₂ : Lists' α true, Decidable (l₁ ⊆ l₂)
+  instance Subset.decidable : ∀ l₁ l₂ : Lists' α true, Decidable (l₁ ⊆ l₂)
     | Lists'.nil, l₂ => isTrue Lists'.Subset.nil
     | @Lists'.cons' _ b a l₁, l₂ => by
       haveI :=
@@ -414,7 +414,7 @@ mutual
           by decreasing_tactic
         Subset.decidable l₁ l₂
       exact decidable_of_iff' _ (@Lists'.cons_subset _ ⟨_, _⟩ _ _)
-  instance mem.decidable  : ∀ (a : Lists α) (l : Lists' α true), Decidable (a ∈ l)
+  instance mem.decidable : ∀ (a : Lists α) (l : Lists' α true), Decidable (a ∈ l)
     | a, Lists'.nil => isFalse <| by rintro ⟨_, ⟨⟩, _⟩
     | a, Lists'.cons' b l₂ => by
       haveI :=
feat: add some symm attributes throughout the library (#6708)

Also add a couple of refl and trans attributes

Diff
@@ -307,6 +307,7 @@ theorem equiv_atom {a} {l : Lists α} : atom a ~ l ↔ atom a = l :=
   ⟨fun h => by cases h; rfl, fun h => h ▸ Equiv.refl _⟩
 #align lists.equiv_atom Lists.equiv_atom
 
+@[symm]
 theorem Equiv.symm {l₁ l₂ : Lists α} (h : l₁ ~ l₂) : l₂ ~ l₁ := by
   cases' h with _ _ _ h₁ h₂ <;> [rfl; exact Equiv.antisymm h₂ h₁]
 #align lists.equiv.symm Lists.Equiv.symm
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -41,7 +41,7 @@ This calls for a two-steps definition of ZFA lists:
 -/
 
 
-variable {α : Type _}
+variable {α : Type*}
 
 /-- Prelists, helper type to define `Lists`. `Lists' α false` are the "atoms", a copy of `α`.
 `Lists' α true` are the "proper" ZFA prelists, inductively defined from the empty ZFA prelist and
@@ -59,7 +59,7 @@ compile_inductive% Lists'
 /-- Hereditarily finite list, aka ZFA list. A ZFA list is either an "atom" (`b = false`),
 corresponding to an element of `α`, or a "proper" ZFA list, inductively defined from the empty ZFA
 list and from appending a ZFA list to a proper ZFA list. -/
-def Lists (α : Type _) :=
+def Lists (α : Type*) :=
   Σb, Lists' α b
 #align lists Lists
 
@@ -260,7 +260,7 @@ instance [DecidableEq α] : DecidableEq (Lists α) := by unfold Lists; infer_ins
 instance [SizeOf α] : SizeOf (Lists α) := by unfold Lists; infer_instance
 
 /-- A recursion principle for pairs of ZFA lists and proper ZFA prelists. -/
-def inductionMut (C : Lists α → Sort _) (D : Lists' α true → Sort _)
+def inductionMut (C : Lists α → Sort*) (D : Lists' α true → Sort*)
     (C0 : ∀ a, C (atom a)) (C1 : ∀ l, D l → C (of' l))
     (D0 : D Lists'.nil) (D1 : ∀ a l, C a → D l → D (Lists'.cons a l)) :
     PProd (∀ l, C l) (∀ l, D l) := by
@@ -458,7 +458,7 @@ theorem Subset.trans {l₁ l₂ l₃ : Lists' α true} (h₁ : l₁ ⊆ l₂) (h
 end Lists'
 
 /-- `Finsets` are defined via equivalence classes of `Lists` -/
-def Finsets (α : Type _) :=
+def Finsets (α : Type*) :=
   Quotient (@Lists.instSetoidLists α)
 #align finsets Finsets
 
chore: ensure all instances referred to directly have explicit names (#6423)

Per https://github.com/leanprover/lean4/issues/2343, we are going to need to change the automatic generation of instance names, as they become too long.

This PR ensures that everywhere in Mathlib that refers to an instance by name, that name is given explicitly, rather than being automatically generated.

There are four exceptions, which are now commented, with links to https://github.com/leanprover/lean4/issues/2343.

This was implemented by running Mathlib against a modified Lean that appended _ᾰ to all automatically generated names, and fixing everything.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -350,7 +350,7 @@ theorem Equiv.trans : ∀ {l₁ l₂ l₃ : Lists α}, l₁ ~ l₂ → l₂ ~ l
       exact IH _ h₁ h₂ h₃
 #align lists.equiv.trans Lists.Equiv.trans
 
-instance : Setoid (Lists α) :=
+instance instSetoidLists : Setoid (Lists α) :=
   ⟨(· ~ ·), Equiv.refl, @Equiv.symm _, @Equiv.trans _⟩
 
 section Decidable
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2018 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module set_theory.lists
-! leanprover-community/mathlib commit 497d1e06409995dd8ec95301fa8d8f3480187f4c
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.List.Basic
 
+#align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
+
 /-!
 # A computable model of ZFA without infinity
 
chore: fix focusing dots (#5708)

This PR is the result of running

find . -type f -name "*.lean" -exec sed -i -E 's/^( +)\. /\1· /' {} \;
find . -type f -name "*.lean" -exec sed -i -E 'N;s/^( +·)\n +(.*)$/\1 \2/;P;D' {} \;

which firstly replaces . focusing dots with · and secondly removes isolated instances of such dots, unifying them with the following line. A new rule is placed in the style linter to verify this.

Diff
@@ -301,7 +301,7 @@ theorem Equiv.antisymm_iff {l₁ l₂ : Lists' α true} : of' l₁ ~ of' l₂ 
   refine' ⟨fun h => _, fun ⟨h₁, h₂⟩ => Equiv.antisymm h₁ h₂⟩
   cases' h with _ _ _ h₁ h₂
   · simp [Lists'.Subset.refl]
-  . exact ⟨h₁, h₂⟩
+  · exact ⟨h₁, h₂⟩
 #align lists.equiv.antisymm_iff Lists.Equiv.antisymm_iff
 
 attribute [refl] Equiv.refl
@@ -347,9 +347,9 @@ theorem Equiv.trans : ∀ {l₁ l₂ l₃ : Lists α}, l₁ ~ l₂ → l₂ ~ l
     -- Assumption fails.
     simp only [Lists'.toList, Sigma.eta, List.find?, List.mem_cons, forall_eq_or_imp]
     constructor
-    . intros l₂ l₃ h₁ h₂
+    · intros l₂ l₃ h₁ h₂
       exact IH₁ h₁ h₂
-    . intros a h₁ l₂ l₃ h₂ h₃
+    · intros a h₁ l₂ l₃ h₂ h₃
       exact IH _ h₁ h₂ h₃
 #align lists.equiv.trans Lists.Equiv.trans
 
chore: remove legacy termination_by' (#5426)

This adds a couple of WellFoundedRelation instances, like for example WellFoundedRelation (WithBot Nat). Longer-term, we should probably add a WellFoundedOrder class for types with a well-founded less-than relation and a [WellFoundOrder α] : WellFoundedRelation α instance (or maybe just [LT α] [IsWellFounded fun a b : α => a < b] : WellFoundedRelation α).

Diff
@@ -359,7 +359,7 @@ instance : Setoid (Lists α) :=
 section Decidable
 
 /-- Auxiliary function to prove termination of decidability checking -/
-@[simp]
+@[simp, deprecated] -- porting note: replaced by termination_by
 def Equiv.decidableMeas :
     (PSum (Σ' _l₁ : Lists α, Lists α) <|
         PSum (Σ' _l₁ : Lists' α true, Lists' α true) (Σ' _a : Lists α, Lists' α true)) →
@@ -430,7 +430,11 @@ mutual
         mem.decidable a l₂
       refine' decidable_of_iff' (a ~ ⟨_, b⟩ ∨ a ∈ l₂) _
       rw [← Lists'.mem_cons]; rfl
-end termination_by' ⟨_, InvImage.wf Equiv.decidableMeas Nat.lt_wfRel.wf⟩
+end
+termination_by
+  Subset.decidable x y => sizeOf x + sizeOf y
+  Equiv.decidable x y => sizeOf x + sizeOf y
+  mem.decidable x y => sizeOf x + sizeOf y
 #align lists.equiv.decidable Lists.Equiv.decidable
 #align lists.subset.decidable Lists.Subset.decidable
 #align lists.mem.decidable Lists.mem.decidable
chore: fix many typos (#4535)

Run codespell Mathlib and keep some suggestions.

Diff
@@ -358,7 +358,7 @@ instance : Setoid (Lists α) :=
 
 section Decidable
 
-/-- Auxillary function to prove termination of decidability checking -/
+/-- Auxiliary function to prove termination of decidability checking -/
 @[simp]
 def Equiv.decidableMeas :
     (PSum (Σ' _l₁ : Lists α, Lists α) <|
feat: add compile_inductive% and compile_def% commands (#4097)

Add a #compile inductive command to compile the recursors of an inductive type, which works by creating a recursive definition and using @[csimp].

Co-authored-by: Parth Shastri <31370288+cppio@users.noreply.github.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -57,6 +57,7 @@ inductive Lists'.{u} (α : Type u) : Bool → Type u
   | cons' {b} : Lists' α b → Lists' α true → Lists' α true
   deriving DecidableEq
 #align lists' Lists'
+compile_inductive% Lists'
 
 /-- Hereditarily finite list, aka ZFA list. A ZFA list is either an "atom" (`b = false`),
 corresponding to an element of `α`, or a "proper" ZFA list, inductively defined from the empty ZFA
@@ -259,14 +260,10 @@ instance : Inhabited (Lists α) :=
 
 instance [DecidableEq α] : DecidableEq (Lists α) := by unfold Lists; infer_instance
 
--- Porting note: 'Lists'._sizeOf_inst' does not have executable code.
--- So noncomputable is added.
-noncomputable instance [SizeOf α] : SizeOf (Lists α) := by unfold Lists; infer_instance
+instance [SizeOf α] : SizeOf (Lists α) := by unfold Lists; infer_instance
 
--- Porting note: Made noncomputable because code generator does not support recursor
--- Lists'.rec yet
 /-- A recursion principle for pairs of ZFA lists and proper ZFA prelists. -/
-noncomputable def inductionMut (C : Lists α → Sort _) (D : Lists' α true → Sort _)
+def inductionMut (C : Lists α → Sort _) (D : Lists' α true → Sort _)
     (C0 : ∀ a, C (atom a)) (C1 : ∀ l, D l → C (of' l))
     (D0 : D Lists'.nil) (D1 : ∀ a l, C a → D l → D (Lists'.cons a l)) :
     PProd (∀ l, C l) (∀ l, D l) := by
@@ -361,10 +358,9 @@ instance : Setoid (Lists α) :=
 
 section Decidable
 
--- porting note: Noncomputable because Lists.instSizeOfLists is
 /-- Auxillary function to prove termination of decidability checking -/
 @[simp]
-noncomputable def Equiv.decidableMeas :
+def Equiv.decidableMeas :
     (PSum (Σ' _l₁ : Lists α, Lists α) <|
         PSum (Σ' _l₁ : Lists' α true, Lists' α true) (Σ' _a : Lists α, Lists' α true)) →
       ℕ
chore: update std 05-22 (#4248)

The main breaking change is that tac <;> [t1, t2] is now written tac <;> [t1; t2], to avoid clashing with tactics like cases and use that take comma-separated lists.

Diff
@@ -314,7 +314,7 @@ theorem equiv_atom {a} {l : Lists α} : atom a ~ l ↔ atom a = l :=
 #align lists.equiv_atom Lists.equiv_atom
 
 theorem Equiv.symm {l₁ l₂ : Lists α} (h : l₁ ~ l₂) : l₂ ~ l₁ := by
-  cases' h with _ _ _ h₁ h₂ <;> [rfl, exact Equiv.antisymm h₂ h₁]
+  cases' h with _ _ _ h₁ h₂ <;> [rfl; exact Equiv.antisymm h₂ h₁]
 #align lists.equiv.symm Lists.Equiv.symm
 
 theorem Equiv.trans : ∀ {l₁ l₂ l₃ : Lists α}, l₁ ~ l₂ → l₂ ~ l₃ → l₁ ~ l₃ := by
chore: bye-bye, solo bys! (#3825)

This PR puts, with one exception, every single remaining by that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh. The exception is when the by begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.

Essentially this is s/\n *by$/ by/g, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated bys".

Diff
@@ -203,8 +203,7 @@ theorem mem_of_subset' {a} : ∀ {l₁ l₂ : Lists' α true} (_ : l₁ ⊆ l₂
 #align lists'.mem_of_subset' Lists'.mem_of_subset'
 
 theorem subset_def {l₁ l₂ : Lists' α true} : l₁ ⊆ l₂ ↔ ∀ a ∈ l₁.toList, a ∈ l₂ :=
-  ⟨fun H a => mem_of_subset' H, fun H =>
-    by
+  ⟨fun H a => mem_of_subset' H, fun H => by
     rw [← of_toList l₁]
     revert H; induction' toList l₁ with h t t_ih <;> intro H
     · exact Subset.nil
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 
 ! This file was ported from Lean 3 source module set_theory.lists
-! leanprover-community/mathlib commit 9003f28797c0664a49e4179487267c494477d853
+! leanprover-community/mathlib commit 497d1e06409995dd8ec95301fa8d8f3480187f4c
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -39,11 +39,9 @@ This calls for a two-steps definition of ZFA lists:
 * `Lists' α true`: Proper ZFA prelists. Defined inductively from the empty ZFA prelist
   (`Lists'.nil`) and from appending a ZFA prelist to a proper ZFA prelist (`Lists'.cons a l`).
 * `Lists α`: ZFA lists. Sum of the atoms and proper ZFA prelists.
-
-## TODO
-
-The next step is to define ZFA sets as lists quotiented by `Lists.Equiv`.
-(-/
+* `Finsets α`: ZFA sets. Defined as `Lists` quotiented by `Lists.Equiv`, the extensional
+  equivalence.
+-/
 
 
 variable {α : Type _}
chore: tidy various files (#2462)
Diff
@@ -110,10 +110,11 @@ theorem of_toList : ∀ l : Lists' α true, ofList (toList l) = l :=
       ofList (toList l') = l'
     from this _ rfl
   fun b h l => by
-    induction l; · cases h
+    induction l with
+    | atom => cases h
     -- Porting note: case nil was not covered.
-    case nil => simp
-    case cons' b a l _ IH =>
+    | nil => simp
+    | cons' b a _ IH =>
       intro l'
       -- Porting note: Previous code was:
       -- change l' with cons' a l
@@ -138,7 +139,6 @@ end
 #align lists.equiv Lists.Equiv
 #align lists'.subset Lists'.Subset
 
--- mathport name: «expr ~ »
 local infixl:50 " ~ " => Lists.Equiv
 
 /-- Equivalence of ZFA lists. Defined inductively. -/
@@ -166,8 +166,7 @@ theorem mem_cons {a y l} : a ∈ @cons α y l ↔ a ~ y ∨ a ∈ l := by
   simp [mem_def, or_and_right, exists_or]
 #align lists'.mem_cons Lists'.mem_cons
 
-theorem cons_subset {a} {l₁ l₂ : Lists' α true} : Lists'.cons a l₁ ⊆ l₂ ↔ a ∈ l₂ ∧ l₁ ⊆ l₂ :=
-  by
+theorem cons_subset {a} {l₁ l₂ : Lists' α true} : Lists'.cons a l₁ ⊆ l₂ ↔ a ∈ l₂ ∧ l₁ ⊆ l₂ := by
   refine' ⟨fun h => _, fun ⟨⟨a', m, e⟩, s⟩ => Subset.cons e m s⟩
   generalize h' : Lists'.cons a l₁ = l₁' at h
   cases' h with l a' a'' l l' e m s;
@@ -188,18 +187,18 @@ theorem Subset.refl {l : Lists' α true} : l ⊆ l := by
   rw [← Lists'.of_toList l]; exact ofList_subset (List.Subset.refl _)
 #align lists'.subset.refl Lists'.Subset.refl
 
-theorem subset_nil {l : Lists' α true} : l ⊆ Lists'.nil → l = Lists'.nil :=
-  by
+theorem subset_nil {l : Lists' α true} : l ⊆ Lists'.nil → l = Lists'.nil := by
   rw [← of_toList l]
-  induction toList l <;> intro h; · rfl
-  rcases cons_subset.1 h with ⟨⟨_, ⟨⟩, _⟩, _⟩
+  induction toList l <;> intro h
+  · rfl
+  · rcases cons_subset.1 h with ⟨⟨_, ⟨⟩, _⟩, _⟩
 #align lists'.subset_nil Lists'.subset_nil
 
-theorem mem_of_subset' {a} : ∀ {l₁ l₂ : Lists' α true} (_ : l₁ ⊆ l₂) (_ : a ∈ l₁.toList),  a ∈ l₂
+theorem mem_of_subset' {a} : ∀ {l₁ l₂ : Lists' α true} (_ : l₁ ⊆ l₂) (_ : a ∈ l₁.toList), a ∈ l₂
   | nil, _, Lists'.Subset.nil, h => by cases h
   | cons' a0 l0, l₂, s, h => by
     cases' s with _ _ _ _ _ e m s
-    simp at h
+    simp only [toList, Sigma.eta, List.find?, List.mem_cons] at h
     rcases h with (rfl | h)
     · exact ⟨_, m, e⟩
     · exact mem_of_subset' s h
@@ -209,9 +208,9 @@ theorem subset_def {l₁ l₂ : Lists' α true} : l₁ ⊆ l₂ ↔ ∀ a ∈ l
   ⟨fun H a => mem_of_subset' H, fun H =>
     by
     rw [← of_toList l₁]
-    revert H; induction' toList l₁ with h t t_ih <;> intro
+    revert H; induction' toList l₁ with h t t_ih <;> intro H
     · exact Subset.nil
-    · rename _ => H; simp at *
+    · simp only [ofList, List.find?, List.mem_cons, forall_eq_or_imp] at *
       exact cons_subset.2 ⟨H.1, t_ih H.2⟩⟩
 #align lists'.subset_def Lists'.subset_def
 
@@ -299,10 +298,10 @@ def mem (a : Lists α) : Lists α → Prop
 instance : Membership (Lists α) (Lists α) :=
   ⟨mem⟩
 
-theorem is_list_of_mem {a : Lists α} : ∀ {l : Lists α}, a ∈ l → IsList l
+theorem isList_of_mem {a : Lists α} : ∀ {l : Lists α}, a ∈ l → IsList l
   | ⟨_, Lists'.nil⟩, _ => rfl
   | ⟨_, Lists'.cons' _ _⟩, _ => rfl
-#align lists.is_list_of_mem Lists.is_list_of_mem
+#align lists.is_list_of_mem Lists.isList_of_mem
 
 theorem Equiv.antisymm_iff {l₁ l₂ : Lists' α true} : of' l₁ ~ of' l₂ ↔ l₁ ⊆ l₂ ∧ l₂ ⊆ l₁ := by
   refine' ⟨fun h => _, fun ⟨h₁, h₂⟩ => Equiv.antisymm h₁ h₂⟩
@@ -321,8 +320,7 @@ theorem Equiv.symm {l₁ l₂ : Lists α} (h : l₁ ~ l₂) : l₂ ~ l₁ := by
   cases' h with _ _ _ h₁ h₂ <;> [rfl, exact Equiv.antisymm h₂ h₁]
 #align lists.equiv.symm Lists.Equiv.symm
 
-theorem Equiv.trans : ∀ {l₁ l₂ l₃ : Lists α}, l₁ ~ l₂ → l₂ ~ l₃ → l₁ ~ l₃ :=
-  by
+theorem Equiv.trans : ∀ {l₁ l₂ l₃ : Lists α}, l₁ ~ l₂ → l₂ ~ l₃ → l₁ ~ l₃ := by
   let trans := fun l₁ : Lists α => ∀ ⦃l₂ l₃⦄, l₁ ~ l₂ → l₂ ~ l₃ → l₁ ~ l₃
   suffices PProd (∀ l₁, trans l₁) (∀ (l : Lists' α true), ∀ l' ∈ l.toList, trans l') by exact this.1
   apply inductionMut
@@ -353,7 +351,7 @@ theorem Equiv.trans : ∀ {l₁ l₂ l₃ : Lists α}, l₁ ~ l₂ → l₂ ~ l
     -- simpa [IH₁] using IH
     --
     -- Assumption fails.
-    simp [IH₁]
+    simp only [Lists'.toList, Sigma.eta, List.find?, List.mem_cons, forall_eq_or_imp]
     constructor
     . intros l₂ l₃ h₁ h₂
       exact IH₁ h₁ h₂
@@ -481,6 +479,6 @@ instance : Inhabited (Finsets α) :=
 instance [DecidableEq α] : DecidableEq (Finsets α) := by
   unfold Finsets
   -- porting notes: infer_instance does not work for some reason
-  exact (@instDecidableEqQuotient_1 _ _ (fun _ _ => Lists.Equiv.decidable _ _))
+  exact (Quotient.decidableEq (d := fun _ _ => Lists.Equiv.decidable _ _))
 
 end Finsets
feat: port SetTheory.Lists (#1575)

Co-authored-by: int-y1 <jason_yuen2007@hotmail.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>

Dependencies 1 + 72

73 files ported (98.6%)
37415 lines ported (99.8%)
Show graph

The unported dependencies are