A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://agda.github.io/agda-stdlib/master/Data.Vec.Functional.Relation.Unary.Any.html below:

Data.Vec.Functional.Relation.Unary.Any

Data.Vec.Functional.Relation.Unary.Any
------------------------------------------------------------------------
-- The Agda standard library
--
-- Existential lifting of predicates over Vectors
------------------------------------------------------------------------

{-# OPTIONS --cubical-compatible --safe #-}

module Data.Vec.Functional.Relation.Unary.Any where

open import Data.Fin.Base using (zero; suc)
open import Data.Fin.Properties using (any?)
open import Data.Nat.Base using ()
open import Data.Product.Base as Σ using (Σ; ; _×_; _,_; proj₁; proj₂)
open import Data.Vec.Functional as VF hiding (map)
open import Function.Base using (id)
open import Level using (Level)
open import Relation.Unary using (Pred; _⊆_; Decidable)

private
  variable
    a b p q  : Level
    A : Set a
    B : Set b

------------------------------------------------------------------------
-- Definition

Any : Pred A    {n}  Vector A n  Set 
Any P xs =  λ i  P (xs i)

------------------------------------------------------------------------
-- Operations

module _ {P : Pred A p} where

  here :  {x n} {v : Vector A n}  P x  Any P (x  v)
  here px = zero , px

  there :  {x n} {v : Vector A n}  Any P v  Any P (x  v)
  there = Σ.map suc id

module _ {P : Pred A p} {Q : Pred A q} where

  map : P  Q   {n}  Any P {n = n}  Any Q
  map p⊆q = Σ.map id p⊆q

------------------------------------------------------------------------
-- Properties of predicates preserved by Any

module _ {P : Pred A p} where

  any : Decidable P   {n}  Decidable (Any P {n = n})
  any p? xs = any? λ i  p? (xs i)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4