# HG changeset patch # User Shinji KONO # Date 1686446769 -32400 # Node ID 70d46c446b0d379a95f82256027da889840f166d # Parent 1f43bbfff797fa8b55558bdaecf17ba6092c14a7 using Fresh List diff -r 1f43bbfff797 -r 70d46c446b0d src/bijection.agda --- a/src/bijection.agda Sun Jun 11 01:20:46 2023 +0900 +++ b/src/bijection.agda Sun Jun 11 10:26:09 2023 +0900 @@ -10,7 +10,7 @@ open import Data.Nat.Properties open import Relation.Nullary open import Data.Empty -open import Data.Unit hiding ( _≤_ ) +open import Data.Unit using ( tt ; ⊤ ) open import Relation.Binary.Core hiding (_⇔_) open import Relation.Binary.Definitions open import Relation.Binary.PropositionalEquality @@ -41,6 +41,12 @@ bi-sym : {n m : Level} (R : Set n) (S : Set m) → Bijection R S → Bijection S R bi-sym R S eq = record { fun← = fun→ eq ; fun→ = fun← eq ; fiso← = fiso→ eq ; fiso→ = fiso← eq } +bi-inject← : {n m : Level} {R : Set n} {S : Set m} → (rs : Bijection R S) → {x y : S} → fun← rs x ≡ fun← rs y → x ≡ y +bi-inject← rs {x} {y} eq = subst₂ (λ j k → j ≡ k ) (fiso→ rs _) (fiso→ rs _) (cong (fun→ rs) eq) + +bi-inject→ : {n m : Level} {R : Set n} {S : Set m} → (rs : Bijection R S) → {x y : R} → fun→ rs x ≡ fun→ rs y → x ≡ y +bi-inject→ rs {x} {y} eq = subst₂ (λ j k → j ≡ k ) (fiso← rs _) (fiso← rs _) (cong (fun← rs) eq) + open import Relation.Binary.Structures bijIsEquivalence : {n : Level } → IsEquivalence (Bijection {n} {n}) @@ -478,6 +484,13 @@ -- Bernstein is non constructive, so we cannot use this without some assumption -- but in case of ℕ, we can construct it directly. +open import Data.Product +open import Relation.Nary using (⌊_⌋) +open import Relation.Nullary.Decidable hiding (⌊_⌋) +open import Data.Unit.Base using (⊤ ; tt) +open import Data.List.Fresh hiding ([_]) + + record InjectiveF (A B : Set) : Set where field f : A → B @@ -585,6 +598,79 @@ ... | no nisA | yes isB = ≤-trans (ca≤cb0 n) px≤x ... | no nisA | no nisB = ca≤cb0 n + data FL : (n : ℕ ) → Set where + ca ¬a ¬b c = tri> ¬a (λ eq → ¬b (FL-eq0 eq) ) c + + _f ¬a ¬b c = no ¬a + + FList : (n : ℕ ) → Set + FList n = List# (FL n) ⌊ _f ¬a ¬b lt = cons a ( x ∷# [] ) ( Level.lift (fromWitness lt) , Level.lift tt ) + FLinsert {suc n} x (cons a y yr) | tri> ¬a ¬b a ¬a ¬b b ¬a ¬b b ¬a ¬b b ¬a ¬b ca