data.pfunctor.univariate.MMathlib.Data.PFunctor.Univariate.M

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
@@ -3,7 +3,7 @@ Copyright (c) 2017 Simon Hudon All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Simon Hudon
 -/
-import Data.Pfunctor.Univariate.Basic
+import Data.PFunctor.Univariate.Basic
 
 #align_import data.pfunctor.univariate.M from "leanprover-community/mathlib"@"23aa88e32dcc9d2a24cca7bc23268567ed4cd7d6"
 
Diff
@@ -196,10 +196,10 @@ theorem head_succ' (n m : ℕ) (x : ∀ n, CofixA F n) (Hconsistent : AllAgree x
   cases' h₁ : x 1 with _ i₁ f₁
   dsimp only [head']
   induction' n with n
-  · rw [h₁] at h₀ ; cases h₀; trivial
+  · rw [h₁] at h₀; cases h₀; trivial
   · have H := Hconsistent (succ n)
     cases' h₂ : x (succ n) with _ i₂ f₂
-    rw [h₀, h₂] at H 
+    rw [h₀, h₂] at H
     apply n_ih (truncate ∘ f₀)
     rw [h₂]
     cases' H with _ _ _ _ _ _ hagree
@@ -407,7 +407,7 @@ theorem mk_dest (x : M F) : M.mk (dest x) = x :=
   revert ch; rw [h']; intros; congr
   · ext a; dsimp only [children]
     generalize hh : cast _ a = a''
-    rw [cast_eq_iff_heq] at hh 
+    rw [cast_eq_iff_heq] at hh
     revert a''
     rw [h]; intros; cases hh; rfl
 #align pfunctor.M.mk_dest PFunctor.M.mk_dest
@@ -468,7 +468,7 @@ theorem agree_iff_agree' {n : ℕ} (x y : M F) :
   · induction n generalizing x y; constructor
     · induction x using PFunctor.M.casesOn'
       induction y using PFunctor.M.casesOn'
-      simp only [approx_mk] at h ; cases' h with _ _ _ _ _ _ hagree
+      simp only [approx_mk] at h; cases' h with _ _ _ _ _ _ hagree
       constructor <;> try rfl
       intro i; apply n_ih; apply hagree
   · induction n generalizing x y; constructor
@@ -654,7 +654,7 @@ theorem ext_aux [Inhabited (M F)] [DecidableEq F.A] {n : ℕ} (x y z : M F) (hx
   induction' n with n generalizing x y z
   · specialize hrec [] rfl
     induction x using PFunctor.M.casesOn'; induction y using PFunctor.M.casesOn'
-    simp only [iselect_nil] at hrec ; subst hrec
+    simp only [iselect_nil] at hrec; subst hrec
     simp only [approx_mk, true_and_iff, eq_self_iff_true, heq_iff_eq]
     apply Subsingleton.elim
   · cases hx; cases hy
@@ -666,7 +666,7 @@ theorem ext_aux [Inhabited (M F)] [DecidableEq F.A] {n : ℕ} (x y z : M F) (hx
     · solve_by_elim
     · solve_by_elim
     introv h; specialize hrec (⟨_, i⟩ :: ps) (congr_arg _ h)
-    simp only [iselect_cons] at hrec ; exact hrec
+    simp only [iselect_cons] at hrec; exact hrec
 #align pfunctor.M.ext_aux PFunctor.M.ext_aux
 -/
 
@@ -686,7 +686,7 @@ theorem ext [Inhabited (M F)] (x y : M F) (H : ∀ ps : Path F, iselect ps x = i
     · rw [← agree_iff_agree']; apply x.consistent
     · rw [← agree_iff_agree', i_ih]; apply y.consistent
     introv H'
-    dsimp only [iselect] at H 
+    dsimp only [iselect] at H
     cases H'
     apply H ps
 #align pfunctor.M.ext PFunctor.M.ext
@@ -730,7 +730,7 @@ theorem nth_of_bisim [Inhabited (M F)] (bisim : IsBisimulation R) (s₁ s₂) (p
   induction' h : f i using PFunctor.M.casesOn' with a₀ f₀
   induction' h' : f' i using PFunctor.M.casesOn' with a₁ f₁
   simp only [h, h', isubtree_cons] at ps_ih ⊢
-  rw [h, h'] at h₁ 
+  rw [h, h'] at h₁
   obtain rfl : a₀ = a₁ := bisim.head h₁
   apply ps_ih _ _ _ h₁
   rw [← h, ← h']; apply or_of_or_of_imp_of_imp hh is_path_cons' is_path_cons'
@@ -746,7 +746,7 @@ theorem eq_of_bisim [Nonempty (M F)] (bisim : IsBisimulation R) : ∀ s₁ s₂,
   by_cases h : is_path ps s₁ ∨ is_path ps s₂
   · have H := nth_of_bisim R bisim _ _ ps Hr h
     exact H.left
-  · rw [not_or] at h ; cases' h with h₀ h₁
+  · rw [not_or] at h; cases' h with h₀ h₁
     simp only [iselect_eq_default, *, not_false_iff]
 #align pfunctor.M.eq_of_bisim PFunctor.M.eq_of_bisim
 -/
@@ -780,9 +780,9 @@ theorem bisim (R : M P → M P → Prop)
   constructor <;> introv ih <;> rcases h _ _ ih with ⟨a'', g, g', h₀, h₁, h₂⟩ <;> clear h
   · replace h₀ := congr_arg Sigma.fst h₀
     replace h₁ := congr_arg Sigma.fst h₁
-    simp only [dest_mk] at h₀ h₁ 
+    simp only [dest_mk] at h₀ h₁
     rw [h₀, h₁]
-  · simp only [dest_mk] at h₀ h₁ 
+  · simp only [dest_mk] at h₀ h₁
     cases h₀; cases h₁
     apply h₂
 #align pfunctor.M.bisim PFunctor.M.bisim
Diff
@@ -171,7 +171,7 @@ theorem P_corec (i : X) (n : ℕ) : Agree (sCorec f i n) (sCorec f i (succ n)) :
 #print PFunctor.Approx.Path /-
 /-- `path F` provides indices to access internal nodes in `corec F` -/
 def Path (F : PFunctor.{u}) :=
-  List F.IdxCat
+  List F.Idx
 #align pfunctor.approx.path PFunctor.Approx.Path
 -/
 
@@ -301,7 +301,7 @@ def children (x : M F) (i : F.B (head x)) : M F :=
 #print PFunctor.M.ichildren /-
 /-- select a subtree using a `i : F.Idx` or return an arbitrary tree if
 `i` designates no subtree of `x` -/
-def ichildren [Inhabited (M F)] [DecidableEq F.A] (i : F.IdxCat) (x : M F) : M F :=
+def ichildren [Inhabited (M F)] [DecidableEq F.A] (i : F.Idx) (x : M F) : M F :=
   if H' : i.1 = head x then children x (cast (congr_arg _ <| by simp only [head, H'] <;> rfl) i.2)
   else default
 #align pfunctor.M.ichildren PFunctor.M.ichildren
@@ -601,7 +601,7 @@ theorem children_mk {a} (x : F.B a → M F) (i : F.B (head (M.mk ⟨a, x⟩))) :
 
 #print PFunctor.M.ichildren_mk /-
 @[simp]
-theorem ichildren_mk [DecidableEq F.A] [Inhabited (M F)] (x : F.Obj (M F)) (i : F.IdxCat) :
+theorem ichildren_mk [DecidableEq F.A] [Inhabited (M F)] (x : F.Obj (M F)) (i : F.Idx) :
     ichildren i (M.mk x) = x.iget i :=
   by
   dsimp only [ichildren, PFunctor.Obj.iget]
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2017 Simon Hudon All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Simon Hudon
 -/
-import Mathbin.Data.Pfunctor.Univariate.Basic
+import Data.Pfunctor.Univariate.Basic
 
 #align_import data.pfunctor.univariate.M from "leanprover-community/mathlib"@"23aa88e32dcc9d2a24cca7bc23268567ed4cd7d6"
 
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2017 Simon Hudon All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Simon Hudon
-
-! This file was ported from Lean 3 source module data.pfunctor.univariate.M
-! leanprover-community/mathlib commit 23aa88e32dcc9d2a24cca7bc23268567ed4cd7d6
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.Pfunctor.Univariate.Basic
 
+#align_import data.pfunctor.univariate.M from "leanprover-community/mathlib"@"23aa88e32dcc9d2a24cca7bc23268567ed4cd7d6"
+
 /-!
 # M-types
 
Diff
@@ -29,7 +29,6 @@ open List hiding head?
 
 variable (F : PFunctor.{u})
 
--- mathport name: «expr♯ »
 local prefix:0 "♯" =>
   cast
     (by
@@ -486,6 +485,7 @@ theorem agree_iff_agree' {n : ℕ} (x y : M F) :
 #align pfunctor.M.agree_iff_agree' PFunctor.M.agree_iff_agree'
 -/
 
+#print PFunctor.M.cases_mk /-
 @[simp]
 theorem cases_mk {r : M F → Sort _} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) :
     PFunctor.M.cases f (M.mk x) = f x :=
@@ -498,18 +498,23 @@ theorem cases_mk {r : M F → Sort _} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M
   cases h : x_snd x; dsimp only [head]
   congr with n; change (x_snd x).approx n = _; rw [h]
 #align pfunctor.M.cases_mk PFunctor.M.cases_mk
+-/
 
+#print PFunctor.M.casesOn_mk /-
 @[simp]
 theorem casesOn_mk {r : M F → Sort _} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) :
     PFunctor.M.casesOn (M.mk x) f = f x :=
   cases_mk x f
 #align pfunctor.M.cases_on_mk PFunctor.M.casesOn_mk
+-/
 
+#print PFunctor.M.casesOn_mk' /-
 @[simp]
 theorem casesOn_mk' {r : M F → Sort _} {a} (x : F.B a → M F)
     (f : ∀ (a) (f : F.B a → M F), r (M.mk ⟨a, f⟩)) : PFunctor.M.casesOn' (M.mk ⟨a, x⟩) f = f a x :=
   cases_mk ⟨_, x⟩ _
 #align pfunctor.M.cases_on_mk' PFunctor.M.casesOn_mk'
+-/
 
 #print PFunctor.M.IsPath /-
 /-- `is_path p x` tells us if `p` is a valid path through `x` -/
@@ -694,7 +699,6 @@ section Bisim
 
 variable (R : M F → M F → Prop)
 
--- mathport name: «expr ~ »
 local infixl:50 " ~ " => R
 
 #print PFunctor.M.IsBisimulation /-
@@ -787,6 +791,7 @@ theorem bisim (R : M P → M P → Prop)
 #align pfunctor.M.bisim PFunctor.M.bisim
 -/
 
+#print PFunctor.M.bisim' /-
 theorem bisim' {α : Type _} (Q : α → Prop) (u v : α → M P)
     (h :
       ∀ x,
@@ -802,6 +807,7 @@ theorem bisim' {α : Type _} (Q : α → Prop) (u v : α → M P)
       ⟨a, f, f', xeq.symm ▸ ux'eq, yeq.symm ▸ vx'eq, h'⟩)
     _ _ ⟨x, Qx, rfl, rfl⟩
 #align pfunctor.M.bisim' PFunctor.M.bisim'
+-/
 
 #print PFunctor.M.bisim_equiv /-
 -- for the record, show M_bisim follows from _bisim'
Diff
@@ -588,7 +588,6 @@ theorem head_mk (x : F.Obj (M F)) : head (M.mk x) = x.1 :=
     calc
       x.1 = (dest (M.mk x)).1 := by rw [dest_mk]
       _ = head (M.mk x) := by rfl
-      
 #align pfunctor.M.head_mk PFunctor.M.head_mk
 -/
 
Diff
@@ -30,7 +30,13 @@ open List hiding head?
 variable (F : PFunctor.{u})
 
 -- mathport name: «expr♯ »
-local prefix:0 "♯" => cast (by first |simp [*]|cc|solve_by_elim)
+local prefix:0 "♯" =>
+  cast
+    (by
+      first
+      | simp [*]
+      | cc
+      | solve_by_elim)
 
 namespace PFunctor
 
@@ -182,7 +188,7 @@ instance Path.inhabited : Inhabited (Path F) :=
 open List Nat
 
 instance : Subsingleton (CofixA F 0) :=
-  ⟨by intros ; casesm*cofix_a F 0; rfl⟩
+  ⟨by intros; casesm*cofix_a F 0; rfl⟩
 
 #print PFunctor.Approx.head_succ' /-
 theorem head_succ' (n m : ℕ) (x : ∀ n, CofixA F n) (Hconsistent : AllAgree x) :
@@ -194,14 +200,14 @@ theorem head_succ' (n m : ℕ) (x : ∀ n, CofixA F n) (Hconsistent : AllAgree x
   cases' h₁ : x 1 with _ i₁ f₁
   dsimp only [head']
   induction' n with n
-  · rw [h₁] at h₀; cases h₀; trivial
+  · rw [h₁] at h₀ ; cases h₀; trivial
   · have H := Hconsistent (succ n)
     cases' h₂ : x (succ n) with _ i₂ f₂
-    rw [h₀, h₂] at H
+    rw [h₀, h₂] at H 
     apply n_ih (truncate ∘ f₀)
     rw [h₂]
     cases' H with _ _ _ _ _ _ hagree
-    congr ; funext j; dsimp only [comp_app]
+    congr; funext j; dsimp only [comp_app]
     rw [truncate_eq_of_agree]
     apply hagree
 #align pfunctor.approx.head_succ' PFunctor.Approx.head_succ'
@@ -387,7 +393,7 @@ theorem dest_mk (x : F.Obj <| M F) : dest (M.mk x) = x :=
   cases h : ch i
   simp only [children, M.approx.s_mk, children', cast_eq]
   dsimp only [M.approx.s_mk, children']
-  congr ; rw [h]
+  congr; rw [h]
 #align pfunctor.M.dest_mk PFunctor.M.dest_mk
 -/
 
@@ -402,12 +408,12 @@ theorem mk_dest (x : M F) : M.mk (dest x) = x :=
   dsimp only [approx.s_mk, dest, head]
   cases' h : x.approx (succ n) with _ hd ch
   have h' : hd = head' (x.approx 1) := by rw [← head_succ' n, h, head']; apply x.consistent
-  revert ch; rw [h']; intros ; congr
+  revert ch; rw [h']; intros; congr
   · ext a; dsimp only [children]
     generalize hh : cast _ a = a''
-    rw [cast_eq_iff_heq] at hh
+    rw [cast_eq_iff_heq] at hh 
     revert a''
-    rw [h]; intros ; cases hh; rfl
+    rw [h]; intros; cases hh; rfl
 #align pfunctor.M.mk_dest PFunctor.M.mk_dest
 -/
 
@@ -454,7 +460,7 @@ theorem approx_mk (a : F.A) (f : F.B a → M F) (i : ℕ) :
 theorem agree'_refl {n : ℕ} (x : M F) : Agree' n x x :=
   by
   induction n generalizing x <;> induction x using PFunctor.M.casesOn' <;> constructor <;> try rfl
-  intros ; apply n_ih
+  intros; apply n_ih
 #align pfunctor.M.agree'_refl PFunctor.M.agree'_refl
 -/
 
@@ -466,7 +472,7 @@ theorem agree_iff_agree' {n : ℕ} (x y : M F) :
   · induction n generalizing x y; constructor
     · induction x using PFunctor.M.casesOn'
       induction y using PFunctor.M.casesOn'
-      simp only [approx_mk] at h; cases' h with _ _ _ _ _ _ hagree
+      simp only [approx_mk] at h ; cases' h with _ _ _ _ _ _ hagree
       constructor <;> try rfl
       intro i; apply n_ih; apply hagree
   · induction n generalizing x y; constructor
@@ -566,7 +572,7 @@ theorem iselect_eq_default [DecidableEq F.A] [Inhabited (M F)] (ps : Path F) (x
   · exfalso; apply h; constructor
   · cases' ps_hd with a i
     induction x using PFunctor.M.casesOn'
-    simp only [iselect, isubtree] at ps_ih⊢
+    simp only [iselect, isubtree] at ps_ih ⊢
     by_cases h'' : a = x_a; subst x_a
     · simp only [dif_pos, eq_self_iff_true, cases_on_mk']
       rw [ps_ih]; intro h'; apply h
@@ -600,7 +606,7 @@ theorem ichildren_mk [DecidableEq F.A] [Inhabited (M F)] (x : F.Obj (M F)) (i :
   dsimp only [ichildren, PFunctor.Obj.iget]
   congr with h; apply ext'
   dsimp only [children', M.mk, approx.s_mk]
-  intros ; rfl
+  intros; rfl
 #align pfunctor.M.ichildren_mk PFunctor.M.ichildren_mk
 -/
 
@@ -647,7 +653,7 @@ theorem ext_aux [Inhabited (M F)] [DecidableEq F.A] {n : ℕ} (x y z : M F) (hx
   induction' n with n generalizing x y z
   · specialize hrec [] rfl
     induction x using PFunctor.M.casesOn'; induction y using PFunctor.M.casesOn'
-    simp only [iselect_nil] at hrec; subst hrec
+    simp only [iselect_nil] at hrec ; subst hrec
     simp only [approx_mk, true_and_iff, eq_self_iff_true, heq_iff_eq]
     apply Subsingleton.elim
   · cases hx; cases hy
@@ -659,7 +665,7 @@ theorem ext_aux [Inhabited (M F)] [DecidableEq F.A] {n : ℕ} (x y z : M F) (hx
     · solve_by_elim
     · solve_by_elim
     introv h; specialize hrec (⟨_, i⟩ :: ps) (congr_arg _ h)
-    simp only [iselect_cons] at hrec; exact hrec
+    simp only [iselect_cons] at hrec ; exact hrec
 #align pfunctor.M.ext_aux PFunctor.M.ext_aux
 -/
 
@@ -679,7 +685,7 @@ theorem ext [Inhabited (M F)] (x y : M F) (H : ∀ ps : Path F, iselect ps x = i
     · rw [← agree_iff_agree']; apply x.consistent
     · rw [← agree_iff_agree', i_ih]; apply y.consistent
     introv H'
-    dsimp only [iselect] at H
+    dsimp only [iselect] at H 
     cases H'
     apply H ps
 #align pfunctor.M.ext PFunctor.M.ext
@@ -706,7 +712,7 @@ theorem nth_of_bisim [Inhabited (M F)] (bisim : IsBisimulation R) (s₁ s₂) (p
     s₁ ~ s₂ →
       IsPath ps s₁ ∨ IsPath ps s₂ →
         iselect ps s₁ = iselect ps s₂ ∧
-          ∃ (a : _)(f f' : F.B a → M F),
+          ∃ (a : _) (f f' : F.B a → M F),
             isubtree ps s₁ = M.mk ⟨a, f⟩ ∧
               isubtree ps s₂ = M.mk ⟨a, f'⟩ ∧ ∀ i : F.B a, f i ~ f' i :=
   by
@@ -719,12 +725,12 @@ theorem nth_of_bisim [Inhabited (M F)] (bisim : IsBisimulation R) (s₁ s₂) (p
     apply bisim.tail h₀
   cases' i with a' i
   obtain rfl : a = a' := by cases hh <;> cases is_path_cons hh <;> rfl
-  dsimp only [iselect] at ps_ih⊢
+  dsimp only [iselect] at ps_ih ⊢
   have h₁ := bisim.tail h₀ i
   induction' h : f i using PFunctor.M.casesOn' with a₀ f₀
   induction' h' : f' i using PFunctor.M.casesOn' with a₁ f₁
-  simp only [h, h', isubtree_cons] at ps_ih⊢
-  rw [h, h'] at h₁
+  simp only [h, h', isubtree_cons] at ps_ih ⊢
+  rw [h, h'] at h₁ 
   obtain rfl : a₀ = a₁ := bisim.head h₁
   apply ps_ih _ _ _ h₁
   rw [← h, ← h']; apply or_of_or_of_imp_of_imp hh is_path_cons' is_path_cons'
@@ -740,7 +746,7 @@ theorem eq_of_bisim [Nonempty (M F)] (bisim : IsBisimulation R) : ∀ s₁ s₂,
   by_cases h : is_path ps s₁ ∨ is_path ps s₂
   · have H := nth_of_bisim R bisim _ _ ps Hr h
     exact H.left
-  · rw [not_or] at h; cases' h with h₀ h₁
+  · rw [not_or] at h ; cases' h with h₀ h₁
     simp only [iselect_eq_default, *, not_false_iff]
 #align pfunctor.M.eq_of_bisim PFunctor.M.eq_of_bisim
 -/
@@ -774,9 +780,9 @@ theorem bisim (R : M P → M P → Prop)
   constructor <;> introv ih <;> rcases h _ _ ih with ⟨a'', g, g', h₀, h₁, h₂⟩ <;> clear h
   · replace h₀ := congr_arg Sigma.fst h₀
     replace h₁ := congr_arg Sigma.fst h₁
-    simp only [dest_mk] at h₀ h₁
+    simp only [dest_mk] at h₀ h₁ 
     rw [h₀, h₁]
-  · simp only [dest_mk] at h₀ h₁
+  · simp only [dest_mk] at h₀ h₁ 
     cases h₀; cases h₁
     apply h₂
 #align pfunctor.M.bisim PFunctor.M.bisim
Diff
@@ -480,12 +480,6 @@ theorem agree_iff_agree' {n : ℕ} (x y : M F) :
 #align pfunctor.M.agree_iff_agree' PFunctor.M.agree_iff_agree'
 -/
 
-/- warning: pfunctor.M.cases_mk -> PFunctor.M.cases_mk is a dubious translation:
-lean 3 declaration is
-  forall {F : PFunctor.{u1}} {r : (PFunctor.M.{u1} F) -> Sort.{u2}} (x : PFunctor.Obj.{u1, u1} F (PFunctor.M.{u1} F)) (f : forall (x : PFunctor.Obj.{u1, u1} F (PFunctor.M.{u1} F)), r (PFunctor.M.mk.{u1} F x)), Eq.{u2} (r (PFunctor.M.mk.{u1} F x)) (PFunctor.M.cases.{u1, u2} F r f (PFunctor.M.mk.{u1} F x)) (f x)
-but is expected to have type
-  forall {F : PFunctor.{u2}} {r : (PFunctor.M.{u2} F) -> Sort.{u1}} (x : PFunctor.Obj.{u2, u2} F (PFunctor.M.{u2} F)) (f : forall (x : PFunctor.Obj.{u2, u2} F (PFunctor.M.{u2} F)), r (PFunctor.M.mk.{u2} F x)), Eq.{u1} (r (PFunctor.M.mk.{u2} F x)) (PFunctor.M.cases.{u2, u1} F r f (PFunctor.M.mk.{u2} F x)) (f x)
-Case conversion may be inaccurate. Consider using '#align pfunctor.M.cases_mk PFunctor.M.cases_mkₓ'. -/
 @[simp]
 theorem cases_mk {r : M F → Sort _} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) :
     PFunctor.M.cases f (M.mk x) = f x :=
@@ -499,24 +493,12 @@ theorem cases_mk {r : M F → Sort _} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M
   congr with n; change (x_snd x).approx n = _; rw [h]
 #align pfunctor.M.cases_mk PFunctor.M.cases_mk
 
-/- warning: pfunctor.M.cases_on_mk -> PFunctor.M.casesOn_mk is a dubious translation:
-lean 3 declaration is
-  forall {F : PFunctor.{u1}} {r : (PFunctor.M.{u1} F) -> Sort.{u2}} (x : PFunctor.Obj.{u1, u1} F (PFunctor.M.{u1} F)) (f : forall (x : PFunctor.Obj.{u1, u1} F (PFunctor.M.{u1} F)), r (PFunctor.M.mk.{u1} F x)), Eq.{u2} (r (PFunctor.M.mk.{u1} F x)) (PFunctor.M.casesOn.{u1, u2} F r (PFunctor.M.mk.{u1} F x) f) (f x)
-but is expected to have type
-  forall {F : PFunctor.{u2}} {r : (PFunctor.M.{u2} F) -> Sort.{u1}} (x : PFunctor.Obj.{u2, u2} F (PFunctor.M.{u2} F)) (f : forall (x : PFunctor.Obj.{u2, u2} F (PFunctor.M.{u2} F)), r (PFunctor.M.mk.{u2} F x)), Eq.{u1} (r (PFunctor.M.mk.{u2} F x)) (PFunctor.M.casesOn.{u2, u1} F r (PFunctor.M.mk.{u2} F x) f) (f x)
-Case conversion may be inaccurate. Consider using '#align pfunctor.M.cases_on_mk PFunctor.M.casesOn_mkₓ'. -/
 @[simp]
 theorem casesOn_mk {r : M F → Sort _} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) :
     PFunctor.M.casesOn (M.mk x) f = f x :=
   cases_mk x f
 #align pfunctor.M.cases_on_mk PFunctor.M.casesOn_mk
 
-/- warning: pfunctor.M.cases_on_mk' -> PFunctor.M.casesOn_mk' is a dubious translation:
-lean 3 declaration is
-  forall {F : PFunctor.{u1}} {r : (PFunctor.M.{u1} F) -> Sort.{u2}} {a : PFunctor.A.{u1} F} (x : (PFunctor.B.{u1} F a) -> (PFunctor.M.{u1} F)) (f : forall (a : PFunctor.A.{u1} F) (f : (PFunctor.B.{u1} F a) -> (PFunctor.M.{u1} F)), r (PFunctor.M.mk.{u1} F (Sigma.mk.{u1, u1} (PFunctor.A.{u1} F) (fun (x : PFunctor.A.{u1} F) => (PFunctor.B.{u1} F x) -> (PFunctor.M.{u1} F)) a f))), Eq.{u2} (r (PFunctor.M.mk.{u1} F (Sigma.mk.{u1, u1} (PFunctor.A.{u1} F) (fun (x : PFunctor.A.{u1} F) => (PFunctor.B.{u1} F x) -> (PFunctor.M.{u1} F)) a x))) (PFunctor.M.casesOn'.{u1, u2} F r (PFunctor.M.mk.{u1} F (Sigma.mk.{u1, u1} (PFunctor.A.{u1} F) (fun (x : PFunctor.A.{u1} F) => (PFunctor.B.{u1} F x) -> (PFunctor.M.{u1} F)) a x)) f) (f a x)
-but is expected to have type
-  forall {F : PFunctor.{u2}} {r : (PFunctor.M.{u2} F) -> Sort.{u1}} {a : PFunctor.A.{u2} F} (x : (PFunctor.B.{u2} F a) -> (PFunctor.M.{u2} F)) (f : forall (a : PFunctor.A.{u2} F) (f : (PFunctor.B.{u2} F a) -> (PFunctor.M.{u2} F)), r (PFunctor.M.mk.{u2} F (Sigma.mk.{u2, u2} (PFunctor.A.{u2} F) (fun (x : PFunctor.A.{u2} F) => (PFunctor.B.{u2} F x) -> (PFunctor.M.{u2} F)) a f))), Eq.{u1} (r (PFunctor.M.mk.{u2} F (Sigma.mk.{u2, u2} (PFunctor.A.{u2} F) (fun (x : PFunctor.A.{u2} F) => (PFunctor.B.{u2} F x) -> (PFunctor.M.{u2} F)) a x))) (PFunctor.M.casesOn'.{u2, u1} F r (PFunctor.M.mk.{u2} F (Sigma.mk.{u2, u2} (PFunctor.A.{u2} F) (fun (x : PFunctor.A.{u2} F) => (PFunctor.B.{u2} F x) -> (PFunctor.M.{u2} F)) a x)) f) (f a x)
-Case conversion may be inaccurate. Consider using '#align pfunctor.M.cases_on_mk' PFunctor.M.casesOn_mk'ₓ'. -/
 @[simp]
 theorem casesOn_mk' {r : M F → Sort _} {a} (x : F.B a → M F)
     (f : ∀ (a) (f : F.B a → M F), r (M.mk ⟨a, f⟩)) : PFunctor.M.casesOn' (M.mk ⟨a, x⟩) f = f a x :=
@@ -800,12 +782,6 @@ theorem bisim (R : M P → M P → Prop)
 #align pfunctor.M.bisim PFunctor.M.bisim
 -/
 
-/- warning: pfunctor.M.bisim' -> PFunctor.M.bisim' is a dubious translation:
-lean 3 declaration is
-  forall {P : PFunctor.{u1}} {α : Type.{u2}} (Q : α -> Prop) (u : α -> (PFunctor.M.{u1} P)) (v : α -> (PFunctor.M.{u1} P)), (forall (x : α), (Q x) -> (Exists.{succ u1} (PFunctor.A.{u1} P) (fun (a : PFunctor.A.{u1} P) => Exists.{succ u1} ((PFunctor.B.{u1} P a) -> (PFunctor.M.{u1} P)) (fun (f : (PFunctor.B.{u1} P a) -> (PFunctor.M.{u1} P)) => Exists.{succ u1} ((PFunctor.B.{u1} P a) -> (PFunctor.M.{u1} P)) (fun (f' : (PFunctor.B.{u1} P a) -> (PFunctor.M.{u1} P)) => And (Eq.{succ u1} (PFunctor.Obj.{u1, u1} P (PFunctor.M.{u1} P)) (PFunctor.M.dest.{u1} P (u x)) (Sigma.mk.{u1, u1} (PFunctor.A.{u1} P) (fun (x : PFunctor.A.{u1} P) => (PFunctor.B.{u1} P x) -> (PFunctor.M.{u1} P)) a f)) (And (Eq.{succ u1} (PFunctor.Obj.{u1, u1} P (PFunctor.M.{u1} P)) (PFunctor.M.dest.{u1} P (v x)) (Sigma.mk.{u1, u1} (PFunctor.A.{u1} P) (fun (x : PFunctor.A.{u1} P) => (PFunctor.B.{u1} P x) -> (PFunctor.M.{u1} P)) a f')) (forall (i : PFunctor.B.{u1} P a), Exists.{succ u2} α (fun (x' : α) => And (Q x') (And (Eq.{succ u1} (PFunctor.M.{u1} P) (f i) (u x')) (Eq.{succ u1} (PFunctor.M.{u1} P) (f' i) (v x'))))))))))) -> (forall (x : α), (Q x) -> (Eq.{succ u1} (PFunctor.M.{u1} P) (u x) (v x)))
-but is expected to have type
-  forall {P : PFunctor.{u2}} {α : Type.{u1}} (Q : α -> Prop) (u : α -> (PFunctor.M.{u2} P)) (v : α -> (PFunctor.M.{u2} P)), (forall (x : α), (Q x) -> (Exists.{succ u2} (PFunctor.A.{u2} P) (fun (a : PFunctor.A.{u2} P) => Exists.{succ u2} ((PFunctor.B.{u2} P a) -> (PFunctor.M.{u2} P)) (fun (f : (PFunctor.B.{u2} P a) -> (PFunctor.M.{u2} P)) => Exists.{succ u2} ((PFunctor.B.{u2} P a) -> (PFunctor.M.{u2} P)) (fun (f' : (PFunctor.B.{u2} P a) -> (PFunctor.M.{u2} P)) => And (Eq.{succ u2} (PFunctor.Obj.{u2, u2} P (PFunctor.M.{u2} P)) (PFunctor.M.dest.{u2} P (u x)) (Sigma.mk.{u2, u2} (PFunctor.A.{u2} P) (fun (x : PFunctor.A.{u2} P) => (PFunctor.B.{u2} P x) -> (PFunctor.M.{u2} P)) a f)) (And (Eq.{succ u2} (PFunctor.Obj.{u2, u2} P (PFunctor.M.{u2} P)) (PFunctor.M.dest.{u2} P (v x)) (Sigma.mk.{u2, u2} (PFunctor.A.{u2} P) (fun (x : PFunctor.A.{u2} P) => (PFunctor.B.{u2} P x) -> (PFunctor.M.{u2} P)) a f')) (forall (i : PFunctor.B.{u2} P a), Exists.{succ u1} α (fun (x' : α) => And (Q x') (And (Eq.{succ u2} (PFunctor.M.{u2} P) (f i) (u x')) (Eq.{succ u2} (PFunctor.M.{u2} P) (f' i) (v x'))))))))))) -> (forall (x : α), (Q x) -> (Eq.{succ u2} (PFunctor.M.{u2} P) (u x) (v x)))
-Case conversion may be inaccurate. Consider using '#align pfunctor.M.bisim' PFunctor.M.bisim'ₓ'. -/
 theorem bisim' {α : Type _} (Q : α → Prop) (u v : α → M P)
     (h :
       ∀ x,
Diff
@@ -136,8 +136,7 @@ theorem truncate_eq_of_agree {n : ℕ} (x : CofixA F n) (y : CofixA F (succ n))
   · cases' h with _ _ _ _ _ h₀ h₁
     cases h
     simp only [truncate, Function.comp, true_and_iff, eq_self_iff_true, heq_iff_eq]
-    ext y
-    apply n_ih
+    ext y; apply n_ih
     apply h₁
 #align pfunctor.approx.truncate_eq_of_agree PFunctor.Approx.truncate_eq_of_agree
 -/
@@ -183,34 +182,26 @@ instance Path.inhabited : Inhabited (Path F) :=
 open List Nat
 
 instance : Subsingleton (CofixA F 0) :=
-  ⟨by
-    intros
-    casesm*cofix_a F 0
-    rfl⟩
+  ⟨by intros ; casesm*cofix_a F 0; rfl⟩
 
 #print PFunctor.Approx.head_succ' /-
 theorem head_succ' (n m : ℕ) (x : ∀ n, CofixA F n) (Hconsistent : AllAgree x) :
     head' (x (succ n)) = head' (x (succ m)) :=
   by
   suffices ∀ n, head' (x (succ n)) = head' (x 1) by simp [this]
-  clear m n
-  intro
+  clear m n; intro
   cases' h₀ : x (succ n) with _ i₀ f₀
   cases' h₁ : x 1 with _ i₁ f₁
   dsimp only [head']
   induction' n with n
-  · rw [h₁] at h₀
-    cases h₀
-    trivial
+  · rw [h₁] at h₀; cases h₀; trivial
   · have H := Hconsistent (succ n)
     cases' h₂ : x (succ n) with _ i₂ f₂
     rw [h₀, h₂] at H
     apply n_ih (truncate ∘ f₀)
     rw [h₂]
     cases' H with _ _ _ _ _ _ hagree
-    congr
-    funext j
-    dsimp only [comp_app]
+    congr ; funext j; dsimp only [comp_app]
     rw [truncate_eq_of_agree]
     apply hagree
 #align pfunctor.approx.head_succ' PFunctor.Approx.head_succ'
@@ -260,12 +251,8 @@ instance MIntl.inhabited [Inhabited F.A] : Inhabited (MIntl F) :=
 namespace M
 
 #print PFunctor.M.ext' /-
-theorem ext' (x y : M F) (H : ∀ i : ℕ, x.approx i = y.approx i) : x = y :=
-  by
-  cases x
-  cases y
-  congr with n
-  apply H
+theorem ext' (x y : M F) (H : ∀ i : ℕ, x.approx i = y.approx i) : x = y := by cases x; cases y;
+  congr with n; apply H
 #align pfunctor.M.ext' PFunctor.M.ext'
 -/
 
@@ -363,8 +350,7 @@ protected def sMk (x : F.Obj <| M F) : ∀ n, CofixA F n
 protected theorem P_mk (x : F.Obj <| M F) : AllAgree (Approx.sMk x)
   | 0 => by constructor
   | succ n => by
-    constructor
-    introv
+    constructor; introv
     apply (x.2 i).consistent
 #align pfunctor.M.approx.P_mk PFunctor.M.Approx.P_mk
 -/
@@ -409,30 +395,19 @@ theorem dest_mk (x : F.Obj <| M F) : dest (M.mk x) = x :=
 @[simp]
 theorem mk_dest (x : M F) : M.mk (dest x) = x :=
   by
-  apply ext'
-  intro n
+  apply ext'; intro n
   dsimp only [M.mk]
   induction' n with n
   · apply Subsingleton.elim
   dsimp only [approx.s_mk, dest, head]
   cases' h : x.approx (succ n) with _ hd ch
-  have h' : hd = head' (x.approx 1) :=
-    by
-    rw [← head_succ' n, h, head']
-    apply x.consistent
-  revert ch
-  rw [h']
-  intros
-  congr
-  · ext a
-    dsimp only [children]
+  have h' : hd = head' (x.approx 1) := by rw [← head_succ' n, h, head']; apply x.consistent
+  revert ch; rw [h']; intros ; congr
+  · ext a; dsimp only [children]
     generalize hh : cast _ a = a''
     rw [cast_eq_iff_heq] at hh
     revert a''
-    rw [h]
-    intros
-    cases hh
-    rfl
+    rw [h]; intros ; cases hh; rfl
 #align pfunctor.M.mk_dest PFunctor.M.mk_dest
 -/
 
@@ -447,8 +422,7 @@ protected def cases {r : M F → Sort w} (f : ∀ x : F.Obj <| M F, r (M.mk x))
   suffices r (M.mk (dest x)) by
     haveI := Classical.propDecidable
     haveI := Inhabited.mk x
-    rw [← mk_dest x]
-    exact this
+    rw [← mk_dest x]; exact this
   f _
 #align pfunctor.M.cases PFunctor.M.cases
 -/
@@ -480,8 +454,7 @@ theorem approx_mk (a : F.A) (f : F.B a → M F) (i : ℕ) :
 theorem agree'_refl {n : ℕ} (x : M F) : Agree' n x x :=
   by
   induction n generalizing x <;> induction x using PFunctor.M.casesOn' <;> constructor <;> try rfl
-  intros
-  apply n_ih
+  intros ; apply n_ih
 #align pfunctor.M.agree'_refl PFunctor.M.agree'_refl
 -/
 
@@ -490,30 +463,20 @@ theorem agree_iff_agree' {n : ℕ} (x y : M F) :
     Agree (x.approx n) (y.approx <| n + 1) ↔ Agree' n x y :=
   by
   constructor <;> intro h
-  · induction n generalizing x y
-    constructor
+  · induction n generalizing x y; constructor
     · induction x using PFunctor.M.casesOn'
       induction y using PFunctor.M.casesOn'
-      simp only [approx_mk] at h
-      cases' h with _ _ _ _ _ _ hagree
+      simp only [approx_mk] at h; cases' h with _ _ _ _ _ _ hagree
       constructor <;> try rfl
-      intro i
-      apply n_ih
-      apply hagree
-  · induction n generalizing x y
-    constructor
+      intro i; apply n_ih; apply hagree
+  · induction n generalizing x y; constructor
     · cases h
       induction x using PFunctor.M.casesOn'
       induction y using PFunctor.M.casesOn'
       simp only [approx_mk]
-      have h_a_1 := mk_inj ‹M.mk ⟨x_a, x_f⟩ = M.mk ⟨h_a, h_x⟩›
-      cases h_a_1
-      replace h_a_2 := mk_inj ‹M.mk ⟨y_a, y_f⟩ = M.mk ⟨h_a, h_y⟩›
-      cases h_a_2
-      constructor
-      intro i
-      apply n_ih
-      simp [*]
+      have h_a_1 := mk_inj ‹M.mk ⟨x_a, x_f⟩ = M.mk ⟨h_a, h_x⟩›; cases h_a_1
+      replace h_a_2 := mk_inj ‹M.mk ⟨y_a, y_f⟩ = M.mk ⟨h_a, h_y⟩›; cases h_a_2
+      constructor; intro i; apply n_ih; simp [*]
 #align pfunctor.M.agree_iff_agree' PFunctor.M.agree_iff_agree'
 -/
 
@@ -618,20 +581,14 @@ theorem iselect_eq_default [DecidableEq F.A] [Inhabited (M F)] (ps : Path F) (x
     (h : ¬IsPath ps x) : iselect ps x = head default :=
   by
   induction ps generalizing x
-  · exfalso
-    apply h
-    constructor
+  · exfalso; apply h; constructor
   · cases' ps_hd with a i
     induction x using PFunctor.M.casesOn'
     simp only [iselect, isubtree] at ps_ih⊢
-    by_cases h'' : a = x_a
-    subst x_a
+    by_cases h'' : a = x_a; subst x_a
     · simp only [dif_pos, eq_self_iff_true, cases_on_mk']
-      rw [ps_ih]
-      intro h'
-      apply h
-      constructor <;> try rfl
-      apply h'
+      rw [ps_ih]; intro h'; apply h
+      constructor <;> try rfl; apply h'
     · simp [*]
 #align pfunctor.M.iselect_eq_default PFunctor.M.iselect_eq_default
 -/
@@ -659,11 +616,9 @@ theorem ichildren_mk [DecidableEq F.A] [Inhabited (M F)] (x : F.Obj (M F)) (i :
     ichildren i (M.mk x) = x.iget i :=
   by
   dsimp only [ichildren, PFunctor.Obj.iget]
-  congr with h
-  apply ext'
+  congr with h; apply ext'
   dsimp only [children', M.mk, approx.s_mk]
-  intros
-  rfl
+  intros ; rfl
 #align pfunctor.M.ichildren_mk PFunctor.M.ichildren_mk
 -/
 
@@ -695,10 +650,8 @@ theorem corec_def {X} (f : X → F.Obj X) (x₀ : X) : M.corec f x₀ = M.mk (M.
   dsimp only [M.corec, M.mk]
   congr with n
   cases' n with n
-  · dsimp only [s_corec, approx.s_mk]
-    rfl
-  · dsimp only [s_corec, approx.s_mk]
-    cases h : f x₀
+  · dsimp only [s_corec, approx.s_mk]; rfl
+  · dsimp only [s_corec, approx.s_mk]; cases h : f x₀
     dsimp only [(· <$> ·), PFunctor.map]
     congr
 #align pfunctor.M.corec_def PFunctor.M.corec_def
@@ -711,27 +664,20 @@ theorem ext_aux [Inhabited (M F)] [DecidableEq F.A] {n : ℕ} (x y z : M F) (hx
   by
   induction' n with n generalizing x y z
   · specialize hrec [] rfl
-    induction x using PFunctor.M.casesOn'
-    induction y using PFunctor.M.casesOn'
-    simp only [iselect_nil] at hrec
-    subst hrec
+    induction x using PFunctor.M.casesOn'; induction y using PFunctor.M.casesOn'
+    simp only [iselect_nil] at hrec; subst hrec
     simp only [approx_mk, true_and_iff, eq_self_iff_true, heq_iff_eq]
     apply Subsingleton.elim
-  · cases hx
-    cases hy
-    induction x using PFunctor.M.casesOn'
-    induction y using PFunctor.M.casesOn'
+  · cases hx; cases hy
+    induction x using PFunctor.M.casesOn'; induction y using PFunctor.M.casesOn'
     subst z
     iterate 3 have := mk_inj ‹_›; repeat' cases this
     simp only [approx_mk, true_and_iff, eq_self_iff_true, heq_iff_eq]
-    ext i
-    apply n_ih
+    ext i; apply n_ih
     · solve_by_elim
     · solve_by_elim
-    introv h
-    specialize hrec (⟨_, i⟩ :: ps) (congr_arg _ h)
-    simp only [iselect_cons] at hrec
-    exact hrec
+    introv h; specialize hrec (⟨_, i⟩ :: ps) (congr_arg _ h)
+    simp only [iselect_cons] at hrec; exact hrec
 #align pfunctor.M.ext_aux PFunctor.M.ext_aux
 -/
 
@@ -746,14 +692,10 @@ theorem ext [Inhabited (M F)] (x y : M F) (H : ∀ ps : Path F, iselect ps x = i
     x = y := by
   apply ext'; intro i
   induction' i with i
-  · cases x.approx 0
-    cases y.approx 0
-    constructor
+  · cases x.approx 0; cases y.approx 0; constructor
   · apply ext_aux x y x
-    · rw [← agree_iff_agree']
-      apply x.consistent
-    · rw [← agree_iff_agree', i_ih]
-      apply y.consistent
+    · rw [← agree_iff_agree']; apply x.consistent
+    · rw [← agree_iff_agree', i_ih]; apply y.consistent
     introv H'
     dsimp only [iselect] at H
     cases H'
@@ -803,8 +745,7 @@ theorem nth_of_bisim [Inhabited (M F)] (bisim : IsBisimulation R) (s₁ s₂) (p
   rw [h, h'] at h₁
   obtain rfl : a₀ = a₁ := bisim.head h₁
   apply ps_ih _ _ _ h₁
-  rw [← h, ← h']
-  apply or_of_or_of_imp_of_imp hh is_path_cons' is_path_cons'
+  rw [← h, ← h']; apply or_of_or_of_imp_of_imp hh is_path_cons' is_path_cons'
 #align pfunctor.M.nth_of_bisim PFunctor.M.nth_of_bisim
 -/
 
@@ -817,8 +758,7 @@ theorem eq_of_bisim [Nonempty (M F)] (bisim : IsBisimulation R) : ∀ s₁ s₂,
   by_cases h : is_path ps s₁ ∨ is_path ps s₂
   · have H := nth_of_bisim R bisim _ _ ps Hr h
     exact H.left
-  · rw [not_or] at h
-    cases' h with h₀ h₁
+  · rw [not_or] at h; cases' h with h₀ h₁
     simp only [iselect_eq_default, *, not_false_iff]
 #align pfunctor.M.eq_of_bisim PFunctor.M.eq_of_bisim
 -/
@@ -855,8 +795,7 @@ theorem bisim (R : M P → M P → Prop)
     simp only [dest_mk] at h₀ h₁
     rw [h₀, h₁]
   · simp only [dest_mk] at h₀ h₁
-    cases h₀
-    cases h₁
+    cases h₀; cases h₁
     apply h₂
 #align pfunctor.M.bisim PFunctor.M.bisim
 -/
Diff
@@ -739,7 +739,7 @@ open PFunctor.Approx
 
 variable {F}
 
-attribute [local instance] Classical.propDecidable
+attribute [local instance 0] Classical.propDecidable
 
 #print PFunctor.M.ext /-
 theorem ext [Inhabited (M F)] (x y : M F) (H : ∀ ps : Path F, iselect ps x = iselect ps y) :
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Simon Hudon
 
 ! This file was ported from Lean 3 source module data.pfunctor.univariate.M
-! leanprover-community/mathlib commit 356447fe00e75e54777321045cdff7c9ea212e60
+! leanprover-community/mathlib commit 23aa88e32dcc9d2a24cca7bc23268567ed4cd7d6
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -13,6 +13,9 @@ import Mathbin.Data.Pfunctor.Univariate.Basic
 /-!
 # M-types
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 M types are potentially infinite tree-like structures. They are defined
 as the greatest fixpoint of a polynomial functor.
 -/

Changes in mathlib4

mathlib3
mathlib4
chore: adapt to multiple goal linter 1 (#12338)

A PR accompanying #12339.

Zulip discussion

Diff
@@ -249,7 +249,7 @@ def children (x : M F) (i : F.B (head x)) : M F :=
       have P' := x.2 (succ n)
       apply agree_children _ _ _ P'
       trans i
-      apply cast_heq
+      · apply cast_heq
       symm
       apply cast_heq }
 set_option linter.uppercaseLean3 false in
@@ -516,8 +516,8 @@ theorem iselect_eq_default [DecidableEq F.A] [Inhabited (M F)] (ps : Path F) (x
     induction' x using PFunctor.M.casesOn' with x_a x_f
     simp only [iselect, isubtree] at ps_ih ⊢
     by_cases h'' : a = x_a
-    subst x_a
-    · simp only [dif_pos, eq_self_iff_true, casesOn_mk']
+    · subst x_a
+      simp only [dif_pos, eq_self_iff_true, casesOn_mk']
       rw [ps_ih]
       intro h'
       apply h
chore: remove unnecessary cdots (#12417)

These · are scoping when there is a single active goal.

These were found using a modification of the linter at #12339.

Diff
@@ -347,15 +347,15 @@ theorem mk_dest (x : M F) : M.mk (dest x) = x := by
   rw [h']
   intros ch h
   congr
-  · ext a
-    dsimp only [children]
-    generalize hh : cast _ a = a''
-    rw [cast_eq_iff_heq] at hh
-    revert a''
-    rw [h]
-    intros _ hh
-    cases hh
-    rfl
+  ext a
+  dsimp only [children]
+  generalize hh : cast _ a = a''
+  rw [cast_eq_iff_heq] at hh
+  revert a''
+  rw [h]
+  intros _ hh
+  cases hh
+  rfl
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.mk_dest PFunctor.M.mk_dest
 
@@ -404,7 +404,7 @@ theorem agree_iff_agree' {n : ℕ} (x y : M F) :
     Agree (x.approx n) (y.approx <| n + 1) ↔ Agree' n x y := by
   constructor <;> intro h
   · induction' n with _ n_ih generalizing x y
-    constructor
+    · constructor
     · induction x using PFunctor.M.casesOn'
       induction y using PFunctor.M.casesOn'
       simp only [approx_mk] at h
@@ -414,7 +414,7 @@ theorem agree_iff_agree' {n : ℕ} (x y : M F) :
       apply n_ih
       apply hagree
   · induction' n with _ n_ih generalizing x y
-    constructor
+    · constructor
     · cases' h with _ _ _ a x' y'
       induction' x using PFunctor.M.casesOn' with x_a x_f
       induction' y using PFunctor.M.casesOn' with y_a y_f
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -116,7 +116,6 @@ theorem truncate_eq_of_agree {n : ℕ} (x : CofixA F n) (y : CofixA F (succ n))
 #align pfunctor.approx.truncate_eq_of_agree PFunctor.Approx.truncate_eq_of_agree
 
 variable {X : Type w}
-
 variable (f : X → F X)
 
 /-- `sCorec f i n` creates an approximation of height `n`
@@ -224,9 +223,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.ext' PFunctor.M.ext'
 
 variable {X : Type*}
-
 variable (f : X → F X)
-
 variable {F}
 
 /-- Corecursor for the M-type defined by `F`. -/
chore: remove tactics (#11365)

More tactics that are not used, found using the linter at #11308.

The PR consists of tactic removals, whitespace changes and replacing a porting note by an explanation.

Diff
@@ -108,7 +108,7 @@ theorem truncate_eq_of_agree {n : ℕ} (x : CofixA F n) (y : CofixA F (succ n))
     -- Porting note: used to be `ext y`
     rename_i n_ih a f y h₁
     suffices (fun x => truncate (y x)) = f
-      by simp [this]; try (exact HEq.rfl;)
+      by simp [this]
     funext y
 
     apply n_ih
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
@@ -23,7 +23,7 @@ open List
 
 variable (F : PFunctor.{u})
 
--- porting note: the ♯ tactic is never used
+-- Porting note: the ♯ tactic is never used
 -- local prefix:0 "♯" => cast (by first |simp [*]|cc|solve_by_elim)
 
 namespace PFunctor
@@ -105,7 +105,7 @@ theorem truncate_eq_of_agree {n : ℕ} (x : CofixA F n) (y : CofixA F (succ n))
   · -- cases' h with _ _ _ _ _ h₀ h₁
     cases h
     simp only [truncate, Function.comp, true_and_iff, eq_self_iff_true, heq_iff_eq]
-    -- porting note: used to be `ext y`
+    -- Porting note: used to be `ext y`
     rename_i n_ih a f y h₁
     suffices (fun x => truncate (y x)) = f
       by simp [this]; try (exact HEq.rfl;)
chore: remove unused cases' names (#9451)

These unused names will soon acquire a linter warning. Easiest to clean them up pre-emptively.

(Thanks to @nomeata for fixing these on nightly-testing.)

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

Diff
@@ -129,7 +129,7 @@ def sCorec : X → ∀ n, CofixA F n
 theorem P_corec (i : X) (n : ℕ) : Agree (sCorec f i n) (sCorec f i (succ n)) := by
   induction' n with n n_ih generalizing i
   constructor
-  cases' h : f i with y g
+  cases' f i with y g
   constructor
   introv
   apply n_ih
@@ -578,7 +578,7 @@ theorem corec_def {X} (f : X → F X) (x₀ : X) : M.corec f x₀ = M.mk (F.map
   cases' n with n
   · dsimp only [sCorec, Approx.sMk]
   · dsimp only [sCorec, Approx.sMk]
-    cases h : f x₀
+    cases f x₀
     dsimp only [PFunctor.map]
     congr
 set_option linter.uppercaseLean3 false in
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
@@ -572,14 +572,14 @@ theorem iselect_cons [DecidableEq F.A] [Inhabited (M F)] (ps : Path F) {a} (f :
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.iselect_cons PFunctor.M.iselect_cons
 
-theorem corec_def {X} (f : X → F X) (x₀ : X) : M.corec f x₀ = M.mk (M.corec f <$> f x₀) := by
+theorem corec_def {X} (f : X → F X) (x₀ : X) : M.corec f x₀ = M.mk (F.map (M.corec f) (f x₀)) := by
   dsimp only [M.corec, M.mk]
   congr with n
   cases' n with n
   · dsimp only [sCorec, Approx.sMk]
   · dsimp only [sCorec, Approx.sMk]
     cases h : f x₀
-    dsimp only [(· <$> ·), PFunctor.map]
+    dsimp only [PFunctor.map]
     congr
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.corec_def PFunctor.M.corec_def
@@ -712,9 +712,9 @@ def corecOn {X : Type*} (x₀ : X) (f : X → F X) : M F :=
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.corec_on PFunctor.M.corecOn
 
-variable {P : PFunctor.{u}} {α : Type u}
+variable {P : PFunctor.{u}} {α : Type*}
 
-theorem dest_corec (g : α → P α) (x : α) : M.dest (M.corec g x) = M.corec g <$> g x := by
+theorem dest_corec (g : α → P α) (x : α) : M.dest (M.corec g x) = P.map (M.corec g) (g x) := by
   rw [corec_def, dest_mk]
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.dest_corec PFunctor.M.dest_corec
@@ -766,7 +766,7 @@ theorem bisim_equiv (R : M P → M P → Prop)
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.bisim_equiv PFunctor.M.bisim_equiv
 
-theorem corec_unique (g : α → P α) (f : α → M P) (hyp : ∀ x, M.dest (f x) = f <$> g x) :
+theorem corec_unique (g : α → P α) (f : α → M P) (hyp : ∀ x, M.dest (f x) = P.map f (g x)) :
     f = M.corec g := by
   ext x
   apply bisim' (fun _ => True) _ _ _ _ trivial
@@ -796,7 +796,7 @@ def corec' {α : Type u} (F : ∀ {X : Type u}, (α → X) → α → Sum (M P)
       let y := a >>= F (rec ∘ Sum.inr)
       match y with
       | Sum.inr y => y
-      | Sum.inl y => (rec ∘ Sum.inl) <$> M.dest y)
+      | Sum.inl y => P.map (rec ∘ Sum.inl) (M.dest y))
     (@Sum.inr (M P) _ x)
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.corec' PFunctor.M.corec'
fix(Tactic/Cases): fix context for induction' (#7684)

Adding a test case for induction' that failed and fixing it: induction' a would accidentally leave a and variables depending on a in context.

Diff
@@ -669,10 +669,7 @@ theorem nth_of_bisim [Inhabited (M F)] (bisim : IsBisimulation R) (s₁ s₂) (p
               isubtree ps s₂ = M.mk ⟨a, f'⟩ ∧ ∀ i : F.B a, f i ~ f' i := by
   intro h₀ hh
   induction' s₁ using PFunctor.M.casesOn' with a f
-  rename_i h₁ hh₁
   induction' s₂ using PFunctor.M.casesOn' with a' f'
-  rename_i h₁' hh₁' h₂ hh₂
-  clear h₁ hh₁ h₂ hh₂ hh₁'
   obtain rfl : a = a' := bisim.head h₀
   induction' ps with i ps ps_ih generalizing a f f'
   · exists rfl, a, f, f', rfl, rfl
style: CoeFun for PFunctor.Obj & MvPFunctor.Obj (#7526)
Diff
@@ -117,7 +117,7 @@ theorem truncate_eq_of_agree {n : ℕ} (x : CofixA F n) (y : CofixA F (succ n))
 
 variable {X : Type w}
 
-variable (f : X → F.Obj X)
+variable (f : X → F X)
 
 /-- `sCorec f i n` creates an approximation of height `n`
 of the final coalgebra of `f` -/
@@ -225,7 +225,7 @@ set_option linter.uppercaseLean3 false in
 
 variable {X : Type*}
 
-variable (f : X → F.Obj X)
+variable (f : X → F X)
 
 variable {F}
 
@@ -287,7 +287,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.truncate_approx PFunctor.M.truncate_approx
 
 /-- unfold an M-type -/
-def dest : M F → F.Obj (M F)
+def dest : M F → F (M F)
   | x => ⟨head x, fun i => children x i⟩
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.dest PFunctor.M.dest
@@ -295,13 +295,13 @@ set_option linter.uppercaseLean3 false in
 namespace Approx
 
 /-- generates the approximations needed for `M.mk` -/
-protected def sMk (x : F.Obj <| M F) : ∀ n, CofixA F n
+protected def sMk (x : F (M F)) : ∀ n, CofixA F n
   | 0 => CofixA.continue
   | succ n => CofixA.intro x.1 fun i => (x.2 i).approx n
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.approx.s_mk PFunctor.M.Approx.sMk
 
-protected theorem P_mk (x : F.Obj <| M F) : AllAgree (Approx.sMk x)
+protected theorem P_mk (x : F (M F)) : AllAgree (Approx.sMk x)
   | 0 => by constructor
   | succ n => by
     constructor
@@ -313,7 +313,7 @@ set_option linter.uppercaseLean3 false in
 end Approx
 
 /-- constructor for M-types -/
-protected def mk (x : F.Obj <| M F) : M F
+protected def mk (x : F (M F)) : M F
     where
   approx := Approx.sMk x
   consistent := Approx.P_mk x
@@ -330,7 +330,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.agree' PFunctor.M.Agree'
 
 @[simp]
-theorem dest_mk (x : F.Obj <| M F) : dest (M.mk x) = x := rfl
+theorem dest_mk (x : F (M F)) : dest (M.mk x) = x := rfl
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.dest_mk PFunctor.M.dest_mk
 
@@ -362,12 +362,12 @@ theorem mk_dest (x : M F) : M.mk (dest x) = x := by
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.mk_dest PFunctor.M.mk_dest
 
-theorem mk_inj {x y : F.Obj <| M F} (h : M.mk x = M.mk y) : x = y := by rw [← dest_mk x, h, dest_mk]
+theorem mk_inj {x y : F (M F)} (h : M.mk x = M.mk y) : x = y := by rw [← dest_mk x, h, dest_mk]
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.mk_inj PFunctor.M.mk_inj
 
 /-- destructor for M-types -/
-protected def cases {r : M F → Sort w} (f : ∀ x : F.Obj <| M F, r (M.mk x)) (x : M F) : r x :=
+protected def cases {r : M F → Sort w} (f : ∀ x : F (M F), r (M.mk x)) (x : M F) : r x :=
   suffices r (M.mk (dest x)) by
     rw [← mk_dest x]
     exact this
@@ -376,7 +376,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.cases PFunctor.M.cases
 
 /-- destructor for M-types -/
-protected def casesOn {r : M F → Sort w} (x : M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) : r x :=
+protected def casesOn {r : M F → Sort w} (x : M F) (f : ∀ x : F (M F), r (M.mk x)) : r x :=
   M.cases f x
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.cases_on PFunctor.M.casesOn
@@ -434,7 +434,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.agree_iff_agree' PFunctor.M.agree_iff_agree'
 
 @[simp]
-theorem cases_mk {r : M F → Sort*} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) :
+theorem cases_mk {r : M F → Sort*} (x : F (M F)) (f : ∀ x : F (M F), r (M.mk x)) :
     PFunctor.M.cases f (M.mk x) = f x := by
   dsimp only [M.mk, PFunctor.M.cases, dest, head, Approx.sMk, head']
   cases x; dsimp only [Approx.sMk]
@@ -445,7 +445,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.cases_mk PFunctor.M.cases_mk
 
 @[simp]
-theorem casesOn_mk {r : M F → Sort*} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) :
+theorem casesOn_mk {r : M F → Sort*} (x : F (M F)) (f : ∀ x : F (M F), r (M.mk x)) :
     PFunctor.M.casesOn (M.mk x) f = f x :=
   cases_mk x f
 set_option linter.uppercaseLean3 false in
@@ -531,7 +531,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.iselect_eq_default PFunctor.M.iselect_eq_default
 
 @[simp]
-theorem head_mk (x : F.Obj (M F)) : head (M.mk x) = x.1 :=
+theorem head_mk (x : F (M F)) : head (M.mk x) = x.1 :=
   Eq.symm <|
     calc
       x.1 = (dest (M.mk x)).1 := by rw [dest_mk]
@@ -546,7 +546,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.children_mk PFunctor.M.children_mk
 
 @[simp]
-theorem ichildren_mk [DecidableEq F.A] [Inhabited (M F)] (x : F.Obj (M F)) (i : F.Idx) :
+theorem ichildren_mk [DecidableEq F.A] [Inhabited (M F)] (x : F (M F)) (i : F.Idx) :
     ichildren i (M.mk x) = x.iget i := by
   dsimp only [ichildren, PFunctor.Obj.iget]
   congr with h
@@ -572,7 +572,7 @@ theorem iselect_cons [DecidableEq F.A] [Inhabited (M F)] (ps : Path F) {a} (f :
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.iselect_cons PFunctor.M.iselect_cons
 
-theorem corec_def {X} (f : X → F.Obj X) (x₀ : X) : M.corec f x₀ = M.mk (M.corec f <$> f x₀) := by
+theorem corec_def {X} (f : X → F X) (x₀ : X) : M.corec f x₀ = M.mk (M.corec f <$> f x₀) := by
   dsimp only [M.corec, M.mk]
   congr with n
   cases' n with n
@@ -710,14 +710,14 @@ end Bisim
 universe u' v'
 
 /-- corecursor for `M F` with swapped arguments -/
-def corecOn {X : Type*} (x₀ : X) (f : X → F.Obj X) : M F :=
+def corecOn {X : Type*} (x₀ : X) (f : X → F X) : M F :=
   M.corec f x₀
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.corec_on PFunctor.M.corecOn
 
 variable {P : PFunctor.{u}} {α : Type u}
 
-theorem dest_corec (g : α → P.Obj α) (x : α) : M.dest (M.corec g x) = M.corec g <$> g x := by
+theorem dest_corec (g : α → P α) (x : α) : M.dest (M.corec g x) = M.corec g <$> g x := by
   rw [corec_def, dest_mk]
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.dest_corec PFunctor.M.dest_corec
@@ -769,7 +769,7 @@ theorem bisim_equiv (R : M P → M P → Prop)
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.bisim_equiv PFunctor.M.bisim_equiv
 
-theorem corec_unique (g : α → P.Obj α) (f : α → M P) (hyp : ∀ x, M.dest (f x) = f <$> g x) :
+theorem corec_unique (g : α → P α) (f : α → M P) (hyp : ∀ x, M.dest (f x) = f <$> g x) :
     f = M.corec g := by
   ext x
   apply bisim' (fun _ => True) _ _ _ _ trivial
@@ -786,14 +786,14 @@ set_option linter.uppercaseLean3 false in
 
 /-- corecursor where the state of the computation can be sent downstream
 in the form of a recursive call -/
-def corec₁ {α : Type u} (F : ∀ X, (α → X) → α → P.Obj X) : α → M P :=
+def corec₁ {α : Type u} (F : ∀ X, (α → X) → α → P X) : α → M P :=
   M.corec (F _ id)
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.corec₁ PFunctor.M.corec₁
 
 /-- corecursor where it is possible to return a fully formed value at any point
 of the computation -/
-def corec' {α : Type u} (F : ∀ {X : Type u}, (α → X) → α → Sum (M P) (P.Obj X)) (x : α) : M P :=
+def corec' {α : Type u} (F : ∀ {X : Type u}, (α → X) → α → Sum (M P) (P X)) (x : α) : M P :=
   corec₁
     (fun _ rec (a : Sum (M P) α) =>
       let y := a >>= F (rec ∘ Sum.inr)
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
@@ -138,7 +138,7 @@ set_option linter.uppercaseLean3 false in
 
 /-- `Path F` provides indices to access internal nodes in `Corec F` -/
 def Path (F : PFunctor.{u}) :=
-  List F.IdxCat
+  List F.Idx
 #align pfunctor.approx.path PFunctor.Approx.Path
 
 instance Path.inhabited : Inhabited (Path F) :=
@@ -260,7 +260,7 @@ set_option linter.uppercaseLean3 false in
 
 /-- select a subtree using an `i : F.Idx` or return an arbitrary tree if
 `i` designates no subtree of `x` -/
-def ichildren [Inhabited (M F)] [DecidableEq F.A] (i : F.IdxCat) (x : M F) : M F :=
+def ichildren [Inhabited (M F)] [DecidableEq F.A] (i : F.Idx) (x : M F) : M F :=
   if H' : i.1 = head x then children x (cast (congr_arg _ <| by simp only [head, H']) i.2)
   else default
 set_option linter.uppercaseLean3 false in
@@ -546,7 +546,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.children_mk PFunctor.M.children_mk
 
 @[simp]
-theorem ichildren_mk [DecidableEq F.A] [Inhabited (M F)] (x : F.Obj (M F)) (i : F.IdxCat) :
+theorem ichildren_mk [DecidableEq F.A] [Inhabited (M F)] (x : F.Obj (M F)) (i : F.Idx) :
     ichildren i (M.mk x) = x.iget i := by
   dsimp only [ichildren, PFunctor.Obj.iget]
   congr with h
chore: exactly 4 spaces in theorems (#7328)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -453,7 +453,7 @@ set_option linter.uppercaseLean3 false in
 
 @[simp]
 theorem casesOn_mk' {r : M F → Sort*} {a} (x : F.B a → M F)
-                    (f : ∀ (a) (f : F.B a → M F), r (M.mk ⟨a, f⟩)) :
+    (f : ∀ (a) (f : F.B a → M F), r (M.mk ⟨a, f⟩)) :
     PFunctor.M.casesOn' (M.mk ⟨a, x⟩) f = f a x :=
   @cases_mk F r ⟨a, x⟩ (fun ⟨a, g⟩ => f a g)
 set_option linter.uppercaseLean3 false in
chore: simplify by rfl (#7039)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -330,7 +330,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.agree' PFunctor.M.Agree'
 
 @[simp]
-theorem dest_mk (x : F.Obj <| M F) : dest (M.mk x) = x := by rfl
+theorem dest_mk (x : F.Obj <| M F) : dest (M.mk x) = x := rfl
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.dest_mk PFunctor.M.dest_mk
 
@@ -535,7 +535,7 @@ theorem head_mk (x : F.Obj (M F)) : head (M.mk x) = x.1 :=
   Eq.symm <|
     calc
       x.1 = (dest (M.mk x)).1 := by rw [dest_mk]
-      _ = head (M.mk x) := by rfl
+      _ = head (M.mk x) := rfl
 
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.head_mk PFunctor.M.head_mk
@@ -562,7 +562,7 @@ set_option linter.uppercaseLean3 false in
 
 @[simp]
 theorem iselect_nil [DecidableEq F.A] [Inhabited (M F)] {a} (f : F.B a → M F) :
-    iselect nil (M.mk ⟨a, f⟩) = a := by rfl
+    iselect nil (M.mk ⟨a, f⟩) = a := rfl
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.iselect_nil PFunctor.M.iselect_nil
 
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
@@ -223,7 +223,7 @@ theorem ext' (x y : M F) (H : ∀ i : ℕ, x.approx i = y.approx i) : x = y := b
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.ext' PFunctor.M.ext'
 
-variable {X : Type _}
+variable {X : Type*}
 
 variable (f : X → F.Obj X)
 
@@ -434,7 +434,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.agree_iff_agree' PFunctor.M.agree_iff_agree'
 
 @[simp]
-theorem cases_mk {r : M F → Sort _} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) :
+theorem cases_mk {r : M F → Sort*} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) :
     PFunctor.M.cases f (M.mk x) = f x := by
   dsimp only [M.mk, PFunctor.M.cases, dest, head, Approx.sMk, head']
   cases x; dsimp only [Approx.sMk]
@@ -445,14 +445,14 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.cases_mk PFunctor.M.cases_mk
 
 @[simp]
-theorem casesOn_mk {r : M F → Sort _} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) :
+theorem casesOn_mk {r : M F → Sort*} (x : F.Obj <| M F) (f : ∀ x : F.Obj <| M F, r (M.mk x)) :
     PFunctor.M.casesOn (M.mk x) f = f x :=
   cases_mk x f
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.cases_on_mk PFunctor.M.casesOn_mk
 
 @[simp]
-theorem casesOn_mk' {r : M F → Sort _} {a} (x : F.B a → M F)
+theorem casesOn_mk' {r : M F → Sort*} {a} (x : F.B a → M F)
                     (f : ∀ (a) (f : F.B a → M F), r (M.mk ⟨a, f⟩)) :
     PFunctor.M.casesOn' (M.mk ⟨a, x⟩) f = f a x :=
   @cases_mk F r ⟨a, x⟩ (fun ⟨a, g⟩ => f a g)
@@ -710,7 +710,7 @@ end Bisim
 universe u' v'
 
 /-- corecursor for `M F` with swapped arguments -/
-def corecOn {X : Type _} (x₀ : X) (f : X → F.Obj X) : M F :=
+def corecOn {X : Type*} (x₀ : X) (f : X → F.Obj X) : M F :=
   M.corec f x₀
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.corec_on PFunctor.M.corecOn
@@ -740,7 +740,7 @@ theorem bisim (R : M P → M P → Prop)
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.bisim PFunctor.M.bisim
 
-theorem bisim' {α : Type _} (Q : α → Prop) (u v : α → M P)
+theorem bisim' {α : Type*} (Q : α → Prop) (u v : α → M P)
     (h : ∀ x, Q x → ∃ a f f',
           M.dest (u x) = ⟨a, f⟩
           ∧ M.dest (v x) = ⟨a, f'⟩
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) 2017 Simon Hudon All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Simon Hudon
-
-! This file was ported from Lean 3 source module data.pfunctor.univariate.M
-! 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.PFunctor.Univariate.Basic
 
+#align_import data.pfunctor.univariate.M from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
+
 /-!
 # M-types
 
chore: clean up spacing around at and goals (#5387)

Changes are of the form

  • some_tactic at h⊢ -> some_tactic at h ⊢
  • some_tactic at h -> some_tactic at h
Diff
@@ -520,7 +520,7 @@ theorem iselect_eq_default [DecidableEq F.A] [Inhabited (M F)] (ps : Path F) (x
     constructor
   · cases' ps_hd with a i
     induction' x using PFunctor.M.casesOn' with x_a x_f
-    simp only [iselect, isubtree] at ps_ih⊢
+    simp only [iselect, isubtree] at ps_ih ⊢
     by_cases h'' : a = x_a
     subst x_a
     · simp only [dif_pos, eq_self_iff_true, casesOn_mk']
@@ -682,11 +682,11 @@ theorem nth_of_bisim [Inhabited (M F)] (bisim : IsBisimulation R) (s₁ s₂) (p
     apply bisim.tail h₀
   cases' i with a' i
   obtain rfl : a = a' := by rcases hh with hh|hh <;> cases isPath_cons hh <;> rfl
-  dsimp only [iselect] at ps_ih⊢
+  dsimp only [iselect] at ps_ih ⊢
   have h₁ := bisim.tail h₀ i
   induction' h : f i using PFunctor.M.casesOn' with a₀ f₀
   induction' h' : f' i using PFunctor.M.casesOn' with a₁ f₁
-  simp only [h, h', isubtree_cons] at ps_ih⊢
+  simp only [h, h', isubtree_cons] at ps_ih ⊢
   rw [h, h'] at h₁
   obtain rfl : a₀ = a₁ := bisim.head h₁
   apply ps_ih _ _ _ h₁
chore: fix grammar 2/3 (#5002)

Part 2 of #5001

Diff
@@ -261,7 +261,7 @@ def children (x : M F) (i : F.B (head x)) : M F :=
 set_option linter.uppercaseLean3 false in
 #align pfunctor.M.children PFunctor.M.children
 
-/-- select a subtree using a `i : F.Idx` or return an arbitrary tree if
+/-- select a subtree using an `i : F.Idx` or return an arbitrary tree if
 `i` designates no subtree of `x` -/
 def ichildren [Inhabited (M F)] [DecidableEq F.A] (i : F.IdxCat) (x : M F) : M F :=
   if H' : i.1 = head x then children x (cast (congr_arg _ <| by simp only [head, H']) i.2)
chore: fix many typos (#4983)

These are all doc fixes

Diff
@@ -324,7 +324,7 @@ set_option linter.uppercaseLean3 false in
 #align pfunctor.M.mk PFunctor.M.mk
 
 /-- `Agree' n` relates two trees of type `M F` that
-are the same up to dept `n` -/
+are the same up to depth `n` -/
 inductive Agree' : ℕ → M F → M F → Prop
   | trivial (x y : M F) : Agree' 0 x y
   | step {n : ℕ} {a} (x y : F.B a → M F) {x' y'} :
chore: formatting issues (#4947)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -667,7 +667,7 @@ theorem nth_of_bisim [Inhabited (M F)] (bisim : IsBisimulation R) (s₁ s₂) (p
     (R s₁ s₂) →
       IsPath ps s₁ ∨ IsPath ps s₂ →
         iselect ps s₁ = iselect ps s₂ ∧
-          ∃ (a : _)(f f' : F.B a → M F),
+          ∃ (a : _) (f f' : F.B a → M F),
             isubtree ps s₁ = M.mk ⟨a, f⟩ ∧
               isubtree ps s₂ = M.mk ⟨a, f'⟩ ∧ ∀ i : F.B a, f i ~ f' i := by
   intro h₀ hh
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
@@ -346,8 +346,7 @@ theorem mk_dest (x : M F) : M.mk (dest x) = x := by
   · apply @Subsingleton.elim _ CofixA.instSubsingleton
   dsimp only [Approx.sMk, dest, head]
   cases' h : x.approx (succ n) with _ hd ch
-  have h' : hd = head' (x.approx 1) :=
-    by
+  have h' : hd = head' (x.approx 1) := by
     rw [← head_succ' n, h, head']
     apply x.consistent
   revert ch
Refactor uses to rename_i that have easy fixes (#2429)
Diff
@@ -400,8 +400,8 @@ set_option linter.uppercaseLean3 false in
 
 @[simp]
 theorem agree'_refl {n : ℕ} (x : M F) : Agree' n x x := by
-  induction n generalizing x <;> induction x using PFunctor.M.casesOn' <;> constructor <;> try rfl
-  rename_i n_ih _ _
+  induction' n with _ n_ih generalizing x <;>
+  induction x using PFunctor.M.casesOn' <;> constructor <;> try rfl
   intros
   apply n_ih
 set_option linter.uppercaseLean3 false in
@@ -422,8 +422,7 @@ theorem agree_iff_agree' {n : ℕ} (x y : M F) :
       apply hagree
   · induction' n with _ n_ih generalizing x y
     constructor
-    · cases h
-      rename_i a x' y' _ _ _
+    · cases' h with _ _ _ a x' y'
       induction' x using PFunctor.M.casesOn' with x_a x_f
       induction' y using PFunctor.M.casesOn' with y_a y_f
       simp only [approx_mk]
chore: tidy various files (#2446)
Diff
@@ -109,7 +109,7 @@ theorem truncate_eq_of_agree {n : ℕ} (x : CofixA F n) (y : CofixA F (succ n))
     cases h
     simp only [truncate, Function.comp, true_and_iff, eq_self_iff_true, heq_iff_eq]
     -- porting note: used to be `ext y`
-    rename_i n_ih a f y h₁;
+    rename_i n_ih a f y h₁
     suffices (fun x => truncate (y x)) = f
       by simp [this]; try (exact HEq.rfl;)
     funext y
feat: port Data.Pfunctor.Univariate.M (#1834)

Dependencies 6 + 212

213 files ported (97.3%)
94353 lines ported (97.8%)
Show graph

The unported dependencies are