data.pfunctor.univariate.basicMathlib.Data.PFunctor.Univariate.Basic

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)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -75,15 +75,15 @@ protected theorem id_map {α : Type _} : ∀ x : P.Obj α, id <$> x = id x := fu
 #align pfunctor.id_map PFunctor.id_map
 -/
 
-#print PFunctor.comp_map /-
-protected theorem comp_map {α β γ : Type _} (f : α → β) (g : β → γ) :
+#print PFunctor.map_map /-
+protected theorem map_map {α β γ : Type _} (f : α → β) (g : β → γ) :
     ∀ x : P.Obj α, (g ∘ f) <$> x = g <$> f <$> x := fun ⟨a, b⟩ => rfl
-#align pfunctor.comp_map PFunctor.comp_map
+#align pfunctor.comp_map PFunctor.map_map
 -/
 
 instance : LawfulFunctor P.Obj where
   id_map := @PFunctor.id_map P
-  comp_map := @PFunctor.comp_map P
+  comp_map := @PFunctor.map_map P
 
 #print PFunctor.W /-
 /-- re-export existing definition of W-types and
Diff
@@ -142,19 +142,19 @@ theorem W.mk_dest (p : W P) : W.mk (W.dest p) = p := by cases p <;> rfl
 
 variable (P)
 
-#print PFunctor.IdxCat /-
+#print PFunctor.Idx /-
 /-- `Idx` identifies a location inside the application of a pfunctor.
 For `F : pfunctor`, `x : F.obj α` and `i : F.Idx`, `i` can designate
 one part of `x` or is invalid, if `i.1 ≠ x.1` -/
-def IdxCat :=
+def Idx :=
   Σ x : P.A, P.B x
-#align pfunctor.Idx PFunctor.IdxCat
+#align pfunctor.Idx PFunctor.Idx
 -/
 
-#print PFunctor.IdxCat.inhabited /-
-instance IdxCat.inhabited [Inhabited P.A] [Inhabited (P.B default)] : Inhabited P.IdxCat :=
+#print PFunctor.Idx.inhabited /-
+instance Idx.inhabited [Inhabited P.A] [Inhabited (P.B default)] : Inhabited P.Idx :=
   ⟨⟨default, default⟩⟩
-#align pfunctor.Idx.inhabited PFunctor.IdxCat.inhabited
+#align pfunctor.Idx.inhabited PFunctor.Idx.inhabited
 -/
 
 variable {P}
@@ -162,7 +162,7 @@ variable {P}
 #print PFunctor.Obj.iget /-
 /-- `x.iget i` takes the component of `x` designated by `i` if any is or returns
 a default value -/
-def Obj.iget [DecidableEq P.A] {α} [Inhabited α] (x : P.Obj α) (i : P.IdxCat) : α :=
+def Obj.iget [DecidableEq P.A] {α} [Inhabited α] (x : P.Obj α) (i : P.Idx) : α :=
   if h : i.1 = x.1 then x.2 (cast (congr_arg _ h) i.2) else default
 #align pfunctor.obj.iget PFunctor.Obj.iget
 -/
@@ -176,7 +176,7 @@ theorem fst_map {α β : Type u} (x : P.Obj α) (f : α → β) : (f <$> x).1 =
 #print PFunctor.iget_map /-
 @[simp]
 theorem iget_map [DecidableEq P.A] {α β : Type u} [Inhabited α] [Inhabited β] (x : P.Obj α)
-    (f : α → β) (i : P.IdxCat) (h : i.1 = x.1) : (f <$> x).iget i = f (x.iget i) :=
+    (f : α → β) (i : P.Idx) (h : i.1 = x.1) : (f <$> x).iget i = f (x.iget i) :=
   by
   simp only [obj.iget, fst_map, *, dif_pos, eq_self_iff_true]
   cases x; rfl
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2018 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 -/
-import Mathbin.Data.W.Basic
+import Data.W.Basic
 
 #align_import data.pfunctor.univariate.basic from "leanprover-community/mathlib"@"a11f9106a169dd302a285019e5165f8ab32ff433"
 
Diff
@@ -231,7 +231,7 @@ theorem liftp_iff {α : Type u} (p : α → Prop) (x : P.Obj α) :
     refine' ⟨a, fun i => (f i).val, _, fun i => (f i).property⟩
     rw [← hy, h, PFunctor.map_eq]
   rintro ⟨a, f, xeq, pf⟩
-  use ⟨a, fun i => ⟨f i, pf i⟩⟩
+  use⟨a, fun i => ⟨f i, pf i⟩⟩
   rw [xeq]; rfl
 #align pfunctor.liftp_iff PFunctor.liftp_iff
 -/
@@ -260,7 +260,7 @@ theorem liftr_iff {α : Type u} (r : α → α → Prop) (x y : P.Obj α) :
     constructor; · rw [← yeq, h]; rfl
     intro i; exact (f i).property
   rintro ⟨a, f₀, f₁, xeq, yeq, h⟩
-  use ⟨a, fun i => ⟨(f₀ i, f₁ i), h i⟩⟩
+  use⟨a, fun i => ⟨(f₀ i, f₁ i), h i⟩⟩
   constructor
   · rw [xeq]; rfl
   rw [yeq]; rfl
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2018 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
-
-! This file was ported from Lean 3 source module data.pfunctor.univariate.basic
-! leanprover-community/mathlib commit a11f9106a169dd302a285019e5165f8ab32ff433
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.W.Basic
 
+#align_import data.pfunctor.univariate.basic from "leanprover-community/mathlib"@"a11f9106a169dd302a285019e5165f8ab32ff433"
+
 /-!
 # Polynomial functors
 
