@@ -453,7 +453,6 @@ theorem liftRel_destruct_iff {R : α → β → Prop} {s : WSeq α} {t : WSeq β
453
453
intro s t
454
454
apply Or.inl⟩⟩
455
455
456
- -- Porting note: To avoid ambiguous notation, `~` became `~ʷ`.
457
456
@[inherit_doc] infixl :50 " ~ʷ " => Equiv
458
457
459
458
theorem destruct_congr {s t : WSeq α} :
@@ -851,10 +850,7 @@ theorem mem_of_mem_dropn {s : WSeq α} {a} : ∀ {n}, a ∈ drop s n → a ∈ s
851
850
852
851
theorem get?_mem {s : WSeq α} {a n} : some a ∈ get? s n → a ∈ s := by
853
852
revert s; induction' n with n IH <;> intro s h
854
- · -- Porting note: This line is required to infer metavariables in
855
- -- `Computation.exists_of_mem_map`.
856
- dsimp only [get?, head] at h
857
- rcases Computation.exists_of_mem_map h with ⟨o, h1, h2⟩
853
+ · rcases Computation.exists_of_mem_map h with ⟨o, h1, h2⟩
858
854
rcases o with - | o
859
855
· injection h2
860
856
injection h2 with h'
@@ -904,17 +900,12 @@ theorem liftRel_dropn_destruct {R : α → β → Prop} {s t} (H : LiftRel R s t
904
900
· apply liftRel_dropn_destruct H n
905
901
exact fun {a b} o =>
906
902
match a, b, o with
907
- | none, none, _ => by
908
- -- Porting note: These 2 theorems should be excluded.
909
- simp [-liftRel_pure_left, -liftRel_pure_right]
903
+ | none, none, _ => by simp
910
904
| some (a, s), some (b, t), ⟨_, h2⟩ => by simpa [tail.aux] using liftRel_destruct h2
911
905
912
906
theorem exists_of_liftRel_left {R : α → β → Prop } {s t} (H : LiftRel R s t) {a} (h : a ∈ s) :
913
907
∃ b, b ∈ t ∧ R a b := by
914
908
let ⟨n, h⟩ := exists_get?_of_mem h
915
- -- Porting note: This line is required to infer metavariables in
916
- -- `Computation.exists_of_mem_map`.
917
- dsimp only [get?, head] at h
918
909
let ⟨some (_, s'), sd, rfl⟩ := Computation.exists_of_mem_map h
919
910
let ⟨some (b, t'), td, ⟨ab, _⟩⟩ := (liftRel_dropn_destruct H n).left sd
920
911
exact ⟨b, get?_mem (Computation.mem_map (Prod.fst.{v, v} <$> ·) td), ab⟩
@@ -942,16 +933,12 @@ theorem exists_of_mem_map {f} {b : β} : ∀ {s : WSeq α}, b ∈ map f s →
942
933
943
934
@[simp]
944
935
theorem liftRel_nil (R : α → β → Prop ) : LiftRel R nil nil := by
945
- rw [liftRel_destruct_iff]
946
- -- Porting note: These 2 theorems should be excluded.
947
- simp [-liftRel_pure_left, -liftRel_pure_right]
936
+ simp [liftRel_destruct_iff]
948
937
949
938
@[simp]
950
939
theorem liftRel_cons (R : α → β → Prop ) (a b s t) :
951
940
LiftRel R (cons a s) (cons b t) ↔ R a b ∧ LiftRel R s t := by
952
- rw [liftRel_destruct_iff]
953
- -- Porting note: These 2 theorems should be excluded.
954
- simp [-liftRel_pure_left, -liftRel_pure_right]
941
+ simp [liftRel_destruct_iff]
955
942
956
943
@[simp]
957
944
theorem liftRel_think_left (R : α → β → Prop ) (s t) : LiftRel R (think s) t ↔ LiftRel R s t := by
@@ -1005,9 +992,7 @@ theorem liftRel_flatten {R : α → β → Prop} {c1 : Computation (WSeq α)} {c
1005
992
simp only [destruct_flatten]; apply liftRel_bind _ _ h
1006
993
intro a b ab; apply Computation.LiftRel.imp _ _ _ (liftRel_destruct ab)
1007
994
intro a b; apply LiftRelO.imp_right
1008
- intro s t h; refine ⟨Computation.pure s, Computation.pure t, ?_, ?_, ?_⟩ <;>
1009
- -- Porting note: These 2 theorems should be excluded.
1010
- simp [h, -liftRel_pure_left, -liftRel_pure_right]⟩
995
+ intro s t h; refine ⟨Computation.pure s, Computation.pure t, ?_, ?_, ?_⟩ <;> simp [h]⟩
1011
996
1012
997
theorem flatten_congr {c1 c2 : Computation (WSeq α)} :
1013
998
Computation.LiftRel Equiv c1 c2 → flatten c1 ~ʷ flatten c2 :=
@@ -1273,12 +1258,8 @@ theorem exists_of_mem_join {a : α} : ∀ {S : WSeq (WSeq α)}, a ∈ join S →
1273
1258
intro ej m <;> simp at ej <;> have := congr_arg Seq.destruct ej <;> simp at this <;>
1274
1259
subst ss
1275
1260
· apply Or.inr
1276
- -- Porting note: `exists_eq_or_imp` should be excluded.
1277
- simp [-exists_eq_or_imp] at m ⊢
1278
- rcases IH s S rfl m with as | ex
1279
- · exact ⟨s, Or.inl rfl, as⟩
1280
- · rcases ex with ⟨s', sS, as⟩
1281
- exact ⟨s', Or.inr sS, as⟩
1261
+ simp only [join_cons, nil_append, mem_think, mem_cons_iff, exists_eq_or_imp] at m ⊢
1262
+ exact IH s S rfl m
1282
1263
· apply Or.inr
1283
1264
simp? at m says simp only [join_think, nil_append, mem_think] at m
1284
1265
rcases (IH nil S (by simp) (by simp [m])).resolve_left (not_mem_nil _) with ⟨s, sS, as⟩
@@ -1390,8 +1371,7 @@ theorem liftRel_append (R : α → β → Prop) {s1 s2 : WSeq α} {t1 t2 : WSeq
1390
1371
· cases a; cases h
1391
1372
· obtain ⟨a, s⟩ := a; obtain ⟨b, t⟩ := b
1392
1373
obtain ⟨r, h⟩ := h
1393
- -- Porting note: These 2 theorems should be excluded.
1394
- simpa [-liftRel_pure_left, -liftRel_pure_right] using ⟨r, Or.inr ⟨s, rfl, t, rfl, h⟩⟩⟩
1374
+ simpa using ⟨r, Or.inr ⟨s, rfl, t, rfl, h⟩⟩⟩
1395
1375
1396
1376
theorem liftRel_join.lem (R : α → β → Prop ) {S T} {U : WSeq α → WSeq β → Prop }
1397
1377
(ST : LiftRel (LiftRel R) S T)
@@ -1455,8 +1435,7 @@ theorem liftRel_join (R : α → β → Prop) {S : WSeq (WSeq α)} {T : WSeq (WS
1455
1435
exact fun {o p} h =>
1456
1436
match o, p, h with
1457
1437
| some (a, s), some (b, t), ⟨h1, h2⟩ => by
1458
- -- Porting note: These 2 theorems should be excluded.
1459
- simpa [-liftRel_pure_left, -liftRel_pure_right] using ⟨h1, s, t, S, rfl, T, rfl, h2, ST⟩
1438
+ simpa using ⟨h1, s, t, S, rfl, T, rfl, h2, ST⟩
1460
1439
| none, none, _ => by
1461
1440
-- Porting note: `LiftRelO` should be excluded.
1462
1441
dsimp [destruct_append.aux, Computation.LiftRel, -LiftRelO]; constructor
@@ -1495,13 +1474,10 @@ theorem join_map_ret (s : WSeq α) : join (map ret s) ~ʷ s := by
1495
1474
match c1, c2, h with
1496
1475
| _, _, ⟨s, rfl, rfl⟩ => by
1497
1476
clear h
1498
- -- Porting note: `ret` is simplified in `simp` so `ret`s become `fun a => cons a nil` here.
1499
- have : ∀ s, ∃ s' : WSeq α,
1500
- (map (fun a => cons a nil) s).join.destruct =
1501
- (map (fun a => cons a nil) s').join.destruct ∧ destruct s = s'.destruct :=
1502
- fun s => ⟨s, rfl, rfl⟩
1503
- induction' s using WSeq.recOn with a s s <;>
1504
- simp (config := { unfoldPartialApp := true }) [ret, ret_mem, this, Option.exists]
1477
+ have (s) : ∃ s' : WSeq α,
1478
+ (map ret s).join.destruct = (map ret s').join.destruct ∧ destruct s = s'.destruct :=
1479
+ ⟨s, rfl, rfl⟩
1480
+ induction' s using WSeq.recOn with a s s <;> simp [ret, ret_mem, this, Option.exists]
1505
1481
· exact ⟨s, rfl, rfl⟩
1506
1482
1507
1483
@[simp]
@@ -1619,4 +1595,4 @@ end WSeq
1619
1595
1620
1596
end Stream'
1621
1597
1622
- set_option linter.style.longFile 1800
1598
+ set_option linter.style.longFile 1700
0 commit comments