Skip to content

Commit 75b060c

Browse files
committed
chore: fix implicit-reducible diamonds in Primrec (#38305)
The following examples fail on master, work with the PR: ```lean example : (Primcodable.ulower.toEncodable : Encodable (ULower α)) = instEncodableULower := by with_reducible_and_instances rfl ``` ```lean example : (Primcodable.vector.toEncodable : Encodable (List.Vector α n)) = Encodable.List.Vector.encodable := by with_reducible_and_instances rfl ``` Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr>
1 parent 98261a9 commit 75b060c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Mathlib/Computability/Primrec/Basic.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ theorem mem_range_encode : PrimrecPred (fun n => n ∈ Set.range (encode : α
843843
this.of_eq fun _ => decode₂_ne_none_iff
844844

845845
instance ulower : Primcodable (ULower α) :=
846-
Primcodable.subtype mem_range_encode
846+
fast_instance% Primcodable.subtype mem_range_encode
847847

848848
end ULower
849849

@@ -886,11 +886,11 @@ theorem option_get {f : α → Option β} {h : ∀ a, (f a).isSome} :
886886

887887
theorem ulower_down : Primrec (ULower.down : α → ULower α) :=
888888
letI : ∀ a, Decidable (a ∈ Set.range (encode : α → ℕ)) := decidableRangeEncode _
889-
subtype_mk .encode
889+
subtype_mk .encode (hp := Primcodable.mem_range_encode)
890890

891891
theorem ulower_up : Primrec (ULower.up : ULower α → α) :=
892892
letI : ∀ a, Decidable (a ∈ Set.range (encode : α → ℕ)) := decidableRangeEncode _
893-
option_get (Primrec.decode₂.comp subtype_val)
893+
option_get (Primrec.decode₂.comp (subtype_val (hp := Primcodable.mem_range_encode)))
894894

895895
theorem fin_val_iff {n} {f : α → Fin n} : (Primrec fun a => (f a).1) ↔ Primrec f := by
896896
letI : Primcodable { a // a < n } := Primcodable.subtype (nat_lt.comp .id (const _))

Mathlib/Computability/Primrec/List.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ variable {α : Type*} [Primcodable α]
516516
open Primrec
517517

518518
instance vector {n} : Primcodable (List.Vector α n) :=
519-
subtype ((@Primrec.eq ℕ _).comp list_length (const _))
519+
fast_instance% subtype ((@Primrec.eq ℕ _).comp list_length (const _))
520520

521521
instance finArrow {n} : Primcodable (Fin n → α) :=
522522
ofEquiv _ (Equiv.vectorEquivFin _ _).symm
@@ -529,11 +529,11 @@ variable {α : Type*} {β : Type*} {σ : Type*}
529529
variable [Primcodable α] [Primcodable β] [Primcodable σ]
530530

531531
theorem vector_toList {n} : Primrec (@List.Vector.toList α n) :=
532-
subtype_val
532+
subtype_val (hp := (@Primrec.eq ℕ _).comp list_length (const _))
533533

534534
theorem vector_toList_iff {n} {f : α → List.Vector β n} :
535535
(Primrec fun a => (f a).toList) ↔ Primrec f :=
536-
subtype_val_iff
536+
subtype_val_iff (hp := (@Primrec.eq ℕ _).comp list_length (const _))
537537

538538
theorem vector_cons {n} : Primrec₂ (@List.Vector.cons α n) :=
539539
vector_toList_iff.1 <| by simpa using list_cons.comp fst (vector_toList_iff.2 snd)

0 commit comments

Comments
 (0)