Diff
@@ -170,10 +170,13 @@ def Obj.iget [DecidableEq P.A] {α} [Inhabited α] (x : P.Obj α) (i : P.IdxCat)
 #align pfunctor.obj.iget PFunctor.Obj.iget
 -/
 
+#print PFunctor.fst_map /-
 @[simp]
 theorem fst_map {α β : Type u} (x : P.Obj α) (f : α → β) : (f <$> x).1 = x.1 := by cases x <;> rfl
 #align pfunctor.fst_map PFunctor.fst_map
+-/
 
+#print PFunctor.iget_map /-
 @[simp]
 theorem iget_map [DecidableEq P.A] {α β : Type u} [Inhabited α] [Inhabited β] (x : P.Obj α)
     (f : α → β) (i : P.IdxCat) (h : i.1 = x.1) : (f <$> x).iget i = f (x.iget i) :=
@@ -181,6 +184,7 @@ theorem iget_map [DecidableEq P.A] {α β : Type u} [Inhabited α] [Inhabited β
   simp only [obj.iget, fst_map, *, dif_pos, eq_self_iff_true]
   cases x; rfl
 #align pfunctor.iget_map PFunctor.iget_map
+-/
 
 end PFunctor
 
Diff
@@ -48,7 +48,7 @@ variable (P : PFunctor) {α β : Type u}
 #print PFunctor.Obj /-
 /-- Applying `P` to an object of `Type` -/
 def Obj (α : Type _) :=
-  Σx : P.A, P.B x → α
+  Σ x : P.A, P.B x → α
 #align pfunctor.obj PFunctor.Obj
 -/
 
@@ -150,7 +150,7 @@ variable (P)
 For `F : pfunctor`, `x : F.obj α` and `i : F.Idx`, `i` can designate
 one part of `x` or is invalid, if `i.1 ≠ x.1` -/
 def IdxCat :=
-  Σx : P.A, P.B x
+  Σ x : P.A, P.B x
 #align pfunctor.Idx PFunctor.IdxCat
 -/
 
@@ -192,7 +192,7 @@ namespace PFunctor
 #print PFunctor.comp /-
 /-- functor composition for polynomial functors -/
 def comp (P₂ P₁ : PFunctor.{u}) : PFunctor.{u} :=
-  ⟨Σa₂ : P₂.1, P₂.2 a₂ → P₁.1, fun a₂a₁ => Σu : P₂.2 a₂a₁.1, P₁.2 (a₂a₁.2 u)⟩
+  ⟨Σ a₂ : P₂.1, P₂.2 a₂ → P₁.1, fun a₂a₁ => Σ u : P₂.2 a₂a₁.1, P₁.2 (a₂a₁.2 u)⟩
 #align pfunctor.comp PFunctor.comp
 -/
 
@@ -241,7 +241,10 @@ theorem liftp_iff' {α : Type u} (p : α → Prop) (a : P.A) (f : P.B a → α)
   by
   simp only [liftp_iff, Sigma.mk.inj_iff] <;> constructor <;> intro
   · casesm*Exists _, _ ∧ _; subst_vars; assumption
-  repeat' first |constructor|assumption
+  repeat'
+    first
+    | constructor
+    | assumption
 #align pfunctor.liftp_iff' PFunctor.liftp_iff'
 -/
 
@@ -272,7 +275,7 @@ theorem supp_eq {α : Type u} (a : P.A) (f : P.B a → α) :
   ext; simp only [supp, image_univ, mem_range, mem_set_of_eq]
   constructor <;> intro h
   · apply @h fun x => ∃ y : P.B a, f y = x
-    rw [liftp_iff']; intro ; refine' ⟨_, rfl⟩
+    rw [liftp_iff']; intro; refine' ⟨_, rfl⟩
   · simp only [liftp_iff']; cases h; subst x
     tauto
 #align pfunctor.supp_eq PFunctor.supp_eq
Diff
@@ -170,22 +170,10 @@ def Obj.iget [DecidableEq P.A] {α} [Inhabited α] (x : P.Obj α) (i : P.IdxCat)
 #align pfunctor.obj.iget PFunctor.Obj.iget
 -/
 
-/- warning: pfunctor.fst_map -> PFunctor.fst_map is a dubious translation:
-lean 3 declaration is
-  forall {P : PFunctor.{u2}} {α : Type.{u1}} {β : Type.{u1}} (x : PFunctor.Obj.{u2, u1} P α) (f : α -> β), Eq.{succ u2} (PFunctor.A.{u2} P) (Sigma.fst.{u2, max u2 u1} (PFunctor.A.{u2} P) (fun (x : PFunctor.A.{u2} P) => (PFunctor.B.{u2} P x) -> β) (Functor.map.{u1, max u2 u1} (fun {α : Type.{u1}} => PFunctor.Obj.{u2, u1} P α) (PFunctor.Obj.functor.{u2, u1} P) α β f x)) (Sigma.fst.{u2, max u2 u1} (PFunctor.A.{u2} P) (fun (x : PFunctor.A.{u2} P) => (PFunctor.B.{u2} P x) -> α) x)
-but is expected to have type
-  forall {P : PFunctor.{u1}} {α : Type.{u2}} {β : Type.{u2}} (x : PFunctor.Obj.{u1, u2} P α) (f : α -> β), Eq.{succ u1} (PFunctor.A.{u1} P) (Sigma.fst.{u1, max u2 u1} (PFunctor.A.{u1} P) (fun (x : PFunctor.A.{u1} P) => (PFunctor.B.{u1} P x) -> β) (Functor.map.{u2, max u2 u1} (PFunctor.Obj.{u1, u2} P) (PFunctor.instFunctorObj.{u1, u2} P) α β f x)) (Sigma.fst.{u1, max u2 u1} (PFunctor.A.{u1} P) (fun (x : PFunctor.A.{u1} P) => (PFunctor.B.{u1} P x) -> α) x)
-Case conversion may be inaccurate. Consider using '#align pfunctor.fst_map PFunctor.fst_mapₓ'. -/
 @[simp]
 theorem fst_map {α β : Type u} (x : P.Obj α) (f : α → β) : (f <$> x).1 = x.1 := by cases x <;> rfl
 #align pfunctor.fst_map PFunctor.fst_map
 
-/- warning: pfunctor.iget_map -> PFunctor.iget_map is a dubious translation:
-lean 3 declaration is
-  forall {P : PFunctor.{u2}} [_inst_1 : DecidableEq.{succ u2} (PFunctor.A.{u2} P)] {α : Type.{u1}} {β : Type.{u1}} [_inst_2 : Inhabited.{succ u1} α] [_inst_3 : Inhabited.{succ u1} β] (x : PFunctor.Obj.{u2, u1} P α) (f : α -> β) (i : PFunctor.IdxCat.{u2} P), (Eq.{succ u2} (PFunctor.A.{u2} P) (Sigma.fst.{u2, u2} (PFunctor.A.{u2} P) (fun (x : PFunctor.A.{u2} P) => PFunctor.B.{u2} P x) i) (Sigma.fst.{u2, max u2 u1} (PFunctor.A.{u2} P) (fun (x : PFunctor.A.{u2} P) => (PFunctor.B.{u2} P x) -> α) x)) -> (Eq.{succ u1} β (PFunctor.Obj.iget.{u2, u1} P (fun (a : PFunctor.A.{u2} P) (b : PFunctor.A.{u2} P) => _inst_1 a b) β _inst_3 (Functor.map.{u1, max u2 u1} (fun {α : Type.{u1}} => PFunctor.Obj.{u2, u1} P α) (PFunctor.Obj.functor.{u2, u1} P) α β f x) i) (f (PFunctor.Obj.iget.{u2, u1} P (fun (a : PFunctor.A.{u2} P) (b : PFunctor.A.{u2} P) => _inst_1 a b) α _inst_2 x i)))
-but is expected to have type
-  forall {P : PFunctor.{u1}} [_inst_1 : DecidableEq.{succ u1} (PFunctor.A.{u1} P)] {α : Type.{u2}} {β : Type.{u2}} [_inst_2 : Inhabited.{succ u2} α] [_inst_3 : Inhabited.{succ u2} β] (x : PFunctor.Obj.{u1, u2} P α) (f : α -> β) (i : PFunctor.IdxCat.{u1} P), (Eq.{succ u1} (PFunctor.A.{u1} P) (Sigma.fst.{u1, u1} (PFunctor.A.{u1} P) (fun (x : PFunctor.A.{u1} P) => PFunctor.B.{u1} P x) i) (Sigma.fst.{u1, max u2 u1} (PFunctor.A.{u1} P) (fun (x : PFunctor.A.{u1} P) => (PFunctor.B.{u1} P x) -> α) x)) -> (Eq.{succ u2} β (PFunctor.Obj.iget.{u1, u2} P (fun (a : PFunctor.A.{u1} P) (b : PFunctor.A.{u1} P) => _inst_1 a b) β _inst_3 (Functor.map.{u2, max u2 u1} (PFunctor.Obj.{u1, u2} P) (PFunctor.instFunctorObj.{u1, u2} P) α β f x) i) (f (PFunctor.Obj.iget.{u1, u2} P (fun (a : PFunctor.A.{u1} P) (b : PFunctor.A.{u1} P) => _inst_1 a b) α _inst_2 x i)))
-Case conversion may be inaccurate. Consider using '#align pfunctor.iget_map PFunctor.iget_mapₓ'. -/
 @[simp]
 theorem iget_map [DecidableEq P.A] {α β : Type u} [Inhabited α] [Inhabited β] (x : P.Obj α)
     (f : α → β) (i : P.IdxCat) (h : i.1 = x.1) : (f <$> x).iget i = f (x.iget i) :=
Diff
@@ -191,8 +191,7 @@ theorem iget_map [DecidableEq P.A] {α β : Type u} [Inhabited α] [Inhabited β
     (f : α → β) (i : P.IdxCat) (h : i.1 = x.1) : (f <$> x).iget i = f (x.iget i) :=
   by
   simp only [obj.iget, fst_map, *, dif_pos, eq_self_iff_true]
-  cases x
-  rfl
+  cases x; rfl
 #align pfunctor.iget_map PFunctor.iget_map
 
 end PFunctor
@@ -239,8 +238,7 @@ theorem liftp_iff {α : Type u} (p : α → Prop) (x : P.Obj α) :
     Liftp p x ↔ ∃ a f, x = ⟨a, f⟩ ∧ ∀ i, p (f i) :=
   by
   constructor
-  · rintro ⟨y, hy⟩
-    cases' h : y with a f
+  · rintro ⟨y, hy⟩; cases' h : y with a f
     refine' ⟨a, fun i => (f i).val, _, fun i => (f i).property⟩
     rw [← hy, h, PFunctor.map_eq]
   rintro ⟨a, f, xeq, pf⟩
@@ -254,9 +252,7 @@ theorem liftp_iff' {α : Type u} (p : α → Prop) (a : P.A) (f : P.B a → α)
     @Liftp.{u} P.Obj _ α p ⟨a, f⟩ ↔ ∀ i, p (f i) :=
   by
   simp only [liftp_iff, Sigma.mk.inj_iff] <;> constructor <;> intro
-  · casesm*Exists _, _ ∧ _
-    subst_vars
-    assumption
+  · casesm*Exists _, _ ∧ _; subst_vars; assumption
   repeat' first |constructor|assumption
 #align pfunctor.liftp_iff' PFunctor.liftp_iff'
 -/
@@ -266,22 +262,15 @@ theorem liftr_iff {α : Type u} (r : α → α → Prop) (x y : P.Obj α) :
     Liftr r x y ↔ ∃ a f₀ f₁, x = ⟨a, f₀⟩ ∧ y = ⟨a, f₁⟩ ∧ ∀ i, r (f₀ i) (f₁ i) :=
   by
   constructor
-  · rintro ⟨u, xeq, yeq⟩
-    cases' h : u with a f
+  · rintro ⟨u, xeq, yeq⟩; cases' h : u with a f
     use a, fun i => (f i).val.fst, fun i => (f i).val.snd
-    constructor
-    · rw [← xeq, h]
-      rfl
-    constructor
-    · rw [← yeq, h]
-      rfl
-    intro i
-    exact (f i).property
+    constructor; · rw [← xeq, h]; rfl
+    constructor; · rw [← yeq, h]; rfl
+    intro i; exact (f i).property
   rintro ⟨a, f₀, f₁, xeq, yeq, h⟩
   use ⟨a, fun i => ⟨(f₀ i, f₁ i), h i⟩⟩
   constructor
-  · rw [xeq]
-    rfl
+  · rw [xeq]; rfl
   rw [yeq]; rfl
 #align pfunctor.liftr_iff PFunctor.liftr_iff
 -/
@@ -295,12 +284,8 @@ theorem supp_eq {α : Type u} (a : P.A) (f : P.B a → α) :
   ext; simp only [supp, image_univ, mem_range, mem_set_of_eq]
   constructor <;> intro h
   · apply @h fun x => ∃ y : P.B a, f y = x
-    rw [liftp_iff']
-    intro
-    refine' ⟨_, rfl⟩
-  · simp only [liftp_iff']
-    cases h
-    subst x
+    rw [liftp_iff']; intro ; refine' ⟨_, rfl⟩
+  · simp only [liftp_iff']; cases h; subst x
     tauto
 #align pfunctor.supp_eq PFunctor.supp_eq
 -/

Changes in mathlib4

mathlib3
mathlib4
chore: classify porting notes referring to missing linters (#12098)

Reference the newly created issues #12094 and #12096, as well as the pre-existing #5171. Change all references to #10927 to #5171. Some of these changes were not labelled as "porting note"; change this for good measure.

Diff
@@ -96,6 +96,7 @@ def W :=
 /- inhabitants of W types is awkward to encode as an instance
 assumption because there needs to be a value `a : P.A`
 such that `P.B a` is empty to yield a finite tree -/
+-- Porting note(#5171): this linter isn't ported yet.
 -- attribute [nolint has_nonempty_instance] W
 
 variable {P}
chore: remove terminal, terminal refines (#10762)

I replaced a few "terminal" refine/refine's with exact.

The strategy was very simple-minded: essentially any refine whose following line had smaller indentation got replaced by exact and then I cleaned up the mess.

This PR certainly leaves some further terminal refines, but maybe the current change is beneficial.

Diff
@@ -247,7 +247,7 @@ theorem supp_eq {α : Type u} (a : P.A) (f : P.B a → α) :
   · apply @h fun x => ∃ y : P.B a, f y = x
     rw [liftp_iff']
     intro
-    refine' ⟨_, rfl⟩
+    exact ⟨_, rfl⟩
   · simp only [liftp_iff']
     cases h
     subst x
refactor: use PFunctor.map instead of Functor.map (#7743)

Functor.map is monomorphic, so the universe of α in this theorem is fixed to the universe of P:

theorem dest_corec {P : PFunctor.{u}} {α : Type u} (g : α → P α) (x : α) : M.dest (M.corec g x) = M.corec g <$> g x

PFunctor.map is polymorphic, so the universe of α is free from the universe of P:

theorem dest_corec {P : PFunctor.{u}} {α : Type v} (g : α → P α) (x : α) : M.dest (M.corec g x) = P.map (M.corec g) (g x)

Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Pol'tta / Miyahara Kō <52843868+Komyyy@users.noreply.github.com>

Diff
@@ -18,7 +18,7 @@ pfunctor/M.lean.)
 -- "W", "Idx"
 set_option linter.uppercaseLean3 false
 
-universe u v v₁ v₂
+universe u v v₁ v₂ v₃
 
 /-- A polynomial functor `P` is given by a type `A` and a family `B` of types over `A`. `P` maps
 any type `α` to a new type `P α`, which is defined as the sigma type `Σ x, P.B x → α`.
@@ -40,7 +40,7 @@ namespace PFunctor
 instance : Inhabited PFunctor :=
   ⟨⟨default, default⟩⟩
 
-variable (P : PFunctor.{u}) {α : Type v₁} {β : Type v₂}
+variable (P : PFunctor.{u}) {α : Type v₁} {β : Type v₂} {γ : Type v₃}
 
 /-- Applying `P` to an object of `Type` -/
 @[coe]
@@ -62,22 +62,30 @@ instance Obj.inhabited [Inhabited P.A] [Inhabited α] : Inhabited (P α) :=
 
 instance : Functor.{v, max u v} P.Obj where map := @map P
 
-protected theorem map_eq {α β : Type u} (f : α → β) (a : P.A) (g : P.B a → α) :
-    @Functor.map P.Obj _ _ _ f ⟨a, g⟩ = ⟨a, f ∘ g⟩ :=
+/-- We prefer `PFunctor.map` to `Functor.map` because it is universe-polymorphic. -/
+@[simp]
+theorem map_eq_map {α β : Type v} (f : α → β) (x : P α) : f <$> x = P.map f x :=
+  rfl
+
+@[simp]
+protected theorem map_eq (f : α → β) (a : P.A) (g : P.B a → α) :
+    P.map f ⟨a, g⟩ = ⟨a, f ∘ g⟩ :=
   rfl
 #align pfunctor.map_eq PFunctor.map_eq
 
-protected theorem id_map {α : Type v} : ∀ x : P α, id <$> x = id x := fun ⟨_a, _b⟩ => rfl
+@[simp]
+protected theorem id_map : ∀ x : P α, P.map id x = x := fun ⟨_, _⟩ => rfl
 #align pfunctor.id_map PFunctor.id_map
 
-protected theorem comp_map {α β γ : Type v} (f : α → β) (g : β → γ) :
-    ∀ x : P α, (g ∘ f) <$> x = g <$> f <$> x := fun ⟨_a, _b⟩ => rfl
-#align pfunctor.comp_map PFunctor.comp_map
+@[simp]
+protected theorem map_map (f : α → β) (g : β → γ) :
+    ∀ x : P α, P.map g (P.map f x) = P.map (g ∘ f) x := fun ⟨_, _⟩ => rfl
+#align pfunctor.comp_map PFunctor.map_map
 
 instance : LawfulFunctor.{v, max u v} P.Obj where
   map_const := rfl
-  id_map := @PFunctor.id_map P
-  comp_map := @PFunctor.comp_map P
+  id_map x := P.id_map x
+  comp_map f g x := P.map_map f g x |>.symm
 
 /-- re-export existing definition of W-types and
 adapt it to a packaged definition of polynomial functor -/
@@ -142,12 +150,12 @@ def Obj.iget [DecidableEq P.A] {α} [Inhabited α] (x : P α) (i : P.Idx) : α :
 #align pfunctor.obj.iget PFunctor.Obj.iget
 
 @[simp]
-theorem fst_map {α β : Type u} (x : P α) (f : α → β) : (f <$> x).1 = x.1 := by cases x; rfl
+theorem fst_map (x : P α) (f : α → β) : (P.map f x).1 = x.1 := by cases x; rfl
 #align pfunctor.fst_map PFunctor.fst_map
 
 @[simp]
-theorem iget_map [DecidableEq P.A] {α β : Type u} [Inhabited α] [Inhabited β] (x : P α)
-    (f : α → β) (i : P.Idx) (h : i.1 = x.1) : (f <$> x).iget i = f (x.iget i) := by
+theorem iget_map [DecidableEq P.A] [Inhabited α] [Inhabited β] (x : P α)
+    (f : α → β) (i : P.Idx) (h : i.1 = x.1) : (P.map f x).iget i = f (x.iget i) := by
   simp only [Obj.iget, fst_map, *, dif_pos, eq_self_iff_true]
   cases x
   rfl
@@ -192,7 +200,7 @@ theorem liftp_iff {α : Type u} (p : α → Prop) (x : P α) :
   · rintro ⟨y, hy⟩
     cases' h : y with a f
     refine' ⟨a, fun i => (f i).val, _, fun i => (f i).property⟩
-    rw [← hy, h, PFunctor.map_eq]
+    rw [← hy, h, map_eq_map, PFunctor.map_eq]
     congr
   rintro ⟨a, f, xeq, pf⟩
   use ⟨a, fun i => ⟨f i, pf i⟩⟩
style: CoeFun for PFunctor.Obj & MvPFunctor.Obj (#7526)
Diff
@@ -18,12 +18,12 @@ pfunctor/M.lean.)
 -- "W", "Idx"
 set_option linter.uppercaseLean3 false
 
-universe u
+universe u v v₁ v₂
 
 /-- A polynomial functor `P` is given by a type `A` and a family `B` of types over `A`. `P` maps
-any type `α` to a new type `P.obj α`, which is defined as the sigma type `Σ x, P.B x → α`.
+any type `α` to a new type `P α`, which is defined as the sigma type `Σ x, P.B x → α`.
 
-An element of `P.obj α` is a pair `⟨a, f⟩`, where `a` is an element of a type `A` and
+An element of `P α` is a pair `⟨a, f⟩`, where `a` is an element of a type `A` and
 `f : B a → α`. Think of `a` as the shape of the object and `f` as an index to the relevant
 elements of `α`.
 -/
@@ -40,37 +40,41 @@ namespace PFunctor
 instance : Inhabited PFunctor :=
   ⟨⟨default, default⟩⟩
 
-variable (P : PFunctor) {α β : Type u}
+variable (P : PFunctor.{u}) {α : Type v₁} {β : Type v₂}
 
 /-- Applying `P` to an object of `Type` -/
-def Obj (α : Type*) :=
-  Σx : P.A, P.B x → α
+@[coe]
+def Obj (α : Type v) :=
+  Σ x : P.A, P.B x → α
 #align pfunctor.obj PFunctor.Obj
 
+instance : CoeFun PFunctor.{u} (fun _ => Type v → Type (max u v)) where
+  coe := Obj
+
 /-- Applying `P` to a morphism of `Type` -/
-def map {α β : Type*} (f : α → β) : P.Obj α → P.Obj β :=
+def map (f : α → β) : P α → P β :=
   fun ⟨a, g⟩ => ⟨a, f ∘ g⟩
 #align pfunctor.map PFunctor.map
 
-instance Obj.inhabited [Inhabited P.A] [Inhabited α] : Inhabited (P.Obj α) :=
+instance Obj.inhabited [Inhabited P.A] [Inhabited α] : Inhabited (P α) :=
   ⟨⟨default, default⟩⟩
 #align pfunctor.obj.inhabited PFunctor.Obj.inhabited
 
-instance : Functor P.Obj where map := @map P
+instance : Functor.{v, max u v} P.Obj where map := @map P
 
 protected theorem map_eq {α β : Type u} (f : α → β) (a : P.A) (g : P.B a → α) :
     @Functor.map P.Obj _ _ _ f ⟨a, g⟩ = ⟨a, f ∘ g⟩ :=
   rfl
 #align pfunctor.map_eq PFunctor.map_eq
 
-protected theorem id_map {α : Type*} : ∀ x : P.Obj α, id <$> x = id x := fun ⟨_a, _b⟩ => rfl
+protected theorem id_map {α : Type v} : ∀ x : P α, id <$> x = id x := fun ⟨_a, _b⟩ => rfl
 #align pfunctor.id_map PFunctor.id_map
 
-protected theorem comp_map {α β γ : Type u} (f : α → β) (g : β → γ) :
-    ∀ x : P.Obj α, (g ∘ f) <$> x = g <$> f <$> x := fun ⟨_a, _b⟩ => rfl
+protected theorem comp_map {α β γ : Type v} (f : α → β) (g : β → γ) :
+    ∀ x : P α, (g ∘ f) <$> x = g <$> f <$> x := fun ⟨_a, _b⟩ => rfl
 #align pfunctor.comp_map PFunctor.comp_map
 
-instance : LawfulFunctor P.Obj where
+instance : LawfulFunctor.{v, max u v} P.Obj where
   map_const := rfl
   id_map := @PFunctor.id_map P
   comp_map := @PFunctor.comp_map P
@@ -99,17 +103,17 @@ def W.children : ∀ x : W P, P.B (W.head x) → W P
 #align pfunctor.W.children PFunctor.W.children
 
 /-- destructor for W-types -/
-def W.dest : W P → P.Obj (W P)
+def W.dest : W P → P (W P)
   | ⟨a, f⟩ => ⟨a, f⟩
 #align pfunctor.W.dest PFunctor.W.dest
 
 /-- constructor for W-types -/
-def W.mk : P.Obj (W P) → W P
+def W.mk : P (W P) → W P
   | ⟨a, f⟩ => ⟨a, f⟩
 #align pfunctor.W.mk PFunctor.W.mk
 
 @[simp]
-theorem W.dest_mk (p : P.Obj (W P)) : W.dest (W.mk p) = p := by cases p; rfl
+theorem W.dest_mk (p : P (W P)) : W.dest (W.mk p) = p := by cases p; rfl
 #align pfunctor.W.dest_mk PFunctor.W.dest_mk
 
 @[simp]
@@ -119,10 +123,10 @@ theorem W.mk_dest (p : W P) : W.mk (W.dest p) = p := by cases p; rfl
 variable (P)
 
 /-- `Idx` identifies a location inside the application of a pfunctor.
-For `F : PFunctor`, `x : F.obj α` and `i : F.Idx`, `i` can designate
+For `F : PFunctor`, `x : F α` and `i : F.Idx`, `i` can designate
 one part of `x` or is invalid, if `i.1 ≠ x.1` -/
 def Idx :=
-  Σx : P.A, P.B x
+  Σ x : P.A, P.B x
 #align pfunctor.Idx PFunctor.Idx
 
 instance Idx.inhabited [Inhabited P.A] [Inhabited (P.B default)] : Inhabited P.Idx :=
@@ -133,16 +137,16 @@ variable {P}
 
 /-- `x.iget i` takes the component of `x` designated by `i` if any is or returns
 a default value -/
-def Obj.iget [DecidableEq P.A] {α} [Inhabited α] (x : P.Obj α) (i : P.Idx) : α :=
+def Obj.iget [DecidableEq P.A] {α} [Inhabited α] (x : P α) (i : P.Idx) : α :=
   if h : i.1 = x.1 then x.2 (cast (congr_arg _ h) i.2) else default
 #align pfunctor.obj.iget PFunctor.Obj.iget
 
 @[simp]
-theorem fst_map {α β : Type u} (x : P.Obj α) (f : α → β) : (f <$> x).1 = x.1 := by cases x; rfl
+theorem fst_map {α β : Type u} (x : P α) (f : α → β) : (f <$> x).1 = x.1 := by cases x; rfl
 #align pfunctor.fst_map PFunctor.fst_map
 
 @[simp]
-theorem iget_map [DecidableEq P.A] {α β : Type u} [Inhabited α] [Inhabited β] (x : P.Obj α)
+theorem iget_map [DecidableEq P.A] {α β : Type u} [Inhabited α] [Inhabited β] (x : P α)
     (f : α → β) (i : P.Idx) (h : i.1 = x.1) : (f <$> x).iget i = f (x.iget i) := by
   simp only [Obj.iget, fst_map, *, dif_pos, eq_self_iff_true]
   cases x
@@ -158,16 +162,16 @@ namespace PFunctor
 
 /-- functor composition for polynomial functors -/
 def comp (P₂ P₁ : PFunctor.{u}) : PFunctor.{u} :=
-  ⟨Σa₂ : P₂.1, P₂.2 a₂ → P₁.1, fun a₂a₁ => Σu : P₂.2 a₂a₁.1, P₁.2 (a₂a₁.2 u)⟩
+  ⟨Σ a₂ : P₂.1, P₂.2 a₂ → P₁.1, fun a₂a₁ => Σ u : P₂.2 a₂a₁.1, P₁.2 (a₂a₁.2 u)⟩
 #align pfunctor.comp PFunctor.comp
 
 /-- constructor for composition -/
-def comp.mk (P₂ P₁ : PFunctor.{u}) {α : Type} (x : P₂.Obj (P₁.Obj α)) : (comp P₂ P₁).Obj α :=
+def comp.mk (P₂ P₁ : PFunctor.{u}) {α : Type} (x : P₂ (P₁ α)) : comp P₂ P₁ α :=
   ⟨⟨x.1, Sigma.fst ∘ x.2⟩, fun a₂a₁ => (x.2 a₂a₁.1).2 a₂a₁.2⟩
 #align pfunctor.comp.mk PFunctor.comp.mk
 
 /-- destructor for composition -/
-def comp.get (P₂ P₁ : PFunctor.{u}) {α : Type} (x : (comp P₂ P₁).Obj α) : P₂.Obj (P₁.Obj α) :=
+def comp.get (P₂ P₁ : PFunctor.{u}) {α : Type} (x : comp P₂ P₁ α) : P₂ (P₁ α) :=
   ⟨x.1.1, fun a₂ => ⟨x.1.2 a₂, fun a₁ => x.2 ⟨a₂, a₁⟩⟩⟩
 #align pfunctor.comp.get PFunctor.comp.get
 
@@ -182,7 +186,7 @@ variable {P : PFunctor.{u}}
 
 open Functor
 
-theorem liftp_iff {α : Type u} (p : α → Prop) (x : P.Obj α) :
+theorem liftp_iff {α : Type u} (p : α → Prop) (x : P α) :
     Liftp p x ↔ ∃ a f, x = ⟨a, f⟩ ∧ ∀ i, p (f i) := by
   constructor
   · rintro ⟨y, hy⟩
@@ -204,7 +208,7 @@ theorem liftp_iff' {α : Type u} (p : α → Prop) (a : P.A) (f : P.B a → α)
   repeat' first |constructor|assumption
 #align pfunctor.liftp_iff' PFunctor.liftp_iff'
 
-theorem liftr_iff {α : Type u} (r : α → α → Prop) (x y : P.Obj α) :
+theorem liftr_iff {α : Type u} (r : α → α → Prop) (x y : P α) :
     Liftr r x y ↔ ∃ a f₀ f₁, x = ⟨a, f₀⟩ ∧ y = ⟨a, f₁⟩ ∧ ∀ i, r (f₀ i) (f₁ i) := by
   constructor
   · rintro ⟨u, xeq, yeq⟩
@@ -229,7 +233,7 @@ theorem liftr_iff {α : Type u} (r : α → α → Prop) (x y : P.Obj α) :
 open Set
 
 theorem supp_eq {α : Type u} (a : P.A) (f : P.B a → α) :
-    @supp.{u} P.Obj _ α (⟨a, f⟩ : P.Obj α) = f '' univ := by
+    @supp.{u} P.Obj _ α (⟨a, f⟩ : P α) = f '' univ := by
   ext x; simp only [supp, image_univ, mem_range, mem_setOf_eq]
   constructor <;> intro h
   · apply @h fun x => ∃ y : P.B a, f y = x
style: pp_with_univ for TypeVec & PFunctor & MvPFunctor (#7742)
Diff
@@ -27,6 +27,7 @@ An element of `P.obj α` is a pair `⟨a, f⟩`, where `a` is an element of a ty
 `f : B a → α`. Think of `a` as the shape of the object and `f` as an index to the relevant
 elements of `α`.
 -/
+@[pp_with_univ]
 structure PFunctor where
   /-- The head type -/
   A : Type u
chore: remove many Type _ before the colon (#7718)

We have turned to Type* instead of Type _, but many of them remained in mathlib because the straight replacement did not work. In general, having Type _ before the colon is a code smell, though, as it hides which types should be in the same universe and which shouldn't, and is not very robust.

This PR replaces most of the remaining Type _ before the colon (except those in category theory) by Type* or Type u. This has uncovered a few bugs (where declarations were not as polymorphic as they should be).

I had to increase heartbeats at two places when replacing Type _ by Type*, but I think it's worth it as it's really more robust.

Diff
@@ -57,7 +57,7 @@ instance Obj.inhabited [Inhabited P.A] [Inhabited α] : Inhabited (P.Obj α) :=
 
 instance : Functor P.Obj where map := @map P
 
-protected theorem map_eq {α β : Type _} (f : α → β) (a : P.A) (g : P.B a → α) :
+protected theorem map_eq {α β : Type u} (f : α → β) (a : P.A) (g : P.B a → α) :
     @Functor.map P.Obj _ _ _ f ⟨a, g⟩ = ⟨a, f ∘ g⟩ :=
   rfl
 #align pfunctor.map_eq PFunctor.map_eq
@@ -65,7 +65,7 @@ protected theorem map_eq {α β : Type _} (f : α → β) (a : P.A) (g : P.B a 
 protected theorem id_map {α : Type*} : ∀ x : P.Obj α, id <$> x = id x := fun ⟨_a, _b⟩ => rfl
 #align pfunctor.id_map PFunctor.id_map
 
-protected theorem comp_map {α β γ : Type _} (f : α → β) (g : β → γ) :
+protected theorem comp_map {α β γ : Type u} (f : α → β) (g : β → γ) :
     ∀ x : P.Obj α, (g ∘ f) <$> x = g <$> f <$> x := fun ⟨_a, _b⟩ => rfl
 #align pfunctor.comp_map PFunctor.comp_map
 
style: Qpf to QPF & PFunctor.IdxCat to PFunctor.Idx (#7499)

IdxCat was a mathport-ism caused by the name being capitalized in Lean 3.

Diff
@@ -120,19 +120,19 @@ variable (P)
 /-- `Idx` identifies a location inside the application of a pfunctor.
 For `F : PFunctor`, `x : F.obj α` and `i : F.Idx`, `i` can designate
 one part of `x` or is invalid, if `i.1 ≠ x.1` -/
-def IdxCat :=
+def Idx :=
   Σx : P.A, P.B x
-#align pfunctor.Idx PFunctor.IdxCat
+#align pfunctor.Idx PFunctor.Idx
 
-instance IdxCat.inhabited [Inhabited P.A] [Inhabited (P.B default)] : Inhabited P.IdxCat :=
+instance Idx.inhabited [Inhabited P.A] [Inhabited (P.B default)] : Inhabited P.Idx :=
   ⟨⟨default, default⟩⟩
-#align pfunctor.Idx.inhabited PFunctor.IdxCat.inhabited
+#align pfunctor.Idx.inhabited PFunctor.Idx.inhabited
 
 variable {P}
 
 /-- `x.iget i` takes the component of `x` designated by `i` if any is or returns
 a default value -/
-def Obj.iget [DecidableEq P.A] {α} [Inhabited α] (x : P.Obj α) (i : P.IdxCat) : α :=
+def Obj.iget [DecidableEq P.A] {α} [Inhabited α] (x : P.Obj α) (i : P.Idx) : α :=
   if h : i.1 = x.1 then x.2 (cast (congr_arg _ h) i.2) else default
 #align pfunctor.obj.iget PFunctor.Obj.iget
 
@@ -142,7 +142,7 @@ theorem fst_map {α β : Type u} (x : P.Obj α) (f : α → β) : (f <$> x).1 =
 
 @[simp]
 theorem iget_map [DecidableEq P.A] {α β : Type u} [Inhabited α] [Inhabited β] (x : P.Obj α)
-    (f : α → β) (i : P.IdxCat) (h : i.1 = x.1) : (f <$> x).iget i = f (x.iget i) := by
+    (f : α → β) (i : P.Idx) (h : i.1 = x.1) : (f <$> x).iget i = f (x.iget i) := by
   simp only [Obj.iget, fst_map, *, dif_pos, eq_self_iff_true]
   cases x
   rfl
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
@@ -42,12 +42,12 @@ instance : Inhabited PFunctor :=
 variable (P : PFunctor) {α β : Type u}
 
 /-- Applying `P` to an object of `Type` -/
-def Obj (α : Type _) :=
+def Obj (α : Type*) :=
   Σx : P.A, P.B x → α
 #align pfunctor.obj PFunctor.Obj
 
 /-- Applying `P` to a morphism of `Type` -/
-def map {α β : Type _} (f : α → β) : P.Obj α → P.Obj β :=
+def map {α β : Type*} (f : α → β) : P.Obj α → P.Obj β :=
   fun ⟨a, g⟩ => ⟨a, f ∘ g⟩
 #align pfunctor.map PFunctor.map
 
@@ -62,7 +62,7 @@ protected theorem map_eq {α β : Type _} (f : α → β) (a : P.A) (g : P.B a 
   rfl
 #align pfunctor.map_eq PFunctor.map_eq
 
-protected theorem id_map {α : Type _} : ∀ x : P.Obj α, id <$> x = id x := fun ⟨_a, _b⟩ => rfl
+protected theorem id_map {α : Type*} : ∀ x : P.Obj α, id <$> x = id x := fun ⟨_a, _b⟩ => rfl
 #align pfunctor.id_map PFunctor.id_map
 
 protected theorem comp_map {α β γ : Type _} (f : α → β) (g : β → γ) :
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 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
-
-! This file was ported from Lean 3 source module data.pfunctor.univariate.basic
-! leanprover-community/mathlib commit 8631e2d5ea77f6c13054d9151d82b83069680cb1
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.W.Basic
 
+#align_import data.pfunctor.univariate.basic from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
+
 /-!
 # Polynomial functors
 
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

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

Diff
@@ -90,7 +90,7 @@ such that `P.B a` is empty to yield a finite tree -/
 
 variable {P}
 
-/-- root element  of a W tree -/
+/-- root element of a W tree -/
 def W.head : W P → P.A
   | ⟨a, _f⟩ => a
 #align pfunctor.W.head PFunctor.W.head
chore: fix upper/lowercase in comments (#4360)
  • Run a non-interactive version of fix-comments.py on all files.
  • Go through the diff and manually add/discard/edit chunks.
Diff
@@ -121,7 +121,7 @@ theorem W.mk_dest (p : W P) : W.mk (W.dest p) = p := by cases p; rfl
 variable (P)
 
 /-- `Idx` identifies a location inside the application of a pfunctor.
-For `F : pfunctor`, `x : F.obj α` and `i : F.Idx`, `i` can designate
+For `F : PFunctor`, `x : F.obj α` and `i : F.Idx`, `i` can designate
 one part of `x` or is invalid, if `i.1 ≠ x.1` -/
 def IdxCat :=
   Σx : P.A, P.B x
feat: add uppercase lean 3 linter (#1796)

Implements a linter for lean 3 declarations containing capital letters (as suggested on Zulip).

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

Diff
@@ -18,6 +18,8 @@ polynomial functor.  (For the M-type construction, see
 pfunctor/M.lean.)
 -/
 
+-- "W", "Idx"
+set_option linter.uppercaseLean3 false
 
 universe u
 
feat: port data.pfunctor.univariate.basic (#1823)

Dependencies 6 + 211

212 files ported (97.2%)
93660 lines ported (97.7%)
Show graph

The unported dependencies are