Skip to content

Commit 1c854a2

Browse files
Trigger CI for leanprover/lean4#5542
2 parents 4c37745 + bbc45dd commit 1c854a2

19 files changed

+1156
-1236
lines changed

Diff for: .github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ jobs:
4141
exit 1
4242
fi
4343
44-
# - name: Check for long lines
45-
# if: always()
46-
# run: |
47-
# ! (find Batteries -name "*.lean" -type f -exec grep -E -H -n '^.{101,}$' {} \; | grep -v -E 'https?://')
44+
- name: Check for long lines
45+
if: always()
46+
run: |
47+
! (find Batteries -name "*.lean" -type f -exec grep -E -H -n '^.{101,}$' {} \; | grep -v -E 'https?://')
4848
4949
- name: Check for trailing whitespace
5050
if: always()

Diff for: .github/workflows/test_mathlib.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
sourceRunId: ${{ github.event.workflow_run.id }}
2121

2222
- name: Checkout mathlib4 repository
23-
if: steps.workflow-info.outputs.pullRequestNumber != ''
23+
if: steps.workflow-info.outputs.pullRequestNumber != '' && steps.workflow-info.outputs.targetBranch == 'main'
2424
uses: actions/checkout@v4
2525
with:
2626
repository: leanprover-community/mathlib4
@@ -29,14 +29,15 @@ jobs:
2929
fetch-depth: 0
3030

3131
- name: install elan
32+
if: steps.workflow-info.outputs.pullRequestNumber != '' && steps.workflow-info.outputs.targetBranch == 'main'
3233
run: |
3334
set -o pipefail
3435
curl -sSfL https://github.com/leanprover/elan/releases/download/v3.0.0/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
3536
./elan-init -y --default-toolchain none
3637
echo "$HOME/.elan/bin" >> "${GITHUB_PATH}"
3738
3839
- name: Retrieve PR information
39-
if: steps.workflow-info.outputs.pullRequestNumber != ''
40+
if: steps.workflow-info.outputs.pullRequestNumber != '' && steps.workflow-info.outputs.targetBranch == 'main'
4041
id: pr-info
4142
uses: actions/github-script@v6
4243
env:
@@ -53,7 +54,7 @@ jobs:
5354
core.exportVariable('HEAD_BRANCH', pr.head.ref);
5455
5556
- name: Check if tag exists
56-
if: steps.workflow-info.outputs.pullRequestNumber != ''
57+
if: steps.workflow-info.outputs.pullRequestNumber != '' && steps.workflow-info.outputs.targetBranch == 'main'
5758
id: check_mathlib_tag
5859
env:
5960
PR_NUMBER: ${{ steps.workflow-info.outputs.pullRequestNumber }}
@@ -90,7 +91,7 @@ jobs:
9091
fi
9192
9293
- name: Push changes
93-
if: steps.workflow-info.outputs.pullRequestNumber != ''
94+
if: steps.workflow-info.outputs.pullRequestNumber != '' && steps.workflow-info.outputs.targetBranch == 'main'
9495
env:
9596
PR_NUMBER: ${{ steps.workflow-info.outputs.pullRequestNumber }}
9697
run: |

Diff for: Batteries.lean

-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ import Batteries.Lean.HashMap
4545
import Batteries.Lean.HashSet
4646
import Batteries.Lean.IO.Process
4747
import Batteries.Lean.Json
48-
import Batteries.Lean.Meta.AssertHypotheses
4948
import Batteries.Lean.Meta.Basic
50-
import Batteries.Lean.Meta.Clear
5149
import Batteries.Lean.Meta.DiscrTree
5250
import Batteries.Lean.Meta.Expr
5351
import Batteries.Lean.Meta.Inaccessible

Diff for: Batteries/Classes/SatisfiesM.lean

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected theorem trivial [Applicative m] [LawfulApplicative m] {x : m α} :
5252
/-- The `SatisfiesM p x` predicate is monotonic in `p`. -/
5353
theorem imp [Functor m] [LawfulFunctor m] {x : m α}
5454
(h : SatisfiesM p x) (H : ∀ {a}, p a → q a) : SatisfiesM q x :=
55-
let ⟨x, h⟩ := h; ⟨(funa, h⟩ => ⟨_, H h⟩) <$> x, by rw [← h, ← comp_map]; rfl⟩
55+
let ⟨x, h⟩ := h; ⟨(fun_, h⟩ => ⟨_, H h⟩) <$> x, by rw [← h, ← comp_map]; rfl⟩
5656

