-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: assume function application arguments occurring in local simp t…
- Loading branch information
1 parent
ca94124
commit 90b5a00
Showing
6 changed files
with
87 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
example {α β : Type} {f : α × β → β → β} (h : ∀ p : α × β, f p p.2 = p.2) | ||
(a : α) (b : β) : f (a, b) b = b := by | ||
simp [h] -- should not fail | ||
|
||
example {α β : Type} {f : α × β → β → β} | ||
(a : α) (b : β) (h : f (a,b) (a,b).2 = (a,b).2) : f (a, b) b = b := by | ||
simp [h] -- should not fail | ||
|
||
def enumFromTR' (n : Nat) (l : List α) : List (Nat × α) := | ||
let arr := l.toArray | ||
(arr.foldr (fun a (n, acc) => (n-1, (n-1, a) :: acc)) (n + arr.size, [])).2 | ||
|
||
open List in | ||
theorem enumFrom_eq_enumFromTR' : @enumFrom = @enumFromTR' := by | ||
funext α n l; simp [enumFromTR', -Array.size_toArray] | ||
let f := fun (a : α) (n, acc) => (n-1, (n-1, a) :: acc) | ||
let rec go : ∀ l n, l.foldr f (n + l.length, []) = (n, enumFrom n l) | ||
| [], n => rfl | ||
| a::as, n => by | ||
rw [← show _ + as.length = n + (a::as).length from Nat.succ_add .., List.foldr, go as] | ||
simp [enumFrom, f] | ||
rw [Array.foldr_eq_foldr_data] | ||
simp [go] -- Should close the goal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters