Skip to content

Commit 7f94f89

Browse files
committed
fix(proofs): fix all remaining idris2 + Agda scope errors
ProverKindInjectivity.idr: - Replace all 107 LTESucc towers with lteLit calls (eliminates off-by-one bug class permanently; Nunchaku was -1 close and Faial was +1) - Add `import NatLte` for the machine-checked LTE helper - Fix docstring range [0, 104] -> [0, 106] to match actual max discriminant DispatchCorrectness.idr: - Remove `import EchidnaABI.Provers` (pulls in a conflicting `proverLogic` from InteractiveAssistants; file only needs EchidnaABI.Types) - Allows file to type-check with the echidnaabi package installed proofs/agda/Basic.agda: - Hoist `data ℕ` and `data _≡_` to module scope (were only in `where` blocks, causing scope errors when used in type signatures) - Remove duplicate `data _≡_` from CombinatorLaws/CurryUncurryLaws (they now inherit from module scope) - Instantiate SKK's second const with {B = A} to resolve unsolved meta All 11 verification/proofs/idris2/ files now pass `idris2 --check`. 12/13 proofs/agda/ files pass (DispatchOrdering needs stdlib 2.1). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6c01819 commit 7f94f89

3 files changed

Lines changed: 122 additions & 136 deletions

File tree

proofs/agda/Basic.agda

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@
88

99
module Basic where
1010

11+
-- Propositional equality at module scope (used by trans-assoc, id-left, id-right)
12+
data _≡_ {A : Set} (x : A) : A Set where
13+
refl : x ≡ x
14+
15+
infix 4 _≡_
16+
17+
-- Natural numbers at module scope (used by id-nat)
18+
data : Set where
19+
zero :
20+
suc :
21+
1122
--------------------------------------------------------------------------------
1223
-- Identity Proof
1324
--------------------------------------------------------------------------------
@@ -21,10 +32,6 @@ id x = x
2132
-- Example: identity for a specific type
2233
id-nat : (n : ℕ)
2334
id-nat = id
24-
where
25-
data ℕ : Set where
26-
zero :
27-
suc :
2835

2936
-- The identity function can also be written explicitly with a lambda
3037
id′ : {A : Set} A A
@@ -75,28 +82,14 @@ trans-assoc : {A B C D : Set}
7582
(f : A B) (g : B C) (h : C D)
7683
(h ∘ (g ∘ f)) ≡ ((h ∘ g) ∘ f)
7784
trans-assoc f g h = refl
78-
where
79-
-- Propositional equality
80-
data _≡_ {A : Set} (x : A) : A Set where
81-
refl : x ≡ x
82-
83-
infix 4 _≡_
8485

8586
-- Proof that identity is a left identity for composition
8687
id-left : {A B : Set} (f : A B) (id ∘ f) ≡ f
8788
id-left f = refl
88-
where
89-
data _≡_ {A : Set} (x : A) : A Set where
90-
refl : x ≡ x
91-
infix 4 _≡_
9289

9390
-- Proof that identity is a right identity for composition
9491
id-right : {A B : Set} (f : A B) (f ∘ id) ≡ f
9592
id-right f = refl
96-
where
97-
data _≡_ {A : Set} (x : A) : A Set where
98-
refl : x ≡ x
99-
infix 4 _≡_
10093

10194
--------------------------------------------------------------------------------
10295
-- Additional Basic Combinators
@@ -125,13 +118,9 @@ infixr 0 _$_
125118
--------------------------------------------------------------------------------
126119

127120
module CombinatorLaws where
128-
data _≡_ {A : Set} (x : A) : A Set where
129-
refl : x ≡ x
130-
131-
infix 4 _≡_
132-
133121
-- SKK = I (a famous combinator identity)
134-
SKK : {A : Set} (x : A) S const const x ≡ id x
122+
-- The second const needs B instantiated explicitly to resolve the implicit argument.
123+
SKK : {A : Set} (x : A) S const (const {B = A}) x ≡ id x
135124
SKK x = refl
136125

137126
-- Flip is involutive (applying it twice gets you back where you started)
@@ -164,9 +153,6 @@ uncurry f (x , y) = f x y
164153

165154
-- Proof that curry and uncurry are inverses
166155
module CurryUncurryLaws where
167-
data _≡_ {A : Set} (x : A) : A Set where
168-
refl : x ≡ x
169-
170156
-- INTENTIONAL AXIOM: Function extensionality (funext)
171157
-- Justification: funext is consistent with Agda's type theory and is
172158
-- provable in Cubical Agda (--cubical). In plain Agda it must be

verification/proofs/idris2/DispatchCorrectness.idr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
module DispatchCorrectness
1313

1414
import EchidnaABI.Types
15-
import EchidnaABI.Provers
1615

1716
%default total
1817

0 commit comments

Comments
 (0)