5757
/-- `SatisfiesM` distributes over `<$>`, general version. -/
5858
protected theorem map [Functor m] [LawfulFunctor m] {x : m α}

Diff for: Batteries/Data/Array/Basic.lean

+5-5
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ should prove the index bound.
141141
A proof by `get_elem_tactic` is provided as a default argument for `h`.
142142
This will perform the update destructively provided that `a` has a reference count of 1 when called.
143143
-/
144-
def setN (a : Array α) (i : Nat) (h : i < a.size := by get_elem_tactic) (x : α) : Array α :=
144+
abbrev setN (a : Array α) (i : Nat) (x : α) (h : i < a.size := by get_elem_tactic) : Array α :=
145145
a.set ⟨i, h⟩ x
146146

147147
/--
@@ -150,7 +150,7 @@ Uses `get_elem_tactic` to supply a proof that the indices are in range.
150150
`hi` and `hj` are both given a default argument `by get_elem_tactic`.
151151
This will perform the update destructively provided that `a` has a reference count of 1 when called.
152152
-/
153-
def swapN (a : Array α) (i j : Nat)
153+
abbrev swapN (a : Array α) (i j : Nat)
154154
(hi : i < a.size := by get_elem_tactic) (hj : j < a.size := by get_elem_tactic) : Array α :=
155155
Array.swap a ⟨i,hi⟩ ⟨j, hj⟩
156156

@@ -159,8 +159,8 @@ def swapN (a : Array α) (i j : Nat)
159159
The old entry is returned alongwith the modified vector.
160160
Automatically generates proof of `i < a.size` with `get_elem_tactic` where feasible.
161161
-/
162-
def swapAtN (a : Array α) (i : Nat) (h : i < a.size := by get_elem_tactic) (x : α) : α × Array α :=
163-
swapAt a ⟨i,h⟩ x
162+
abbrev swapAtN (a : Array α) (i : Nat) (x : α) (h : i < a.size := by get_elem_tactic) :
163+
α × Array α := swapAt a ⟨i,h⟩ x
164164

165165
/--
166166
`eraseIdxN a i h` Removes the element at position `i` from a vector of length `n`.
@@ -169,7 +169,7 @@ that the index is valid.
169169
This function takes worst case O(n) time because it has to backshift all elements at positions
170170
greater than i.
171171
-/
172-
def eraseIdxN (a : Array α) (i : Nat) (h : i < a.size := by get_elem_tactic) : Array α :=
172+
abbrev eraseIdxN (a : Array α) (i : Nat) (h : i < a.size := by get_elem_tactic) : Array α :=
173173
a.feraseIdx ⟨i, h⟩
174174

175175
end Array

Diff for: Batteries/Data/Array/Merge.lean

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ set_option linter.unusedVariables false in
3131
def mergeSortedPreservingDuplicates [ord : Ord α] (xs ys : Array α) : Array α :=
3232
merge (compare · · |>.isLT) xs ys
3333

34+
-- We name `ord` so it can be provided as a named argument.
35+
set_option linter.unusedVariables.funArgs false in
3436
/--
3537
`O(|xs| + |ys|)`. Merge arrays `xs` and `ys`, which must be sorted according to `compare` and must
3638
not contain duplicates. Equal elements are merged using `merge`. If `merge` respects the order
@@ -85,6 +87,8 @@ where
8587

8688
@[deprecated (since := "2024-04-24")] alias mergeUnsortedDeduplicating := mergeUnsortedDedup
8789

90+
-- We name `eq` so it can be provided as a named argument.
91+
set_option linter.unusedVariables.funArgs false in
8892
/--
8993
`O(|xs|)`. Replace each run `[x₁, ⋯, xₙ]` of equal elements in `xs` with
9094
`f ⋯ (f (f x₁ x₂) x₃) ⋯ xₙ`.

0 commit comments

Comments
 (0)