Skip to content

Commit 9b55dfe

Browse files
committed
Implement agda-sets properties locally
1 parent cb6e546 commit 9b55dfe

File tree

4 files changed

+60
-36
lines changed

4 files changed

+60
-36
lines changed

flake.lock

Lines changed: 1 addition & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
nixpkgs.url = "github:NixOs/nixpkgs";
77
flake-utils.url = "github:numtide/flake-utils";
88

9-
abstract-set-theory = {
10-
url = "github:input-output-hk/agda-sets/de39823e91d845232bbf22058565d0553f5da2ac";
11-
flake = false;
12-
};
13-
149
agda-nix = {
1510
url = "github:input-output-hk/agda.nix";
1611
inputs.nixpkgs.follows = "nixpkgs";
@@ -43,16 +38,6 @@
4338
);
4439
};
4540

46-
overlay-abstract-set-theory = final: prev: {
47-
agdaPackages = prev.agdaPackages.overrideScope (
48-
afinal: aprev: {
49-
abstract-set-theory = aprev.abstract-set-theory.overrideAttrs (_: {
50-
src = inputs.abstract-set-theory;
51-
});
52-
}
53-
);
54-
};
55-
5641
perSystem = flake-utils.lib.eachSystem systems (
5742
system:
5843
let
@@ -63,7 +48,6 @@
6348
# (see https://github.com/NixOS/nixpkgs/issues/447012)
6449
inputs.fls-agda.overlays.default
6550
inputs.agda-nix.overlays.default
66-
overlay-abstract-set-theory
6751
overlay-formal-ledger
6852
];
6953
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{-# OPTIONS --safe --no-import-sorts #-}
2+
open import Axiom.Set using (Theory)
3+
4+
module abstract-set-theory.Axiom.Set.Properties {ℓ} (th : Theory {ℓ}) where
5+
6+
open import abstract-set-theory.Prelude hiding (isEquivalence; trans; map; map₂)
7+
open Theory th
8+
9+
open import Axiom.Set.Properties th hiding (filter-⇒-⊆; filter-map )
10+
11+
import Function.Related.Propositional as R
12+
open import Relation.Binary hiding (_⇔_)
13+
open import Relation.Binary.Lattice
14+
open import Relation.Binary.Morphism using (IsOrderHomomorphism)
15+
16+
open Equivalence
17+
18+
private variable
19+
A B C : Type ℓ
20+
X Y Z : Set A
21+
22+
module _ {P Q : A Type} {sp-P : specProperty P} {sp-Q : specProperty Q} where
23+
24+
import Relation.Unary as U
25+
26+
filter-⇒ : (P⇒Q : U.Universal (P U.⇒ Q)) filter sp-P (filter sp-Q X) ≡ᵉ filter sp-P X
27+
filter-⇒ P⇒Q = filter-⇒-⊆ , filter-⇒-⊇
28+
where
29+
filter-⇒-⊆ : filter sp-P (filter sp-Q X) ⊆ filter sp-P X
30+
filter-⇒-⊆ p with from ∈-filter p
31+
... | (q , p) with from ∈-filter p
32+
... | (_ , p) = to ∈-filter (q , p)
33+
34+
filter-⇒-⊇ : filter sp-P X ⊆ filter sp-P (filter sp-Q X)
35+
filter-⇒-⊇ p with from ∈-filter p
36+
... | (q , p) = to ∈-filter (q , (to ∈-filter (P⇒Q _ q , p)))
37+
38+
module _ {P : A Type} {sp-P : specProperty P} {Q : B Type} {sp-Q : specProperty Q} where
39+
40+
import Relation.Unary as U
41+
42+
module _ {f : A B} (Qf⇒P : U.Universal ((Q ∘ f) U.⇒ P)) where
43+
44+
filter-map : filter sp-Q (map f X) ≡ᵉ filter sp-Q (map f (filter sp-P X))
45+
filter-map = filter-map-⊆ , filter-map-⊇
46+
where
47+
filter-map-⊆ : filter sp-Q (map f X) ⊆ filter sp-Q (map f (filter sp-P X))
48+
filter-map-⊆ p with from ∈-filter p
49+
... | Qa , p with from ∈-map p
50+
... | (a , refl , p) = to ∈-filter (Qa , (to ∈-map (_ , (refl , (to ∈-filter (Qf⇒P a Qa , p))))))
51+
52+
filter-map-⊇ : filter sp-Q (map f (filter sp-P X)) ⊆ filter sp-Q (map f X)
53+
filter-map-⊇ p with from ∈-filter p
54+
... | Qfa , p with from ∈-map p
55+
... | (a , refl , p) with from ∈-filter p
56+
... | (Pa , p) = to ∈-filter (Qfa , (to ∈-map (a , (refl , p))))

src/Ledger/Conway/Specification/Epoch/Properties/ExpiredDReps.agda

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ open import Ledger.Conway.Specification.PoolReap txs abs
2424
open import Ledger.Conway.Specification.Utxo txs abs
2525
open import Ledger.Conway.Specification.Gov txs
2626
open import Ledger.Conway.Specification.Gov.Actions govStructure using (Vote)
27-
open import Axiom.Set.Properties th
2827
open import Relation.Binary.PropositionalEquality hiding (cong)
2928

29+
open import Axiom.Set.Properties th hiding (filter-map)
30+
open import abstract-set-theory.Axiom.Set.Properties th
31+
3032
-- | Epoch indexed relation.
3133
-- Two DReps (Map Credential Epoch) are related iff: Non-expired DReps are the same.
3234
DReps-[_]_≈_ : Epoch B.Rel DReps 0ℓ

0 commit comments

Comments
 (0)