Skip to content

Commit c13f307

Browse files
hyperpolymathclaude
andcommitted
agda(truncation): generic echo-not-prop + corollaries (set-1 Q2.1)
New module proofs/agda/EchoTruncation.agda. Generalises the pointwise distinctness proofs scattered across the example modules into a single theorem: echo-not-prop : (f : A → B) (x1 x2 : A) (p1 : f x1 ≡ y) (p2 : f x2 ≡ y) → x1 ≢ x2 → ¬ isProp (Echo f y) plus the underlying one-liner echo-witnesses-distinct (factoring out the cong-proj₁ step) and the witness-form preimages⇒distinct-echoes returning two distinct echoes. Recovers the existing pointwise lemmas as corollaries, one per non-injective example f: * CollapseExample.echo-true≢echo-false (collapse : Bool → ⊤, EchoCharacteristic) * Square9Example.echo-plus3≢echo-minus3 (square9 : SignedNine → ℕ, EchoExamples) * TropicalExample.echo-a≢echo-b (score : Candidate → ℕ, EchoTropical) Each corollary additionally produces the not-isProp form for its f. Strengthens the truncation argument (one of the two load-bearing distinctness arguments post-EI-2): every existing pointwise proof now factors through one generic statement. Independence: standalone module; no existing file modified. Wiring into All.agda + Smoke.agda + import-the-generic-from-the-examples deferred to consolidation per the set brief. Notes for verification: * Substitution flagged in-file: the brief named carrier files TropicalArgmin.agda / EpistemicUpdate.agda / LinearErasure.agda which do not exist; closest existing carriers used instead (EchoTropical / EchoCharacteristic / EchoExamples). * Done-test (`agda --safe EchoTruncation.agda` typechecks) was NOT run in this session — agda is not installed in any environment available to the agent (Windows native, Ubuntu WSL, AlmaLinux WSL). Please verify locally before merge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ab78dbd commit c13f307

1 file changed

Lines changed: 144 additions & 0 deletions

File tree

