Skip to content

Instantly share code, notes, and snippets.

View ncfavier's full-sized avatar
🌑

Naïm Camille Favier ncfavier

🌑
View GitHub Profile
@ncfavier
ncfavier / representable-tiny.txt
Last active April 18, 2025 18:23
If C has finite products then representables are tiny ([よ(t), —] has an amazing right adjoint)
[よ(t), X] ⇒ Y
= ∀ d. (よ(t) × よ(d) ⇒ X) → Y(d)
= ∀ d. (よ(t × c) ⇒ X) → Y(d)
= ∀ d. X(t × d) → Y(d)
= ∀ d c. X(c) → (t × d → c) → Y(d)
= ∀ c. X(c) → ∀ d. (t × d → c) → Y(d)
= ∀ c. X(c) → ∀ d. (よ(t) × よ(d) ⇒ よ(c)) → Y(d)
= ∀ c. X(c) → ([よ(t), よ(c)] ⇒ Y)
= X ⇒ √Y
@ncfavier
ncfavier / Pullback.agda
Created January 14, 2025 23:49
Exercise 2.11 from the HoTT book
{-# OPTIONS --without-K #-}
open import Agda.Primitive renaming (Set to Type)
open import Data.Product
open import Data.Product.Properties
open import Function.Base
open import Relation.Binary.PropositionalEquality
open import Axiom.Extensionality.Propositional
module Pullback (funext : Extensionality _ _) where
open import 1Lab.Prelude
open import Data.Dec
open import Data.Fin
open import Data.Fin.Closure
module wip.Probabilities where
-- “I have two children, (at least) one of whom is a boy born on a Tuesday -
-- what is the probability that both children are boys?”
{-# OPTIONS --without-K #-}
open import Agda.Primitive renaming (Set to Type)
open import Agda.Builtin.Equality
module JMeq where
data JMeq {ℓ} {A : Type ℓ} (a : A) : {B : Type ℓ} → B → Type (lsuc ℓ) where
refl : JMeq a a
JMeq-rec
: ∀ {ℓ} {A B : Type ℓ} (P : {A : Type ℓ} → A → Type ℓ) {x : A} {y : B}
-- A = 𝟘 → 𝟙
-- Pierce's law does not hold in the family model: we have (A ⇒ ⊥) ≅ ⊥,
-- hence ((A ⇒ ⊥) ⇒ A) ≅ ⊤, hence (((A ⇒ ⊥) ⇒ A) ⇒ A) ≅ A, but there is
-- no term of type A.
notPierce : Tm ⋄ (((A ⇒ ⊥) ⇒ A) ⇒ A) → 𝟘
notPierce (a₀ , a₁) = a₁ tt tt _ (λ a₂ _ → a₂ tt)
@ncfavier
ncfavier / homogeneous.cooltt
Last active September 20, 2024 11:36
Homogeneous = heterogeneous dependent paths in cooltt 😎
import prelude
import coercion
-- De Morgan-style connections, adapted from https://github.com/RedPRL/redtt/blob/master/library/prelude/connection.red
-- Note that these are *strong* connections in the sense that p (i ∧ i) = p i, as
-- opposed to the weak connections defined in https://arxiv.org/abs/1911.05844.
def max
(A : type)
(p : 𝕀 → A)
-- Moved to https://agda.monade.li/PostcomposeNotFull.html
-- Moved to https://agda.monade.li/AdjunctionCommaIso.html
open import 1Lab.Prelude
open import Data.Nat
module wip.Nat where
module _
(N : Type)
(N-set : is-set N)
(z : N)
(s : N → N)
{-# OPTIONS --cubical #-}
open import Cubical.Data.Int
open import Cubical.Data.Int.Divisibility
open import Cubical.Data.Nat
open import Cubical.Foundations.Everything
open import Data.List
open import Data.List.NonEmpty as List⁺
data Vertex : Type where
a b c : Vertex