-- 8th Summer School on Formal Techniques -- Menlo College, Atherton, California, US -- -- 21-25 May 2018 -- -- Lecture 2: Representing Logics and Programming Languages in Agda -- -- File 0: Extraction from Agda's standard library module Library where open import Data.Unit public using (⊤) open import Data.Empty public using (⊥; ⊥-elim) open import Data.Product public using (_×_; _,_; proj₁; proj₂; curry; uncurry; <_,_>; ∃; Σ) open import Data.Sum public using (_⊎_; inj₁; inj₂; [_,_]) renaming (map to map-⊎) open import Function public using (_∘_; id) open import Relation.Binary.PropositionalEquality public using (_≡_; refl; cong; cong₂) -- Explanation: -- import : get an external module (an Agda file) -- open : bring contents of a module into scope (import symbols) -- open public : mark imported symbols for export -- using : restrict import to the listed symbols -- renaming : change symbol name while importing -- hiding : import all symbols except the ones listed -- Own auxiliary definitions. -- This application operation for function is also known as the "S-combinator". apply : ∀{A B Γ : Set} (f : Γ → A → B) (g : Γ → A) → Γ → B apply f g = λ x → f x (g x) cases : ∀{A B C Γ : Set} (f : Γ → A ⊎ B) (g : Γ × A → C) (h : Γ × B → C) → Γ → C cases f g h = λ x → [ g ∘ (x ,_) , h ∘ (x ,_) ] (f x) lift-fun : ∀{C D A : Set} (f : C → D) → C × A → D × A lift-fun f (c , a) = f c , a