proofs/agda/EchoTruncation.agda

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{-# OPTIONS --safe --without-K #-}
2+
3+
-- Echo non-propositionality from non-injective fibres.
4+
--
5+
-- Strengthens the truncation argument (one of the two load-bearing
6+
-- distinctness arguments post-EI-2) by formalising once-and-for-all
7+
-- the lemma that several example modules currently prove pointwise:
8+
--
9+
-- * `EchoCharacteristic.echo-true≢echo-false` (collapse : Bool → ⊤)
10+
-- * `EchoExamples.echo-plus3≢echo-minus3` (square9 : SignedNine → ℕ)
11+
-- * `EchoTropical.echo-a≢echo-b` (score : Candidate → ℕ)
12+
--
13+
-- All three witness the same fact: a non-injective `f : A → B` with
14+
-- two distinct preimages of some `y` produces a non-propositional
15+
-- `Echo f y`. This module proves that fact for an arbitrary `f` and
16+
-- recovers each existing pointwise lemma as a corollary.
17+
18+
module EchoTruncation where
19+
20+
open import Echo
21+
22+
open import Level using (Level)
23+
open import Data.Product.Base using (Σ; _,_; proj₁)
24+
open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl; cong)
25+
open import Relation.Nullary using (¬_)
26+
27+
private
28+
variable
29+
a b : Level
30+
A : Set a
31+
B : Set b
32+
33+
-- A type is propositional ("a mere proposition") when any two
34+
-- inhabitants are equal. Standard HoTT terminology, kept universe-
35+
-- polymorphic so call sites need no level juggling.
36+
isProp : {ℓ} (T : Set ℓ) Set
37+
isProp T = (x y : T) x ≡ y
38+
39+
----------------------------------------------------------------------
40+
-- Generic distinctness lemmas.
41+
42+
-- Two echoes whose underlying witnesses are distinct are themselves
43+
-- distinct. The load-bearing step is `cong proj₁`, factoring through
44+
-- `Σ` rather than `Echo`, so the lemma works at any level and for
45+
-- any non-injective f. This encapsulates the `λ q → ne (cong proj₁ q)`
46+
-- fragment that recurs across every example module.
47+
echo-witnesses-distinct :
48+
{f : A B} {y : B} {e1 e2 : Echo f y}
49+
proj₁ e1 ≢ proj₁ e2
50+
e1 ≢ e2
51+
echo-witnesses-distinct ne q = ne (cong proj₁ q)
52+
53+
-- From two distinct preimages of `y`, exhibit two distinct echoes
54+
-- at `y`. Witness/existential form: more useful than `echo-not-prop`
55+
-- when one wants the actual elements rather than just the negation.
56+
preimages⇒distinct-echoes :
57+
(f : A B) {y : B}
58+
(x1 x2 : A) (p1 : f x1 ≡ y) (p2 : f x2 ≡ y)
59+
x1 ≢ x2
60+
Σ (Echo f y) (λ e1 Σ (Echo f y) (λ e2 e1 ≢ e2))
61+
preimages⇒distinct-echoes f {y = y} x1 x2 p1 p2 ne =
62+
e1 , e2 ,
63+
echo-witnesses-distinct {f = f} {y = y} {e1 = e1} {e2 = e2} ne
64+
where
65+
e1 : Echo f y
66+
e1 = x1 , p1
67+
e2 : Echo f y
68+
e2 = x2 , p2
69+
70+
-- Headline: `Echo f y` is not a proposition whenever `f` has two
71+
-- distinct preimages of `y`. The general post-EI-2 truncation
72+
-- argument formalised once; per-example lemmas follow as corollaries
73+
-- below.
74+
echo-not-prop :
75+
(f : A B) {y : B}
76+
(x1 x2 : A) (p1 : f x1 ≡ y) (p2 : f x2 ≡ y)
77+
x1 ≢ x2
78+
¬ isProp (Echo f y)
79+
echo-not-prop f x1 x2 p1 p2 ne prop =
80+
ne (cong proj₁ (prop (x1 , p1) (x2 , p2)))
81+
82+
----------------------------------------------------------------------
83+
-- Corollaries: each pre-existing pointwise distinctness lemma is a
84+
-- special case of `echo-witnesses-distinct` / `echo-not-prop`.
85+
86+
-- Substitution note: the bootstrapping brief named the carrier
87+
-- modules `TropicalArgmin.agda`, `EpistemicUpdate.agda`, and
88+
-- `LinearErasure.agda`. Those files do not exist under those names;
89+
-- the closest existing carriers of pointwise echo-distinctness for
90+
-- non-injective f are `EchoTropical`, `EchoCharacteristic`, and
91+
-- `EchoExamples`. The corollaries below use the latter set.
92+
93+
-- 1. `collapse : Bool → ⊤` (the maximally collapsing example).
94+
module CollapseExample where
95+
open import Data.Bool.Base using (Bool; true; false)
96+
open import Data.Unit.Base using (⊤; tt)
97+
open import EchoCharacteristic using
98+
(collapse; echo-true; echo-false; true≢false)
99+
100+
echo-true≢echo-false : echo-true ≢ echo-false
101+
echo-true≢echo-false =
102+
echo-witnesses-distinct
103+
{f = collapse} {y = tt}
104+
{e1 = echo-true} {e2 = echo-false}
105+
true≢false
106+
107+
collapse-not-prop : ¬ isProp (Echo collapse tt)
108+
collapse-not-prop =
109+
echo-not-prop collapse true false refl refl true≢false
110+
111+
-- 2. `square9 : SignedNine → ℕ` (sign-forgetting square).
112+
module Square9Example where
113+
open import Data.Nat.Base using (ℕ)
114+
open import EchoExamples using
115+
(SignedNine; plus3; minus3; plus3≢minus3; square9;
116+
echo-plus3; echo-minus3)
117+
118+
echo-plus3≢echo-minus3 : echo-plus3 ≢ echo-minus3
119+
echo-plus3≢echo-minus3 =
120+
echo-witnesses-distinct
121+
{f = square9} {y = 9}
122+
{e1 = echo-plus3} {e2 = echo-minus3}
123+
plus3≢minus3
124+
125+
square9-not-prop : ¬ isProp (Echo square9 9)
126+
square9-not-prop =
127+
echo-not-prop square9 plus3 minus3 refl refl plus3≢minus3
128+
129+
-- 3. `score : Candidate → ℕ` (tropical / argmin scoring).
130+
module TropicalExample where
131+
open import Data.Nat.Base using (ℕ; zero)
132+
open import EchoTropical using
133+
(Candidate; a; b; a≢b; score; echo-a; echo-b)
134+
135+
echo-a≢echo-b : echo-a ≢ echo-b
136+
echo-a≢echo-b =
137+
echo-witnesses-distinct
138+
{f = score} {y = zero}
139+
{e1 = echo-a} {e2 = echo-b}
140+
a≢b
141+
142+
tropical-score-not-prop : ¬ isProp (Echo score zero)
143+
tropical-score-not-prop =
144+
echo-not-prop score a b refl refl a≢b

0 commit comments

Comments
 (0)