Use named modules to avoid having to pass redundant parameters
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
22
Main.agda
22
Main.agda
@@ -20,23 +20,22 @@ xyzw-Unique : Unique xyzw
|
||||
xyzw-Unique = push ((λ ()) ∷ (λ ()) ∷ (λ ()) ∷ []) (push ((λ ()) ∷ (λ ()) ∷ []) (push ((λ ()) ∷ []) (push [] empty)))
|
||||
|
||||
open import Lattice using (IsFiniteHeightLattice; FiniteHeightLattice; Monotonic)
|
||||
|
||||
open import Lattice.AboveBelow ⊤ _≡_ (record { ≈-refl = refl; ≈-sym = sym; ≈-trans = trans }) _≟ᵘ_ as AB using () renaming (≈-dec to ≈ᵘ-dec)
|
||||
open AB.Plain using () renaming (finiteHeightLattice to finiteHeightLatticeᵘ)
|
||||
open import Lattice.Bundles.FiniteValueMap String AB.AboveBelow _≟ˢ_ using () renaming (finiteHeightLattice to finiteHeightLatticeᵐ; FiniteHeightType to FiniteHeightTypeᵐ; ≈-dec to ≈-dec)
|
||||
|
||||
fhlᵘ = finiteHeightLatticeᵘ (Data.Unit.tt)
|
||||
|
||||
FiniteHeightMap = FiniteHeightTypeᵐ fhlᵘ xyzw-Unique ≈ᵘ-dec
|
||||
|
||||
showAboveBelow : AB.AboveBelow → String
|
||||
showAboveBelow AB.⊤ = "⊤"
|
||||
showAboveBelow AB.⊥ = "⊥"
|
||||
showAboveBelow (AB.[_] tt) = "()"
|
||||
|
||||
showMap : FiniteHeightMap → String
|
||||
showMap ((kvs , _) , _) = "{" ++ foldr (λ (x , y) rest → x ++ " ↦ " ++ showAboveBelow y ++ ", " ++ rest) "" kvs ++ "}"
|
||||
fhlᵘ = finiteHeightLatticeᵘ (Data.Unit.tt)
|
||||
|
||||
fhlⁱᵖ = finiteHeightLatticeᵐ fhlᵘ xyzw-Unique ≈ᵘ-dec
|
||||
import Lattice.Bundles.FiniteValueMap
|
||||
open Lattice.Bundles.FiniteValueMap.FromFiniteHeightLattice String AB.AboveBelow _≟ˢ_ fhlᵘ xyzw-Unique ≈ᵘ-dec using (FiniteMap; ≈-dec) renaming (finiteHeightLattice to fhlⁱᵖ)
|
||||
|
||||
showMap : FiniteMap → String
|
||||
showMap ((kvs , _) , _) = "{" ++ foldr (λ (x , y) rest → x ++ " ↦ " ++ showAboveBelow y ++ ", " ++ rest) "" kvs ++ "}"
|
||||
|
||||
open FiniteHeightLattice fhlⁱᵖ using (_≈_; _⊔_; _⊓_; ⊔-idemp; _≼_; ≈-⊔-cong; ≈-refl; ≈-trans; ≈-sym; ⊔-assoc; ⊔-comm; ⊔-Monotonicˡ)
|
||||
open import Relation.Binary.Reasoning.Base.Single _≈_ (λ {m} → ≈-refl {m}) (λ {m₁} {m₂} {m₃} → ≈-trans {m₁} {m₂} {m₃}) -- why am I having to eta-expand here?
|
||||
@@ -44,16 +43,15 @@ open import Relation.Binary.Reasoning.Base.Single _≈_ (λ {m} → ≈-refl {m}
|
||||
smallestMap = proj₁ (proj₁ (proj₁ (FiniteHeightLattice.fixedHeight fhlⁱᵖ)))
|
||||
largestMap = proj₂ (proj₁ (proj₁ (FiniteHeightLattice.fixedHeight fhlⁱᵖ)))
|
||||
|
||||
dumb : FiniteHeightMap
|
||||
dumb : FiniteMap
|
||||
dumb = ((("x" , AB.[_] tt) ∷ ("y" , AB.⊥) ∷ ("z" , AB.⊥) ∷ ("w" , AB.⊥) ∷ [] , xyzw-Unique) , refl)
|
||||
|
||||
dumbFunction : FiniteHeightMap → FiniteHeightMap
|
||||
dumbFunction : FiniteMap → FiniteMap
|
||||
dumbFunction = _⊔_ dumb
|
||||
|
||||
dumbFunction-Monotonic : Monotonic _≼_ _≼_ dumbFunction
|
||||
dumbFunction-Monotonic {m₁} {m₂} m₁≼m₂ = ⊔-Monotonicˡ dumb {m₁} {m₂} m₁≼m₂
|
||||
|
||||
|
||||
open import Fixedpoint {0ℓ} {FiniteHeightMap} {8} {_≈_} {_⊔_} {_⊓_} (≈-dec fhlᵘ xyzw-Unique ≈ᵘ-dec) (FiniteHeightLattice.isFiniteHeightLattice fhlⁱᵖ) dumbFunction (λ {m₁} {m₂} m₁≼m₂ → dumbFunction-Monotonic {m₁} {m₂} m₁≼m₂)
|
||||
open import Fixedpoint {0ℓ} {FiniteMap} {8} {_≈_} {_⊔_} {_⊓_} ≈-dec (FiniteHeightLattice.isFiniteHeightLattice fhlⁱᵖ) dumbFunction (λ {m₁} {m₂} m₁≼m₂ → dumbFunction-Monotonic {m₁} {m₂} m₁≼m₂)
|
||||
|
||||
main = run {0ℓ} (putStrLn (showMap aᶠ))
|
||||
|
||||
Reference in New Issue
Block a user