Search is not available for this dataset
text
string
meta
dict
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.ZCohomology.Groups.Sn where open import Cubical.ZCohomology.Base open import Cubical.ZCohomology.Properties open import Cubical.ZCohomology.MayerVietorisUnreduced open import Cubical.ZCohomology.Groups.Unit open import Cubical.ZCohomology.Groups.Connected open import Cubical.ZCohomology.KcompPrelims open import Cubical.ZCohomology.Groups.Prelims open import Cubical.Foundations.HLevels open import Cubical.Foundations.Equiv open import Cubical.Foundations.Function open import Cubical.Foundations.Prelude open import Cubical.Foundations.Pointed open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.GroupoidLaws open import Cubical.HITs.Pushout open import Cubical.HITs.Sn open import Cubical.HITs.S1 open import Cubical.HITs.Susp open import Cubical.HITs.SetTruncation renaming (rec to sRec ; elim to sElim ; elim2 to sElim2) open import Cubical.HITs.PropositionalTruncation renaming (rec to pRec ; elim to pElim ; elim2 to pElim2 ; ∥_∥ to ∥_∥₁ ; ∣_∣ to ∣_∣₁) open import Cubical.HITs.Nullification open import Cubical.Data.Sigma open import Cubical.Data.Int renaming (_+_ to _+ℤ_; +-comm to +ℤ-comm ; +-assoc to +ℤ-assoc) open import Cubical.Data.Nat open import Cubical.HITs.Truncation renaming (elim to trElim ; map to trMap ; rec to trRec) open import Cubical.Data.Unit open import Cubical.Algebra.Group infixr 31 _□_ _□_ : _ _□_ = compGroupEquiv open GroupEquiv open vSES Sn-connected : (n : ℕ) (x : S₊ (suc n)) → ∥ north ≡ x ∥₁ Sn-connected n = suspToPropRec north (λ _ → propTruncIsProp) ∣ refl ∣₁ H⁰-Sⁿ≅ℤ : (n : ℕ) → GroupEquiv (coHomGr 0 (S₊ (suc n))) intGroup H⁰-Sⁿ≅ℤ n = H⁰-connected north (Sn-connected n) -- ---------------------------------------------------------------------- --- We will need to switch between Sⁿ defined using suspensions and using pushouts --- in order to apply Mayer Vietoris. coHomPushout≅coHomSn : (n m : ℕ) → GroupEquiv (coHomGr m (S₊ (suc n))) (coHomGr m (Pushout {A = S₊ n} (λ _ → tt) λ _ → tt)) coHomPushout≅coHomSn n m = transport (λ i → GroupEquiv (coHomGr m (PushoutSusp≡Susp {A = S₊ n} i)) (coHomGr m (Pushout {A = S₊ n} (λ _ → tt) λ _ → tt))) (idGroupEquiv _) -------------------------- H⁰(S⁰) ----------------------------- S0→Int : (a : Int × Int) → S₊ 0 → Int S0→Int a north = fst a S0→Int a south = snd a H⁰-S⁰≅ℤ×ℤ : GroupEquiv (coHomGr 0 (S₊ 0)) (dirProd intGroup intGroup) eq H⁰-S⁰≅ℤ×ℤ = isoToEquiv (iso (sRec (isOfHLevelΣ 2 isSetInt λ _ → isSetInt) λ f → (f north) , (f south)) (λ a → ∣ S0→Int a ∣₂) (λ _ → refl) (sElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ f → cong ∣_∣₂ (funExt (λ {north → refl ; south → refl})))) isHom H⁰-S⁰≅ℤ×ℤ = sElim2 (λ _ _ → isOfHLevelPath 2 (isOfHLevelΣ 2 isSetInt (λ _ → isSetInt)) _ _) λ a b i → addLemma (a north) (b north) i , addLemma (a south) (b south) i -- --------------------------H¹(S¹) ----------------------------------- {- In order to apply Mayer-Vietoris, we need the following lemma. Given the following diagram a ↦ (a , 0) ψ ϕ A --> A × A -------> B ---> C If ψ is an isomorphism and ϕ is surjective with ker ϕ ≡ {ψ (a , a) ∣ a ∈ A}, then C ≅ B -} diagonalIso : ∀ {ℓ ℓ' ℓ''} {A : Group {ℓ}} (B : Group {ℓ'}) {C : Group {ℓ''}} (ψ : GroupEquiv (dirProd A A) B) (ϕ : GroupHom B C) → isSurjective _ _ ϕ → ((x : ⟨ B ⟩) → isInKer B C ϕ x → ∃[ y ∈ ⟨ A ⟩ ] x ≡ fst (eq ψ) (y , y)) → ((x : ⟨ B ⟩) → (∃[ y ∈ ⟨ A ⟩ ] x ≡ fst (eq ψ) (y , y)) → isInKer B C ϕ x) → GroupEquiv A C diagonalIso {A = A} B {C = C} ψ ϕ issurj ker→diag diag→ker = BijectionIsoToGroupEquiv (bij-iso (compGroupHom fstProj (compGroupHom (grouphom (fst (eq ψ)) (isHom ψ)) ϕ)) (λ a inker → pRec (isSetCarrier A _ _) (λ {(a' , id) → cong fst (sym (secEq (eq ψ) (a , 0g A)) ∙∙ cong (invEq (eq ψ)) id ∙∙ secEq (eq ψ) (a' , a')) ∙ cong snd (sym (secEq (eq ψ) (a' , a')) ∙∙ cong (invEq (eq ψ)) (sym id) ∙∙ secEq (eq ψ) (a , 0g A))}) (ker→diag _ inker)) λ c → pRec propTruncIsProp (λ { (b , id) → ∣ (fst (ψ⁻ b) A.+ (A.- snd (ψ⁻ b))) -- (fst (ψ⁻ b) A.+ (A.- snd (ψ⁻ b))) , (sym (Group.rid C _) ∙∙ cong ((fun ϕ) (equivFun (eq ψ) (fst (ψ⁻ b) A.+ (A.- snd (ψ⁻ b)) , 0g A)) C.+_) (sym (diag→ker (equivFun (eq ψ) ((snd (ψ⁻ b)) , (snd (ψ⁻ b)))) ∣ (snd (ψ⁻ b)) , refl ∣₁)) ∙∙ sym ((isHom ϕ) _ _)) ∙∙ cong (fun ϕ) (sym ((isHom ψ) _ _) ∙∙ cong (equivFun (eq ψ)) (ΣPathP (sym (Group.assoc A _ _ _) ∙∙ cong (fst (ψ⁻ b) A.+_) (Group.invl A _) ∙∙ Group.rid A _ , (Group.lid A _))) ∙∙ retEq (eq ψ) b) ∙∙ id ∣₁ }) (issurj c)) where open Group open IsGroup open GroupHom module A = Group A module B = Group B module C = Group C module A×A = Group (dirProd A A) module ψ = GroupEquiv ψ module ϕ = GroupHom ϕ ψ⁻ = fst (invEquiv (eq ψ)) fstProj : GroupHom A (dirProd A A) fun fstProj a = a , 0g A isHom fstProj g0 g1 i = (g0 A.+ g1) , Group.lid A (0g A) (~ i) H¹-S¹≅ℤ : GroupEquiv intGroup (coHomGr 1 (S₊ 1)) H¹-S¹≅ℤ = diagonalIso (coHomGr 0 (S₊ 0)) (invGroupEquiv H⁰-S⁰≅ℤ×ℤ) (I.d 0) (λ x → I.Ker-i⊂Im-d 0 x (ΣPathP (isOfHLevelSuc 0 (isContrHⁿ-Unit 0) _ _ , isOfHLevelSuc 0 (isContrHⁿ-Unit 0) _ _))) ((sElim (λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 propTruncIsProp) (λ x inker → pRec propTruncIsProp (λ {((f , g) , id') → helper x f g id' inker}) ((I.Ker-d⊂Im-Δ 0 ∣ x ∣₂ inker))))) ((sElim (λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ F surj → pRec (setTruncIsSet _ _) (λ { (x , id) → I.Im-Δ⊂Ker-d 0 ∣ F ∣₂ ∣ (∣ (λ _ → x) ∣₂ , ∣ (λ _ → 0) ∣₂) , (cong ∣_∣₂ (funExt (surjHelper x))) ∙ sym id ∣₁ }) surj) ) □ invGroupEquiv (coHomPushout≅coHomSn 0 1) where module I = MV Unit Unit (S₊ 0) (λ _ → tt) (λ _ → tt) surjHelper : (x : Int) (x₁ : S₊ 0) → x +ₖ (-ₖ pos 0) ≡ S0→Int (x , x) x₁ surjHelper x north = cong (x +ₖ_) (-0ₖ) ∙ rUnitₖ x surjHelper x south = cong (x +ₖ_) (-0ₖ) ∙ rUnitₖ x helper : (F : S₊ 0 → Int) (f g : ∥ (Unit → Int) ∥₂) (id : GroupHom.fun (I.Δ 0) (f , g) ≡ ∣ F ∣₂) → isInKer (coHomGr 0 (S₊ 0)) (coHomGr 1 (Pushout (λ _ → tt) (λ _ → tt))) (I.d 0) ∣ F ∣₂ → ∃[ x ∈ Int ] ∣ F ∣₂ ≡ equivFun (invEquiv (eq H⁰-S⁰≅ℤ×ℤ)) (x , x) helper F = sElim2 (λ _ _ → isOfHLevelΠ 2 λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 propTruncIsProp) λ f g id inker → pRec propTruncIsProp (λ ((a , b) , id2) → sElim2 {B = λ f g → GroupHom.fun (I.Δ 0) (f , g) ≡ ∣ F ∣₂ → _ } (λ _ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 propTruncIsProp) (λ f g id → ∣ (helper2 f g .fst) , (sym id ∙ sym (helper2 f g .snd)) ∣₁) a b id2) (MV.Ker-d⊂Im-Δ _ _ (S₊ 0) (λ _ → tt) (λ _ → tt) 0 ∣ F ∣₂ inker) where helper2 : (f g : Unit → Int) → Σ[ x ∈ Int ] (equivFun (invEquiv (eq H⁰-S⁰≅ℤ×ℤ))) (x , x) ≡ GroupHom.fun (I.Δ 0) (∣ f ∣₂ , ∣ g ∣₂) helper2 f g = (f _ +ₖ (-ₖ g _) ) , cong ∣_∣₂ (funExt (λ {north → refl ; south → refl})) ------------------------- H¹(S⁰) ≅ 0 ------------------------------- private Hⁿ-S0≃Kₙ×Kₙ : (n : ℕ) → Iso (S₊ 0 → coHomK (suc n)) (coHomK (suc n) × coHomK (suc n)) Iso.fun (Hⁿ-S0≃Kₙ×Kₙ n) f = (f north) , (f south) Iso.inv (Hⁿ-S0≃Kₙ×Kₙ n) (a , b) north = a Iso.inv (Hⁿ-S0≃Kₙ×Kₙ n) (a , b) south = b Iso.rightInv (Hⁿ-S0≃Kₙ×Kₙ n) a = refl Iso.leftInv (Hⁿ-S0≃Kₙ×Kₙ n) b = funExt λ {north → refl ; south → refl} isContrHⁿ-S0 : (n : ℕ) → isContr (coHom (suc n) (S₊ 0)) isContrHⁿ-S0 n = transport (λ i → isContr ∥ isoToPath (Hⁿ-S0≃Kₙ×Kₙ n) (~ i) ∥₂) (transport (λ i → isContr (isoToPath (setTruncOfProdIso {A = coHomK (suc n)} {B = coHomK (suc n)} ) (~ i))) ((∣ 0ₖ ∣₂ , ∣ 0ₖ ∣₂) , prodElim (λ _ → isOfHLevelSuc 1 (isOfHLevelΣ 2 setTruncIsSet (λ _ → setTruncIsSet) _ _)) (elim2 (λ _ _ → isProp→isOfHLevelSuc (2 + n) (isOfHLevelΣ 2 setTruncIsSet (λ _ → setTruncIsSet) _ _)) (suspToPropRec2 north (λ _ _ → isOfHLevelΣ 2 setTruncIsSet (λ _ → setTruncIsSet) _ _) refl)))) H¹-S⁰≅0 : (n : ℕ) → GroupEquiv (coHomGr (suc n) (S₊ 0)) trivialGroup H¹-S⁰≅0 n = contrGroup≅trivialGroup (isContrHⁿ-S0 n) ------------------------- H²(S¹) ≅ 0 ------------------------------- H²-S¹≅0 : GroupEquiv (coHomGr 2 (S₊ 1)) trivialGroup H²-S¹≅0 = coHomPushout≅coHomSn 0 2 □ (invGroupEquiv (vSES→GroupEquiv _ _ vSES-helper)) □ (H¹-S⁰≅0 0) where module I = MV Unit Unit (S₊ 0) (λ _ → tt) (λ _ → tt) vSES-helper : vSES (coHomGr 1 (S₊ 0)) (coHomGr 2 (Pushout (λ _ → tt) (λ _ → tt))) _ _ isTrivialLeft vSES-helper = isOfHLevelSuc 0 (isOfHLevelΣ 0 (isContrHⁿ-Unit 0) (λ _ → isContrHⁿ-Unit 0)) isTrivialRight vSES-helper = isOfHLevelSuc 0 (isOfHLevelΣ 0 (isContrHⁿ-Unit 1) (λ _ → isContrHⁿ-Unit 1)) left vSES-helper = I.Δ 1 right vSES-helper = I.i 2 vSES.ϕ vSES-helper = I.d 1 Ker-ϕ⊂Im-left vSES-helper = I.Ker-d⊂Im-Δ 1 Ker-right⊂Im-ϕ vSES-helper = sElim (λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 propTruncIsProp) -- doesn't terminate without elimination λ a → I.Ker-i⊂Im-d 1 ∣ a ∣₂ --------------- H¹(Sⁿ), n ≥ 1 -------------------------------------------- H¹-Sⁿ≅0 : (n : ℕ) → GroupEquiv (coHomGr 1 (S₊ (2 + n))) trivialGroup H¹-Sⁿ≅0 n = coHomPushout≅coHomSn (1 + n) 1 □ BijectionIsoToGroupEquiv (bij-iso (I.i 1) helper λ x → ∣ 0ₕ , isOfHLevelSuc 0 (isOfHLevelΣ 0 (isContrHⁿ-Unit zero) (λ _ → isContrHⁿ-Unit zero)) _ x ∣₁) □ dirProdEquiv (Hⁿ-Unit≅0 zero) (Hⁿ-Unit≅0 zero) □ lUnitGroupIso where module I = MV Unit Unit (S₊ (1 + n)) (λ _ → tt) (λ _ → tt) surj-helper : (x : ⟨ coHomGr 0 (S₊ _) ⟩) → isInIm _ _ (I.Δ 0) x surj-helper = sElim (λ _ → isOfHLevelSuc 1 propTruncIsProp) λ f → ∣ (∣ (λ _ → f north) ∣₂ , 0ₕ) , (cong ∣_∣₂ (funExt (suspToPropRec north (λ _ → isSetInt _ _) (cong (f north +ₖ_) -0ₖ ∙ rUnitₖ (f north))))) ∣₁ helper : isInjective _ _ (I.i 1) helper = sElim (λ _ → isOfHLevelΠ 2 λ _ → isOfHLevelSuc 1 (setTruncIsSet _ _)) -- useless elimination speeds things up significantly λ x inker → pRec (setTruncIsSet _ _) (sigmaElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ a id → sym id ∙ I.Im-Δ⊂Ker-d 0 ∣ a ∣₂ (surj-helper _)) (I.Ker-i⊂Im-d 0 ∣ x ∣₂ inker) --------- Direct proof of H¹(S¹) ≅ ℤ without Mayer-Vietoris ------- -- The strategy is to use the proof that ΩS¹ ≃ ℤ. Since we only have this for S¹ with the base/loop definition -- we begin with some functions translating between H¹(S₊ 1) and ∥ S¹ → S¹ ∥₀. The latter type is easy to characterise, -- by (S¹ → S¹) ≃ S¹ × ℤ (see Cubical.ZCohomology.Groups.Prelims). Truncating this leaves only ℤ, since S¹ is connected. -- The translation mentioned above uses the basechange function. We use basechange-lemma (Cubical.ZCohomology.Groups.Prelims) to prove the basechange2⁻ preserves -- path composition (in a more general sense than what is proved in basechange2⁻-morph) -- We can now give the group equivalence. The first bit is just a big composition of our previously defined translations and is pretty uninteresting. -- The harder step is proving that the equivalence is a morphism. This relies heavily on the fact that addition the cohomology groups essentially is defined using an -- application of cong₂, which allows us to use basechange-lemma. coHom1S1≃ℤ : GroupEquiv (coHomGr 1 (S₊ 1)) intGroup eq coHom1S1≃ℤ = isoToEquiv theIso where F = Iso.fun S¹→S¹≡S¹×Int F⁻ = Iso.inv S¹→S¹≡S¹×Int G = Iso.fun S1→S1≡S¹→S¹ G⁻ = Iso.inv S1→S1≡S¹→S¹ theIso : Iso ⟨ coHomGr 1 (S₊ 1) ⟩ ⟨ intGroup ⟩ Iso.fun theIso = sRec isSetInt (λ f → snd (F (G f))) Iso.inv theIso a = ∣ G⁻ (F⁻ (base , a)) ∣₂ Iso.rightInv theIso a = (cong (snd ∘ F) (Iso.rightInv S1→S1≡S¹→S¹ (F⁻ (base , a))) ∙ cong snd (Iso.rightInv S¹→S¹≡S¹×Int (base , a))) Iso.leftInv theIso = sElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ f → cong ((sRec setTruncIsSet (λ x → ∣ G⁻ x ∣₂)) ∘ sRec setTruncIsSet λ x → ∣ F⁻ (x , (snd (F (G f)))) ∣₂) (Iso.inv PathIdTrunc₀Iso (isConnectedS¹ (fst (F (G f))))) ∙∙ cong (∣_∣₂ ∘ G⁻) (Iso.leftInv S¹→S¹≡S¹×Int (G f)) ∙∙ cong ∣_∣₂ (Iso.leftInv S1→S1≡S¹→S¹ f) isHom coHom1S1≃ℤ = sElim2 (λ _ _ → isOfHLevelPath 2 isSetInt _ _) λ f g → (λ i → winding (guy (ΩKn+1→Kn (Kn→ΩKn+1 1 (f (S¹→S1 base)) ∙ Kn→ΩKn+1 1 (g (S¹→S1 base)))) (λ i → pre-guy (ΩKn+1→Kn (Kn→ΩKn+1 1 (f (S¹→S1 (loop i))) ∙ Kn→ΩKn+1 1 (g (S¹→S1 (loop i)))))))) ∙∙ cong winding (helper (f (S¹→S1 base)) (g (S¹→S1 base)) f g refl refl) ∙∙ winding-hom (guy (f north) (λ i → pre-guy (f (S¹→S1 (loop i))))) (guy (g north) (λ i → pre-guy (g (S¹→S1 (loop i))))) where pre-guy = S¹map ∘ trMap S1→S¹ guy = basechange2⁻ ∘ pre-guy helper : (x y : coHomK 1) (f g : S₊ 1 → coHomK 1) → (f (S¹→S1 base)) ≡ x → (g (S¹→S1 base)) ≡ y → (guy (ΩKn+1→Kn (Kn→ΩKn+1 1 (f (S¹→S1 base)) ∙ Kn→ΩKn+1 1 (g (S¹→S1 base)))) (λ i → S¹map (trMap S1→S¹ (ΩKn+1→Kn (Kn→ΩKn+1 1 (f (S¹→S1 (loop i))) ∙ Kn→ΩKn+1 1 (g (S¹→S1 (loop i)))))))) ≡ (guy (f (S¹→S1 base)) (λ i → pre-guy (f (S¹→S1 (loop i))))) ∙ (guy (g (S¹→S1 base)) (λ i → pre-guy ((g (S¹→S1 (loop i)))))) helper = elim2 (λ _ _ → isGroupoidΠ4 λ _ _ _ _ → isOfHLevelPath 3 (isOfHLevelSuc 3 (isGroupoidS¹) base base) _ _) (suspToPropRec2 {A = S₊ 0} north (λ _ _ → isPropΠ4 λ _ _ _ _ → isGroupoidS¹ _ _ _ _) λ f g reflf reflg → (basechange-lemma base base (λ x → S¹map (trMap S1→S¹ (ΩKn+1→Kn x))) (λ x → Kn→ΩKn+1 1 (f (S¹→S1 x))) ((λ x → Kn→ΩKn+1 1 (g (S¹→S1 x)))) (cong (Kn→ΩKn+1 1) reflf ∙ Kn→ΩKn+10ₖ 1) (cong (Kn→ΩKn+1 1) reflg ∙ Kn→ΩKn+10ₖ 1)) ∙ λ j → guy (Iso.leftInv (Iso3-Kn-ΩKn+1 1) (f (S¹→S1 base)) j) (λ i → pre-guy (Iso.leftInv (Iso3-Kn-ΩKn+1 1) (f (S¹→S1 (loop i))) j)) ∙ guy (Iso.leftInv (Iso3-Kn-ΩKn+1 1) (g (S¹→S1 base)) j) (λ i → pre-guy (Iso.leftInv (Iso3-Kn-ΩKn+1 1) (g (S¹→S1 (loop i))) j))) ---------------------------- Hⁿ(Sⁿ) ≅ ℤ , n ≥ 1 ------------------- Hⁿ-Sⁿ≅ℤ : (n : ℕ) → GroupEquiv intGroup (coHomGr (suc n) (S₊ (suc n))) Hⁿ-Sⁿ≅ℤ zero = invGroupEquiv coHom1S1≃ℤ Hⁿ-Sⁿ≅ℤ (suc n) = Hⁿ-Sⁿ≅ℤ n □ vSES→GroupEquiv _ _ theIso □ invGroupEquiv (coHomPushout≅coHomSn (suc n) (suc (suc n))) where module I = MV Unit Unit (S₊ (suc n)) (λ _ → tt) (λ _ → tt) theIso : vSES (coHomGr (suc n) (S₊ (suc n))) (coHomGr (suc (suc n)) (Pushout {A = S₊ (suc n)} (λ _ → tt) (λ _ → tt))) _ _ isTrivialLeft theIso p q = ΣPathP (isOfHLevelSuc 0 (isContrHⁿ-Unit n) (fst p) (fst q) , isOfHLevelSuc 0 (isContrHⁿ-Unit n) (snd p) (snd q)) isTrivialRight theIso p q = ΣPathP (isOfHLevelSuc 0 (isContrHⁿ-Unit (suc n)) (fst p) (fst q) , isOfHLevelSuc 0 (isContrHⁿ-Unit (suc n)) (snd p) (snd q)) left theIso = I.Δ (suc n) right theIso = I.i (2 + n) vSES.ϕ theIso = I.d (suc n) Ker-ϕ⊂Im-left theIso = I.Ker-d⊂Im-Δ (suc n) Ker-right⊂Im-ϕ theIso = I.Ker-i⊂Im-d (suc n)
{ "alphanum_fraction": 0.497377423, "avg_line_length": 50.1142857143, "ext": "agda", "hexsha": "8f00b16f55cace754e311c85e13db9f947712518", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "f6771617374bfe65a7043d00731fed5a673aa729", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "knrafto/cubical", "max_forks_repo_path": "Cubical/ZCohomology/Groups/Sn.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "f6771617374bfe65a7043d00731fed5a673aa729", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "knrafto/cubical", "max_issues_repo_path": "Cubical/ZCohomology/Groups/Sn.agda", "max_line_length": 165, "max_stars_count": null, "max_stars_repo_head_hexsha": "f6771617374bfe65a7043d00731fed5a673aa729", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "knrafto/cubical", "max_stars_repo_path": "Cubical/ZCohomology/Groups/Sn.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 6740, "size": 17540 }
open import Agda.Builtin.Nat foo : Nat → Nat → Nat foo 0 m = {!m!} foo (suc n) m = {!!}
{ "alphanum_fraction": 0.5555555556, "avg_line_length": 12.8571428571, "ext": "agda", "hexsha": "dcf7c49e348a35315ed41cc7842e271e79509e95", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_path": "test/interaction/Issue4215.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "shlevy/agda", "max_issues_repo_path": "test/interaction/Issue4215.agda", "max_line_length": 28, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "shlevy/agda", "max_stars_repo_path": "test/interaction/Issue4215.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 37, "size": 90 }
{-# OPTIONS --without-K #-} open import lib.Base open import lib.NType open import lib.Relation open import lib.types.Bool open import lib.types.Int module lib.types.List where infixr 80 _::_ data List {i} (A : Type i) : Type i where nil : List A _::_ : A → List A → List A data HList {i} : List (Type i) → Type (lsucc i) where nil : HList nil _::_ : {A : Type i} {L : List (Type i)} → A → HList L → HList (A :: L) hlist-curry-type : ∀ {i j} (L : List (Type i)) (B : HList L → Type (lmax i j)) → Type (lmax i j) hlist-curry-type nil B = B nil hlist-curry-type {j = j} (A :: L) B = (x : A) → hlist-curry-type {j = j} L (λ xs → B (x :: xs)) hlist-curry : ∀ {i j} {L : List (Type i)} {B : HList L → Type (lmax i j)} (f : Π (HList L) B) → hlist-curry-type {j = j} L B hlist-curry {L = nil} f = f nil hlist-curry {L = A :: _} f = λ x → hlist-curry (λ xs → f (x :: xs)) infixr 80 _++_ _++_ : ∀ {i} {A : Type i} → List A → List A → List A nil ++ l = l (x :: l₁) ++ l₂ = x :: (l₁ ++ l₂) ++-nil-r : ∀ {i} {A : Type i} (l : List A) → l ++ nil == l ++-nil-r nil = idp ++-nil-r (a :: l) = ap (a ::_) $ ++-nil-r l -- [any] in Haskell data Any {i j} {A : Type i} (P : A → Type j) : List A → Type (lmax i j) where here : ∀ {a} {l} → P a → Any P (a :: l) there : ∀ {a} {l} → Any P l → Any P (a :: l) infix 80 _∈_ _∈_ : ∀ {i} {A : Type i} → A → List A → Type i a ∈ l = Any (_== a) l Any-dec : ∀ {i j} {A : Type i} (P : A → Type j) → (∀ a → Dec (P a)) → (∀ l → Dec (Any P l)) Any-dec P _ nil = inr λ{()} Any-dec P dec (a :: l) with dec a ... | inl p = inl $ here p ... | inr p⊥ with Any-dec P dec l ... | inl ∃p = inl $ there ∃p ... | inr ∃p⊥ = inr λ{(here p) → p⊥ p; (there ∃p) → ∃p⊥ ∃p} ∈-dec : ∀ {i} {A : Type i} → has-dec-eq A → ∀ a l → Dec (a ∈ l) ∈-dec dec a l = Any-dec (_== a) (λ a' → dec a' a) l Any-++-l : ∀ {i j} {A : Type i} (P : A → Type j) → ∀ l₁ l₂ → Any P l₁ → Any P (l₁ ++ l₂) Any-++-l P _ _ (here p) = here p Any-++-l P _ _ (there ∃p) = there (Any-++-l P _ _ ∃p) ∈-++-l : ∀ {i} {A : Type i} (a : A) → ∀ l₁ l₂ → a ∈ l₁ → a ∈ (l₁ ++ l₂) ∈-++-l a = Any-++-l (_== a) Any-++-r : ∀ {i j} {A : Type i} (P : A → Type j) → ∀ l₁ l₂ → Any P l₂ → Any P (l₁ ++ l₂) Any-++-r P nil _ ∃p = ∃p Any-++-r P (a :: l) _ ∃p = there (Any-++-r P l _ ∃p) ∈-++-r : ∀ {i} {A : Type i} (a : A) → ∀ l₁ l₂ → a ∈ l₂ → a ∈ (l₁ ++ l₂) ∈-++-r a = Any-++-r (_== a) Any-++ : ∀ {i j} {A : Type i} (P : A → Type j) → ∀ l₁ l₂ → Any P (l₁ ++ l₂) → (Any P l₁) ⊔ (Any P l₂) Any-++ P nil l₂ ∃p = inr ∃p Any-++ P (a :: l₁) l₂ (here p) = inl (here p) Any-++ P (a :: l₁) l₂ (there ∃p) with Any-++ P l₁ l₂ ∃p ... | inl ∃p₁ = inl (there ∃p₁) ... | inr ∃p₂ = inr ∃p₂ ∈-++ : ∀ {i} {A : Type i} (a : A) → ∀ l₁ l₂ → a ∈ (l₁ ++ l₂) → (a ∈ l₁) ⊔ (a ∈ l₂) ∈-++ a = Any-++ (_== a) -- [map] in Haskell map : ∀ {i j} {A : Type i} {B : Type j} → (A → B) → (List A → List B) map f nil = nil map f (a :: l) = f a :: map f l -- [foldr] in Haskell foldr : ∀ {i j} {A : Type i} {B : Type j} → (A → B → B) → B → List A → B foldr f b nil = b foldr f b (a :: l) = f a (foldr f b l) -- [concat] in Haskell concat : ∀ {i} {A : Type i} → List (List A) → List A concat l = foldr _++_ nil l ℤsum = foldr _ℤ+_ 0 -- [filter] in Haskell -- Note that [Bool] is currently defined as a coproduct. filter : ∀ {i j k} {A : Type i} {Keep : A → Type j} {Drop : A → Type k} → ((a : A) → Keep a ⊔ Drop a) → List A → List A filter p nil = nil filter p (a :: l) with p a ... | inl _ = a :: filter p l ... | inr _ = filter p l
{ "alphanum_fraction": 0.4711048159, "avg_line_length": 31.5178571429, "ext": "agda", "hexsha": "243204bd8081dda056dbc2962abd19181dad735c", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cmknapp/HoTT-Agda", "max_forks_repo_path": "core/lib/types/List.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cmknapp/HoTT-Agda", "max_issues_repo_path": "core/lib/types/List.agda", "max_line_length": 91, "max_stars_count": null, "max_stars_repo_head_hexsha": "bc849346a17b33e2679a5b3f2b8efbe7835dc4b6", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cmknapp/HoTT-Agda", "max_stars_repo_path": "core/lib/types/List.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1638, "size": 3530 }
{-# OPTIONS --safe --warning=error --without-K --guardedness #-} open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) open import Setoids.Setoids open import Rings.Definition open import Rings.Orders.Partial.Definition open import Sets.EquivalenceRelations open import Sequences open import Setoids.Orders.Partial.Definition open import Functions.Definition open import LogicalFormulae open import Numbers.Naturals.Semiring open import Groups.Definition module Rings.Orders.Partial.Bounded {m n o : _} {A : Set m} {S : Setoid {m} {n} A} {_+_ : A → A → A} {_*_ : A → A → A} {_<_ : Rel {m} {o} A} {pOrder : SetoidPartialOrder S _<_} {R : Ring S _+_ _*_} (pRing : PartiallyOrderedRing R pOrder) where open Group (Ring.additiveGroup R) open import Groups.Lemmas (Ring.additiveGroup R) open Setoid S open Equivalence eq open SetoidPartialOrder pOrder BoundedAbove : Sequence A → Set (m ⊔ o) BoundedAbove x = Sg A (λ K → (n : ℕ) → index x n < K) BoundedBelow : Sequence A → Set (m ⊔ o) BoundedBelow x = Sg A (λ K → (n : ℕ) → K < index x n) Bounded : Sequence A → Set (m ⊔ o) Bounded x = Sg A (λ K → (n : ℕ) → ((Group.inverse (Ring.additiveGroup R) K) < index x n) && (index x n < K)) boundNonzero : {s : Sequence A} → (b : Bounded s) → underlying b ∼ 0G → False boundNonzero {s} (a , b) isEq with b 0 ... | bad1 ,, bad2 = irreflexive (<Transitive bad1 (<WellDefined reflexive (transitive isEq (symmetric (transitive (inverseWellDefined isEq) invIdent))) bad2))
{ "alphanum_fraction": 0.6997957794, "avg_line_length": 40.8055555556, "ext": "agda", "hexsha": "6574976a0382a4cf9e2173f8d15f7d53001874d6", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_path": "Rings/Orders/Partial/Bounded.agda", "max_issues_count": 14, "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_path": "Rings/Orders/Partial/Bounded.agda", "max_line_length": 243, "max_stars_count": 4, "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_path": "Rings/Orders/Partial/Bounded.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "num_tokens": 474, "size": 1469 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Transitive closures -- -- This module is DEPRECATED. Please use the -- Relation.Binary.Construct.Closure.Transitive module directly. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Plus where open import Relation.Binary.Construct.Closure.Transitive public
{ "alphanum_fraction": 0.5056947608, "avg_line_length": 29.2666666667, "ext": "agda", "hexsha": "4ae6881b739baafb17439590a32112ce22cc232e", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Plus.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Plus.agda", "max_line_length": 72, "max_stars_count": null, "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Plus.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 67, "size": 439 }
module LiftGet where open import Data.Unit using (⊤ ; tt) open import Data.Nat using (ℕ ; suc) open import Data.Vec using (Vec ; toList ; fromList) renaming ([] to []V ; _∷_ to _∷V_ ; map to mapV) open import Data.List using (List ; [] ; _∷_ ; length ; replicate ; map) open import Data.List.Properties using (length-map) open import Data.Product using (∃ ; _,_ ; proj₁ ; proj₂) open import Function using (_∘_ ; flip ; const) open import Relation.Binary.Core using (_≡_) open import Relation.Binary.PropositionalEquality using (_≗_ ; sym ; cong ; refl ; subst ; trans ; proof-irrelevance ; module ≡-Reasoning) open import Relation.Binary.HeterogeneousEquality as H using (module ≅-Reasoning ; _≅_ ; ≅-to-≡ ; ≡-to-≅ ; ≡-subst-removable) renaming (refl to het-refl ; sym to het-sym ; cong to het-cong ; reflexive to het-reflexive) import FreeTheorems open import Generic using (length-replicate ; toList-fromList ; toList-subst) open FreeTheorems.ListList using (get-type) renaming (free-theorem to free-theoremL ; Get to GetL ; module Get to GetL) open FreeTheorems.VecVec using () renaming (get-type to getV-type ; Get to GetV ; module Get to GetV) getVec-to-getList : {getlen : ℕ → ℕ} → (getV-type getlen) → get-type getVec-to-getList get = toList ∘ get ∘ fromList fromList∘map : {α β : Set} → (f : α → β) → (l : List α) → fromList (map f l) ≅ mapV f (fromList l) fromList∘map f [] = het-refl fromList∘map f (x ∷ xs) = H.cong₂ (λ n → _∷V_ {n = n} (f x)) (H.reflexive (length-map f xs)) (fromList∘map f xs) toList∘map : {α β : Set} {n : ℕ} → (f : α → β) → (v : Vec α n) → toList (mapV f v) ≡ map f (toList v) toList∘map f []V = refl toList∘map f (x ∷V xs) = cong (_∷_ (f x)) (toList∘map f xs) GetV-to-GetL : GetV → GetL GetV-to-GetL getrecord = record { get = toList ∘ get ∘ fromList; free-theorem = ft } where open GetV getrecord open ≡-Reasoning ft : {α β : Set} → (f : α → β) → (xs : List α) → toList (get (fromList (map f xs))) ≡ map f (toList (get (fromList xs))) ft f xs = begin toList (get (fromList (map f xs))) ≅⟨ H.cong₂ {B = Vec _} (λ n → toList ∘ get) (het-reflexive (length-map f xs)) (fromList∘map f xs) ⟩ toList (get (mapV f (fromList xs))) ≡⟨ cong toList (free-theorem f (fromList xs)) ⟩ toList (mapV f (get (fromList xs))) ≡⟨ toList∘map f (get (fromList xs)) ⟩ map f (toList (get (fromList xs))) ∎ getList-to-getlen : get-type → ℕ → ℕ getList-to-getlen get = length ∘ get ∘ flip replicate tt replicate-length : {A : Set} → (l : List A) → map (const tt) l ≡ replicate (length l) tt replicate-length [] = refl replicate-length (_ ∷ l) = cong (_∷_ tt) (replicate-length l) getList-length : (get : get-type) → {B : Set} → (l : List B) → length (get l) ≡ getList-to-getlen get (length l) getList-length get l = begin length (get l) ≡⟨ sym (length-map (const tt) (get l)) ⟩ length (map (const tt) (get l)) ≡⟨ cong length (sym (free-theoremL get (const tt) l)) ⟩ length (get (map (const tt) l)) ≡⟨ cong (length ∘ get) (replicate-length l) ⟩ length (get (replicate (length l) tt)) ∎ where open ≡-Reasoning length-toList : {A : Set} {n : ℕ} → (v : Vec A n) → length (toList v) ≡ n length-toList []V = refl length-toList (x ∷V xs) = cong suc (length-toList xs) getList-to-getVec-length-property : (get : get-type) → {C : Set} → {m : ℕ} → (v : Vec C m) → length (get (toList v)) ≡ length (get (replicate m tt)) getList-to-getVec-length-property get {_} {m} v = begin length (get (toList v)) ≡⟨ getList-length get (toList v) ⟩ length (get (replicate (length (toList v)) tt)) ≡⟨ cong (length ∘ get ∘ flip replicate tt) (length-toList v) ⟩ length (get (replicate m tt)) ∎ where open ≡-Reasoning getList-to-getVec : get-type → ∃ λ (getlen : ℕ → ℕ) → (getV-type getlen) getList-to-getVec get = getlen , get' where getlen : ℕ → ℕ getlen = getList-to-getlen get get' : {C : Set} {m : ℕ} → Vec C m → Vec C (getlen m) get' {C} v = subst (Vec C) (getList-to-getVec-length-property get v) (fromList (get (toList v))) private module GetV-Implementation (getrecord : GetL) where open GetL getrecord getlen = length ∘ get ∘ flip replicate tt length-property : {C : Set} {m : ℕ} → (s : Vec C m) → length (get (toList s)) ≡ getlen m length-property = getList-to-getVec-length-property get getV : {C : Set} {m : ℕ} → Vec C m → Vec C (getlen m) getV s = subst (Vec _) (length-property s) (fromList (get (toList s))) ft : {α β : Set} (f : α → β) {n : ℕ} (v : Vec α n) → getV (mapV f v) ≡ mapV f (getV v) ft f v = ≅-to-≡ (begin subst (Vec _) (length-property (mapV f v)) (fromList (get (toList (mapV f v)))) ≅⟨ ≡-subst-removable (Vec _) (length-property (mapV f v)) (fromList (get (toList (mapV f v)))) ⟩ fromList (get (toList (mapV f v))) ≅⟨ het-cong (fromList ∘ get) (het-reflexive (toList∘map f v)) ⟩ fromList (get (map f (toList v))) ≅⟨ het-cong fromList (het-reflexive (free-theorem f (toList v))) ⟩ fromList (map f (get (toList v))) ≅⟨ fromList∘map f (get (toList v)) ⟩ mapV f (fromList (get (toList v))) ≅⟨ H.cong₂ (λ n → mapV {n = n} f) (H.reflexive (length-property v)) (H.sym (≡-subst-removable (Vec _) (length-property v) (fromList (get (toList v))))) ⟩ mapV f (subst (Vec _) (length-property v) (fromList (get (toList v)))) ∎) where open ≅-Reasoning GetL-to-GetV : GetL → GetV GetL-to-GetV getrecord = record { getlen = getlen; get = getV; free-theorem = ft } where open GetV-Implementation getrecord get-commut-1-≅ : (get : get-type) {A : Set} → (l : List A) → fromList (get l) ≅ proj₂ (getList-to-getVec get) (fromList l) get-commut-1-≅ get l = begin fromList (get l) ≅⟨ het-cong (fromList ∘ get) (≡-to-≅ (sym (toList-fromList l))) ⟩ fromList (get (toList (fromList l))) ≅⟨ het-sym (≡-subst-removable (Vec _) (getList-to-getVec-length-property get (fromList l)) (fromList (get (toList (fromList l))))) ⟩ subst (Vec _) (getList-to-getVec-length-property get (fromList l)) (fromList (get (toList (fromList l)))) ∎ where open ≅-Reasoning get-commut-1 : (get : get-type) {A : Set} → (l : List A) → fromList (get l) ≡ subst (Vec A) (sym (getList-length get l)) (proj₂ (getList-to-getVec get) (fromList l)) get-commut-1 get {A} l = ≅-to-≡ (begin fromList (get l) ≅⟨ get-commut-1-≅ get l ⟩ proj₂ (getList-to-getVec get) (fromList l) ≅⟨ het-sym (≡-subst-removable (Vec _) (sym (getList-length get l)) (proj₂ (getList-to-getVec get) (fromList l))) ⟩ subst (Vec _) (sym (getList-length get l)) (proj₂ (getList-to-getVec get) (fromList l)) ∎) where open ≅-Reasoning get-trafo-1 : (get : get-type) → {B : Set} → getVec-to-getList (proj₂ (getList-to-getVec get)) {B} ≗ get {B} get-trafo-1 get {B} l = begin getVec-to-getList (proj₂ (getList-to-getVec get)) l ≡⟨ refl ⟩ toList (proj₂ (getList-to-getVec get) (fromList l)) ≡⟨ refl ⟩ toList (subst (Vec B) (getList-to-getVec-length-property get (fromList l)) (fromList (get (toList (fromList l))))) ≡⟨ toList-subst (fromList (get (toList (fromList l)))) (getList-to-getVec-length-property get (fromList l)) ⟩ toList (fromList (get (toList (fromList l)))) ≡⟨ toList-fromList (get (toList (fromList l))) ⟩ get (toList (fromList l)) ≡⟨ cong get (toList-fromList l) ⟩ get l ∎ where open ≡-Reasoning GetLVL-identity : (G : GetL) → {A : Set} → GetL.get (GetV-to-GetL (GetL-to-GetV G)) ≗ GetL.get G {A} GetLVL-identity G = get-trafo-1 (GetL.get G) vec-len : {A : Set} {n : ℕ} → Vec A n → ℕ vec-len {_} {n} _ = n fromList-toList : {A : Set} {n : ℕ} → (v : Vec A n) → fromList (toList v) ≅ v fromList-toList []V = het-refl fromList-toList (x ∷V xs) = H.cong₂ (λ n → _∷V_ {n = n} x) (het-reflexive (length-toList xs)) (fromList-toList xs) get-commut-2 : {getlen : ℕ → ℕ} → (get : getV-type getlen) → {B : Set} {n : ℕ} → (toList ∘ get {B} {n}) ≗ (getVec-to-getList get) ∘ toList get-commut-2 get {B} v = sym (≅-to-≡ (H.cong₂ (λ n → toList ∘ get {n = n}) (H.reflexive (length-toList v)) (fromList-toList v))) get-trafo-2-getlen : {getlen : ℕ → ℕ} → (get : getV-type getlen) → proj₁ (getList-to-getVec (getVec-to-getList get)) ≗ getlen get-trafo-2-getlen {getlen} get n = begin proj₁ (getList-to-getVec (getVec-to-getList get)) n ≡⟨ refl ⟩ length (toList (get (fromList (replicate n tt)))) ≡⟨ length-toList (get (fromList (replicate n tt))) ⟩ vec-len (get (fromList (replicate n tt))) ≡⟨ cong getlen (length-replicate n) ⟩ getlen n ∎ where open ≡-Reasoning get-trafo-2-get-≅ : {getlen : ℕ → ℕ} → (get : getV-type getlen) → {B : Set} {n : ℕ} → (v : Vec B n) → proj₂ (getList-to-getVec (getVec-to-getList get)) v ≅ get v get-trafo-2-get-≅ {getlen} get v = begin subst (Vec _) (getList-to-getVec-length-property (getVec-to-getList get) v) (fromList (toList (get (fromList (toList v))))) ≅⟨ ≡-subst-removable (Vec _) (getList-to-getVec-length-property (getVec-to-getList get) v) (fromList (toList (get (fromList (toList v))))) ⟩ fromList (toList (get (fromList (toList v)))) ≅⟨ fromList-toList (get (fromList (toList v))) ⟩ get (fromList (toList v)) ≅⟨ H.cong₂ (λ n → get {n = n}) (H.reflexive (length-toList v)) (fromList-toList v) ⟩ get v ∎ where open ≅-Reasoning get-trafo-2-get : {getlen : ℕ → ℕ} → (get : getV-type getlen) → {B : Set} {n : ℕ} → proj₂ (getList-to-getVec (getVec-to-getList get)) ≗ subst (Vec B) (sym (get-trafo-2-getlen get n)) ∘ get get-trafo-2-get get v = ≅-to-≡ (begin proj₂ (getList-to-getVec (getVec-to-getList get)) v ≅⟨ get-trafo-2-get-≅ get v ⟩ get v ≅⟨ het-sym (≡-subst-removable (Vec _) (sym (get-trafo-2-getlen get (vec-len v))) (get v)) ⟩ subst (Vec _) (sym (get-trafo-2-getlen get (vec-len v))) (get v) ∎) where open ≅-Reasoning
{ "alphanum_fraction": 0.6196711328, "avg_line_length": 51.5811518325, "ext": "agda", "hexsha": "6849a1afd85919c9431bbc51d84b320889aef4ad", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "a5abbd177f032523d1d9d3fa4b9137aefe88dee0", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "jvoigtlaender/bidiragda", "max_forks_repo_path": "LiftGet.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "a5abbd177f032523d1d9d3fa4b9137aefe88dee0", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "jvoigtlaender/bidiragda", "max_issues_repo_path": "LiftGet.agda", "max_line_length": 218, "max_stars_count": null, "max_stars_repo_head_hexsha": "a5abbd177f032523d1d9d3fa4b9137aefe88dee0", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "jvoigtlaender/bidiragda", "max_stars_repo_path": "LiftGet.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 3617, "size": 9852 }
module TestQuote where {- test of reflection, implementing a trivial prover. -} open import Common.Reflection open import Common.Prelude open import Common.Level _==_ : Term → Term → Bool def x [] == def y [] = primQNameEquality x y _ == _ = false data Thm : Set where triv : Thm `Thm = def (quote Thm) [] ⟦_⟧ : Term → Set ⟦ goal ⟧ with goal == `Thm ... | true = Thm ... | false = ⊥ Hyp : Term → Set → Set Hyp goal A with goal == `Thm ... | true = ⊤ ... | false = A solve : (goal : Term) → Hyp goal ⟦ goal ⟧ → ⟦ goal ⟧ solve goal h with goal == `Thm ... | true = triv ... | false = h test₁ : Thm test₁ = quoteGoal t in solve t _
{ "alphanum_fraction": 0.5631349782, "avg_line_length": 19.6857142857, "ext": "agda", "hexsha": "4092c4f327836c6428b29e85a516e079a180cbe1", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_forks_event_min_datetime": "2019-03-05T20:02:38.000Z", "max_forks_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "hborum/agda", "max_forks_repo_path": "test/Succeed/TestQuote.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "hborum/agda", "max_issues_repo_path": "test/Succeed/TestQuote.agda", "max_line_length": 56, "max_stars_count": 3, "max_stars_repo_head_hexsha": "aac88412199dd4cbcb041aab499d8a6b7e3f4a2e", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "hborum/agda", "max_stars_repo_path": "test/Succeed/TestQuote.agda", "max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z", "max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z", "num_tokens": 231, "size": 689 }
{-# OPTIONS --without-K --safe #-} module Cham.Context where open import Cham.Name open import Cham.Label open import Data.Product infix 5 _⊢_ data Context : Set where ∅ : Context _⊢_ : Context → Label → Context _,_ : Context → Context → Context rename : (Name → Label) → Context → Context rename ϕ ∅ = ∅ rename ϕ (Γ ⊢ (N ⁺)) = rename ϕ Γ ⊢ ϕ N rename ϕ (Γ ⊢ (N ⁻)) = rename ϕ Γ ⊢ ϕ N rename ϕ (Γ₁ , Γ₂) = rename ϕ Γ₁ , rename ϕ Γ₂ permeate : Context → Context → Context permeate ∅ Γ₂ = Γ₂ permeate (Γ₁ ⊢ N) Γ₂ = permeate Γ₁ (Γ₂ ⊢ N) permeate (Γ₁ , Γ₂) Γ₃ = Γ₁ , Γ₂ , Γ₃
{ "alphanum_fraction": 0.6096345515, "avg_line_length": 24.08, "ext": "agda", "hexsha": "e7b9e1dacb2bc535cadaadea2f67ca94dfac07ae", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "292023fc36fa67ca4a81cff9a875a325a79b9d6f", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "riz0id/chemical-abstract-machine", "max_forks_repo_path": "agda/Cham/Context.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "292023fc36fa67ca4a81cff9a875a325a79b9d6f", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "riz0id/chemical-abstract-machine", "max_issues_repo_path": "agda/Cham/Context.agda", "max_line_length": 48, "max_stars_count": null, "max_stars_repo_head_hexsha": "292023fc36fa67ca4a81cff9a875a325a79b9d6f", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "riz0id/chemical-abstract-machine", "max_stars_repo_path": "agda/Cham/Context.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 241, "size": 602 }
{-# OPTIONS --safe #-} module Cubical.Algebra.Group.Exact where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.Function open import Cubical.Data.Unit open import Cubical.Algebra.Group.Base open import Cubical.Algebra.Group.Morphisms open import Cubical.Algebra.Group.MorphismProperties open import Cubical.Algebra.Group.GroupPath open import Cubical.Algebra.Group.Instances.Unit open import Cubical.HITs.PropositionalTruncation as PT -- TODO : Define exact sequences -- (perhaps short, finite, ℕ-indexed and ℤ-indexed) SES→isEquiv : ∀ {ℓ ℓ'} {L R : Group ℓ-zero} → {G : Group ℓ} {H : Group ℓ'} → UnitGroup₀ ≡ L → UnitGroup₀ ≡ R → (lhom : GroupHom L G) (midhom : GroupHom G H) (rhom : GroupHom H R) → ((x : _) → isInKer midhom x → isInIm lhom x) → ((x : _) → isInKer rhom x → isInIm midhom x) → isEquiv (fst midhom) SES→isEquiv {R = R} {G = G} {H = H} = J (λ L _ → UnitGroup₀ ≡ R → (lhom : GroupHom L G) (midhom : GroupHom G H) (rhom : GroupHom H R) → ((x : fst G) → isInKer midhom x → isInIm lhom x) → ((x : fst H) → isInKer rhom x → isInIm midhom x) → isEquiv (fst midhom)) ((J (λ R _ → (lhom : GroupHom UnitGroup₀ G) (midhom : GroupHom G H) (rhom : GroupHom H R) → ((x : fst G) → isInKer midhom x → isInIm lhom x) → ((x : _) → isInKer rhom x → isInIm midhom x) → isEquiv (fst midhom)) main)) where main : (lhom : GroupHom UnitGroup₀ G) (midhom : GroupHom G H) (rhom : GroupHom H UnitGroup₀) → ((x : fst G) → isInKer midhom x → isInIm lhom x) → ((x : fst H) → isInKer rhom x → isInIm midhom x) → isEquiv (fst midhom) main lhom midhom rhom lexact rexact = BijectionIsoToGroupEquiv {G = G} {H = H} bijIso' .fst .snd where bijIso' : BijectionIso G H BijectionIso.fun bijIso' = midhom BijectionIso.inj bijIso' x inker = PT.rec (GroupStr.is-set (snd G) _ _) (λ s → sym (snd s) ∙ IsGroupHom.pres1 (snd lhom)) (lexact _ inker) BijectionIso.surj bijIso' x = rexact x refl -- exact sequence of 4 groups. Useful for the proof of π₄S³ record Exact4 {ℓ ℓ' ℓ'' ℓ''' : Level} (G : Group ℓ) (H : Group ℓ') (L : Group ℓ'') (R : Group ℓ''') (G→H : GroupHom G H) (H→L : GroupHom H L) (L→R : GroupHom L R) : Type (ℓ-max ℓ (ℓ-max ℓ' (ℓ-max ℓ'' ℓ'''))) where field ImG→H⊂KerH→L : (x : fst H) → isInIm G→H x → isInKer H→L x KerH→L⊂ImG→H : (x : fst H) → isInKer H→L x → isInIm G→H x ImH→L⊂KerL→R : (x : fst L) → isInIm H→L x → isInKer L→R x KerL→R⊂ImH→L : (x : fst L) → isInKer L→R x → isInIm H→L x open Exact4 extendExact4Surjective : {ℓ ℓ' ℓ'' ℓ''' ℓ'''' : Level} (G : Group ℓ) (H : Group ℓ') (L : Group ℓ'') (R : Group ℓ''') (S : Group ℓ'''') (G→H : GroupHom G H) (H→L : GroupHom H L) (L→R : GroupHom L R) (R→S : GroupHom R S) → isSurjective G→H → Exact4 H L R S H→L L→R R→S → Exact4 G L R S (compGroupHom G→H H→L) L→R R→S ImG→H⊂KerH→L (extendExact4Surjective G H L R S G→H H→L L→R R→S surj ex) x = PT.rec (GroupStr.is-set (snd R) _ _) (uncurry λ g → J (λ x _ → isInKer L→R x) (ImG→H⊂KerH→L ex (fst H→L (fst G→H g)) ∣ (fst G→H g) , refl ∣₁)) KerH→L⊂ImG→H (extendExact4Surjective G H L R S G→H H→L L→R R→S surj ex) x ker = PT.rec squash₁ (uncurry λ y → J (λ x _ → isInIm (compGroupHom G→H H→L) x) (PT.map (uncurry (λ y → J (λ y _ → Σ[ g ∈ fst G ] fst H→L (fst G→H g) ≡ H→L .fst y) (y , refl))) (surj y))) (KerH→L⊂ImG→H ex x ker) ImH→L⊂KerL→R (extendExact4Surjective G H L R S G→H H→L L→R R→S surj ex) = ImH→L⊂KerL→R ex KerL→R⊂ImH→L (extendExact4Surjective G H L R S G→H H→L L→R R→S surj ex) = KerL→R⊂ImH→L ex -- Useful lemma in the proof of π₄S³≅ℤ transportExact4 : {ℓ ℓ' ℓ'' : Level} {G G₂ : Group ℓ} {H H₂ : Group ℓ'} {L L₂ : Group ℓ''} {R : Group₀} (G≡G₂ : G ≡ G₂) (H≡H₂ : H ≡ H₂) (L≡L₂ : L ≡ L₂) → UnitGroup₀ ≡ R → (G→H : GroupHom G H) (G₂→H₂ : GroupHom G₂ H₂) (H→L : GroupHom H L) (H₂→L₂ : GroupHom H₂ L₂) (L→R : GroupHom L R) → Exact4 G H L R G→H H→L L→R → PathP (λ i → GroupHom (G≡G₂ i) (H≡H₂ i)) G→H G₂→H₂ → PathP (λ i → GroupHom (H≡H₂ i) (L≡L₂ i)) H→L H₂→L₂ → Exact4 G₂ H₂ L₂ UnitGroup₀ G₂→H₂ H₂→L₂ (→UnitHom L₂) transportExact4 {G = G} {G₂ = G₂} {H = H} {H₂ = H₂} {L = L} {L₂ = L₂} {R = R} = J4 (λ G₂ H₂ L₂ R G≡G₂ H≡H₂ L≡L₂ Unit≡R → (G→H : GroupHom G H) (G₂→H₂ : GroupHom G₂ H₂) (H→L : GroupHom H L) (H₂→L₂ : GroupHom H₂ L₂) (L→R : GroupHom L R) → Exact4 G H L R G→H H→L L→R → PathP (λ i → GroupHom (G≡G₂ i) (H≡H₂ i)) G→H G₂→H₂ → PathP (λ i → GroupHom (H≡H₂ i) (L≡L₂ i)) H→L H₂→L₂ → Exact4 G₂ H₂ L₂ UnitGroup₀ G₂→H₂ H₂→L₂ (→UnitHom L₂)) (λ G→H G₂→H₂ H→L H₂→L₂ L→R ex pp1 pp2 → J4 (λ G₂→H₂ H₂→L₂ (x : Unit) (y : Unit) pp1 pp2 (_ : tt ≡ x) (_ : tt ≡ x) → Exact4 G H L UnitGroup₀ G₂→H₂ H₂→L₂ (→UnitHom L)) ex G₂→H₂ H₂→L₂ tt tt pp1 pp2 refl refl ) G₂ H₂ L₂ R where J4 : ∀ {ℓ ℓ₂ ℓ₃ ℓ₄ ℓ'} {A : Type ℓ} {A₂ : Type ℓ₂} {A₃ : Type ℓ₃} {A₄ : Type ℓ₄} {x : A} {x₂ : A₂} {x₃ : A₃} {x₄ : A₄} (B : (y : A) (z : A₂) (w : A₃) (u : A₄) → x ≡ y → x₂ ≡ z → x₃ ≡ w → x₄ ≡ u → Type ℓ') → B x x₂ x₃ x₄ refl refl refl refl → (y : A) (z : A₂) (w : A₃) (u : A₄) (p : x ≡ y) (q : x₂ ≡ z) (r : x₃ ≡ w) (s : x₄ ≡ u) → B y z w u p q r s J4 {x = x} {x₂ = x₂} {x₃ = x₃} {x₄ = x₄} B b y z w u = J (λ y p → (q : x₂ ≡ z) (r : x₃ ≡ w) (s : x₄ ≡ u) → B y z w u p q r s) (J (λ z q → (r : x₃ ≡ w) (s : x₄ ≡ u) → B x z w u refl q r s) (J (λ w r → (s : x₄ ≡ u) → B x x₂ w u refl refl r s) (J (λ u s → B x x₂ x₃ u refl refl refl s) b)))
{ "alphanum_fraction": 0.5246146196, "avg_line_length": 42.7872340426, "ext": "agda", "hexsha": "6ba146876af38e8eb666f6627f15bbf9675c765d", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_path": "Cubical/Algebra/Group/Exact.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_path": "Cubical/Algebra/Group/Exact.agda", "max_line_length": 85, "max_stars_count": null, "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_path": "Cubical/Algebra/Group/Exact.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 2660, "size": 6033 }
module _ where open import Agda.Primitive open import Agda.Builtin.Equality open import Agda.Builtin.Nat variable ℓ : Level A B C : Set ℓ infixr 1 _×_ _,_ record _×_ {ℓ₁ ℓ₂} (A : Set ℓ₁) (B : Set ℓ₂) : Set (ℓ₁ ⊔ ℓ₂) where constructor _,_ field fst : A snd : B module _ (x : A) (y : B) where f : C → A × B × C f z = x , y , z check : (x : B) (y : C) (z : A) → f x y z ≡ (x , y , z) check x y z = refl
{ "alphanum_fraction": 0.558685446, "avg_line_length": 17.04, "ext": "agda", "hexsha": "09a81eabf56f97cc92b93fcedb1cc920f786fa38", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Succeed/Issue3291.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Succeed/Issue3291.agda", "max_line_length": 66, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Succeed/Issue3291.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 189, "size": 426 }
{-# OPTIONS --warning=error --safe --without-K #-} -- This file contains everything that can be compiled in --safe mode. open import Numbers.Naturals.Naturals open import Numbers.Naturals.Division open import Numbers.BinaryNaturals.Definition open import Numbers.BinaryNaturals.Multiplication open import Numbers.BinaryNaturals.Order open import Numbers.BinaryNaturals.Subtraction open import Numbers.Primes.PrimeNumbers open import Numbers.Primes.IntegerFactorisation open import Numbers.Rationals.Lemmas open import Numbers.Modulo.Group open import Numbers.Integers.Integers open import Numbers.Integers.RingStructure.EuclideanDomain open import Numbers.Integers.RingStructure.Archimedean open import Numbers.ClassicalReals.Examples open import Numbers.ClassicalReals.RealField.Lemmas open import Lists.Lists open import Lists.Filter.AllTrue open import Groups.Groups open import Groups.Abelian.Lemmas open import Groups.DirectSum.Definition open import Groups.QuotientGroup.Definition open import Groups.QuotientGroup.Lemmas open import Groups.FiniteGroups.Definition open import Groups.Homomorphisms.Lemmas open import Groups.Homomorphisms.Lemmas2 open import Groups.Homomorphisms.Examples open import Groups.Isomorphisms.Lemmas open import Groups.FinitePermutations open import Groups.Lemmas open import Groups.FirstIsomorphismTheorem open import Groups.SymmetricGroups.Definition open import Groups.Actions.Stabiliser open import Groups.Actions.Orbit open import Groups.SymmetricGroups.Lemmas open import Groups.ActionIsSymmetry open import Groups.Cyclic.Definition open import Groups.Cyclic.DefinitionLemmas open import Groups.Polynomials.Examples open import Groups.Cosets open import Groups.Subgroups.Normal.Examples open import Groups.Examples.ExampleSheet1 open import Groups.LectureNotes.Lecture1 open import Fields.Fields open import Fields.Orders.Partial.Definition open import Fields.Orders.Total.Definition open import Fields.Orders.Partial.Archimedean open import Fields.Orders.LeastUpperBounds.Examples open import Fields.Orders.Lemmas open import Fields.FieldOfFractions.Field open import Fields.FieldOfFractions.Lemmas open import Fields.FieldOfFractions.Order --open import Fields.FieldOfFractions.Archimedean open import Rings.Definition open import Rings.Lemmas open import Rings.Orders.Partial.Definition open import Rings.Orders.Total.Lemmas open import Rings.Orders.Partial.Lemmas open import Rings.IntegralDomains.Definition open import Rings.DirectSum open import Rings.Polynomial.Ring open import Rings.Polynomial.Evaluation open import Rings.Ideals.Definition open import Rings.Isomorphisms.Definition open import Rings.Quotients.Definition open import Rings.Cosets open import Rings.EuclideanDomains.Definition open import Rings.EuclideanDomains.Examples open import Rings.Homomorphisms.Image open import Rings.Homomorphisms.Kernel open import Rings.Ideals.FirstIsomorphismTheorem open import Rings.Ideals.Lemmas open import Rings.Ideals.Prime.Definition open import Rings.Ideals.Prime.Lemmas open import Rings.Ideals.Principal.Definition open import Rings.IntegralDomains.Examples open import Rings.PrincipalIdealDomains.Lemmas open import Rings.Subrings.Definition open import Rings.Ideals.Maximal.Lemmas open import Rings.Primes.Lemmas open import Rings.Irreducibles.Definition open import Rings.Divisible.Lemmas open import Rings.Associates.Lemmas open import Rings.InitialRing open import Rings.Homomorphisms.Lemmas open import Rings.UniqueFactorisationDomains.Definition open import Rings.Examples.Examples open import Setoids.Setoids open import Setoids.DirectSum open import Setoids.Lists open import Setoids.Orders.Total.Lemmas open import Setoids.Functions.Definition open import Setoids.Functions.Extension open import Setoids.Algebra.Lemmas open import Setoids.Intersection.Lemmas open import Setoids.Union.Lemmas open import Setoids.Cardinality.Infinite.Lemmas open import Setoids.Cardinality.Finite.Definition open import Sets.Cardinality.Infinite.Lemmas open import Sets.Cardinality.Countable.Lemmas open import Sets.Cardinality.Finite.Lemmas open import Sets.Cardinality open import Sets.FinSet.Lemmas open import Decidable.Sets open import Decidable.Reduction open import Decidable.Relations open import Vectors open import Vectors.VectorSpace open import KeyValue.KeyValue open import KeyValue.LinearStore.Definition open import Maybe open import Orders.Total.Lemmas open import Orders.WellFounded.Induction open import ClassicalLogic.ClassicalFive open import Monoids.Definition open import Semirings.Definition open import Semirings.Solver open import Categories.Definition open import Categories.Functor.Definition open import Categories.Functor.Lemmas open import Categories.Dual.Definition open import Graphs.PathGraph open import Graphs.CycleGraph open import Graphs.UnionGraph open import Graphs.CompleteGraph open import Graphs.Colouring open import Graphs.Bipartite open import Graphs.Complement open import Graphs.InducedSubgraph open import LectureNotes.MetAndTop.Chapter1 open import LectureNotes.NumbersAndSets.Lecture1 open import Modules.Examples open import Modules.PolynomialModule open import Modules.Lemmas open import Modules.DirectSum open import Computability.LambdaCalculus.ChurchNumeral open import ProjectEuler.Problem1 module Everything.Safe where
{ "alphanum_fraction": 0.8644353029, "avg_line_length": 32.4121212121, "ext": "agda", "hexsha": "97fdc3fb4450adfcb2905e66a2283faaca88478d", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_path": "Everything/Safe.agda", "max_issues_count": 14, "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_path": "Everything/Safe.agda", "max_line_length": 69, "max_stars_count": 4, "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_path": "Everything/Safe.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "num_tokens": 1258, "size": 5348 }
module Issue2756 where module M where postulate A : Set module M′ = M B : Set B = M′.A
{ "alphanum_fraction": 0.6451612903, "avg_line_length": 8.4545454545, "ext": "agda", "hexsha": "50ef6fde0c3abaa8adc98a70323547b9a5240614", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/LaTeXAndHTML/succeed/Issue2756.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/LaTeXAndHTML/succeed/Issue2756.agda", "max_line_length": 22, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/LaTeXAndHTML/succeed/Issue2756.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 34, "size": 93 }
------------------------------------------------------------------------ -- A variant of Nat.Wrapper.Cubical, defined using --erased-cubical ------------------------------------------------------------------------ {-# OPTIONS --erased-cubical --safe #-} open import Equality.Path as P open import Prelude hiding (zero; suc; _+_) open import Bijection equality-with-J using (_↔_) module Nat.Wrapper.Cubical.Erased -- The underlying representation of natural numbers. (Nat′ : Type) -- A bijection between this representation and the unary natural -- numbers. (Nat′↔ℕ : Nat′ ↔ ℕ) where open import Equality.Path.Univalence open import Logical-equivalence using (_⇔_) import Equivalence equality-with-J as Eq open import Equivalence.Erased.Cubical equality-with-paths as EEq using (_≃ᴱ_) import Equivalence.Erased.Contractible-preimages.Cubical equality-with-paths as ECP open import Erased.Cubical equality-with-paths open import Function-universe equality-with-J as F hiding (_∘_) open import H-level equality-with-J open import H-level.Closure equality-with-J open import H-level.Truncation.Propositional.Erased equality-with-paths as Trunc import Nat equality-with-J as Nat import Univalence-axiom equality-with-J as U open import Nat.Wrapper equality-with-J Nat′ Nat′↔ℕ as NW open NW.[]-cong instance-of-[]-cong-axiomatisation private variable A : Type m n : A ------------------------------------------------------------------------ -- Could Nat have been defined using the propositional truncation -- operator (with an erased higher constructor) instead of Erased? -- Could Nat have been defined using ∥_∥ᴱ instead of Erased? Let us -- try. -- Given a truncated natural number we can kind of apply Nat-[_] to -- it, because Nat-[_] is a family of contractible types. (The code -- uses erased univalence.) Nat-[]′ : ∥ ℕ ∥ᴱ → ∃ λ (A : Type) → Contractible A Nat-[]′ = Trunc.rec λ where .truncation-is-propositionʳ → U.∃-H-level-H-level-1+ ext univ 0 .∣∣ʳ n → Nat-[ n ] , propositional⇒inhabited⇒contractible Nat-[]-propositional ( _↔_.from Nat′↔ℕ n , [ _↔_.right-inverse-of Nat′↔ℕ n ] ) Nat-[_]′ : ∥ ℕ ∥ᴱ → Type Nat-[ n ]′ = proj₁ (Nat-[]′ n) -- Thus we can form a variant of Nat. Nat-with-∥∥ᴱ : Type Nat-with-∥∥ᴱ = Σ ∥ ℕ ∥ᴱ Nat-[_]′ -- However, this variant is equivalent (with erased proofs) to the -- unit type. Nat-with-∥∥ᴱ≃ᴱ⊤ : Nat-with-∥∥ᴱ ≃ᴱ ⊤ Nat-with-∥∥ᴱ≃ᴱ⊤ = _⇔_.to EEq.Contractibleᴱ⇔≃ᴱ⊤ $ ECP.Contractibleᴱ-Σ (ECP.inhabited→Is-proposition→Contractibleᴱ ∣ 0 ∣ truncation-is-proposition) (ECP.Contractible→Contractibleᴱ ∘ proj₂ ∘ Nat-[]′) -- And thus it is not isomorphic to the natural numbers. ¬-Nat-with-∥∥ᴱ↔ℕ : ¬ (Nat-with-∥∥ᴱ ↔ ℕ) ¬-Nat-with-∥∥ᴱ↔ℕ = Stable-¬ [ Nat-with-∥∥ᴱ ↔ ℕ ↝⟨ F._∘ inverse (from-equivalence (EEq.≃ᴱ→≃ Nat-with-∥∥ᴱ≃ᴱ⊤)) ⟩ ⊤ ↔ ℕ ↝⟨ (λ hyp → _↔_.injective (inverse hyp) refl) ⟩ 0 ≡ 1 ↝⟨ Nat.0≢+ ⟩□ ⊥ □ ] ------------------------------------------------------------------------ -- Addition of "wrapped" numbers is commutative and associative module _ (o : Operations) where open Operations-for-Nat o open Operations-for-Nat-correct o private -- A lemma used several times below. from[to+to]≡+ : ∀ m → _↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ m Prelude.+ _↔_.to Nat↔ℕ n) ≡ m + n from[to+to]≡+ {n = n} m = _↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ m Prelude.+ _↔_.to Nat↔ℕ n) ≡⟨ cong (_↔_.from Nat↔ℕ) $ sym $ to-ℕ-+ m n ⟩ _↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ (m + n)) ≡⟨ _↔_.left-inverse-of Nat↔ℕ _ ⟩∎ m + n ∎ -- First two "traditional" proofs. -- Addition is commutative. +-comm-traditional : ∀ m {n} → m + n ≡ n + m +-comm-traditional m {n = n} = m + n ≡⟨ sym $ from[to+to]≡+ m ⟩ _↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ m Prelude.+ _↔_.to Nat↔ℕ n) ≡⟨ cong (_↔_.from Nat↔ℕ) $ Nat.+-comm (_↔_.to Nat↔ℕ m) ⟩ _↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ n Prelude.+ _↔_.to Nat↔ℕ m) ≡⟨ from[to+to]≡+ n ⟩∎ n + m ∎ -- Addition is associative. +-assoc-traditional : ∀ m {n o} → m + (n + o) ≡ (m + n) + o +-assoc-traditional m {n = n} {o = o} = m + (n + o) ≡⟨ cong (m +_) $ sym $ from[to+to]≡+ n ⟩ m + (_↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ n Prelude.+ _↔_.to Nat↔ℕ o)) ≡⟨ sym $ from[to+to]≡+ m ⟩ _↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ m Prelude.+ _↔_.to Nat↔ℕ (_↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ n Prelude.+ _↔_.to Nat↔ℕ o))) ≡⟨ cong (λ n → _↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ m Prelude.+ n)) $ _↔_.right-inverse-of Nat↔ℕ _ ⟩ _↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ m Prelude.+ (_↔_.to Nat↔ℕ n Prelude.+ _↔_.to Nat↔ℕ o)) ≡⟨ cong (_↔_.from Nat↔ℕ) $ Nat.+-assoc (_↔_.to Nat↔ℕ m) ⟩ _↔_.from Nat↔ℕ ((_↔_.to Nat↔ℕ m Prelude.+ _↔_.to Nat↔ℕ n) Prelude.+ _↔_.to Nat↔ℕ o) ≡⟨ cong (λ n → _↔_.from Nat↔ℕ (n Prelude.+ _↔_.to Nat↔ℕ o)) $ sym $ _↔_.right-inverse-of Nat↔ℕ _ ⟩ _↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ (_↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ m Prelude.+ _↔_.to Nat↔ℕ n)) Prelude.+ _↔_.to Nat↔ℕ o) ≡⟨ from[to+to]≡+ (_↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ m Prelude.+ _↔_.to Nat↔ℕ n)) ⟩ (_↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ m Prelude.+ _↔_.to Nat↔ℕ n)) + o ≡⟨ cong (_+ o) $ from[to+to]≡+ {n = n} m ⟩∎ (m + n) + o ∎ -- The following proofs are instead based on a technique used by -- Vezzosi, Mörtberg and Abel in "Cubical Agda: A Dependently Typed -- Programming Language with Univalence and Higher Inductive Types". -- The type of unary natural numbers is equal to the type of wrapped -- natural numbers (in erased contexts). @0 ℕ≡Nat : ℕ ≡ Nat ℕ≡Nat = sym (≃⇒≡ (Eq.↔⇒≃ Nat↔ℕ)) -- Addition of unary natural numbers is, in a certain sense, equal -- to addition of wrapped natural numbers (in erased contexts). @0 +≡+ : P.[ (λ i → ℕ≡Nat i → ℕ≡Nat i → ℕ≡Nat i) ] Prelude._+_ ≡ _+_ +≡+ = Prelude._+_ ≡⟨ (λ i → transport (λ j → ℕ≡Nat (min i j) → ℕ≡Nat (min i j) → ℕ≡Nat (min i j)) (- i) Prelude._+_) ⟩h transport (λ i → ℕ≡Nat i → ℕ≡Nat i → ℕ≡Nat i) 0̲ Prelude._+_ ≡⟨⟩ (λ m n → _↔_.from Nat↔ℕ (_↔_.to Nat↔ℕ m Prelude.+ _↔_.to Nat↔ℕ n)) ≡⟨ (⟨ext⟩ λ m → ⟨ext⟩ λ _ → from[to+to]≡+ m) ⟩∎ _+_ ∎ -- Addition is commutative (in erased contexts). @0 +-comm-cubical : ∀ m {n} → m + n ≡ n + m +-comm-cubical = transport (λ i → (m {n} : ℕ≡Nat i) → +≡+ i m n ≡ +≡+ i n m) 0̲ Nat.+-comm -- Addition is associative (in erased contexts). @0 +-assoc-cubical : ∀ m {n o} → m + (n + o) ≡ (m + n) + o +-assoc-cubical = transport (λ i → (m {n o} : ℕ≡Nat i) → +≡+ i m (+≡+ i n o) ≡ +≡+ i (+≡+ i m n) o) 0̲ Nat.+-assoc -- This proof technique seems to scale better than the one used -- above, at least for examples of the kind used here. However, when -- --erased-cubical is used it only works in erased contexts.
{ "alphanum_fraction": 0.5016696635, "avg_line_length": 37.61352657, "ext": "agda", "hexsha": "3751ae4e11a4573c374997ab95499388df8da650", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "nad/equality", "max_forks_repo_path": "src/Nat/Wrapper/Cubical/Erased.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "nad/equality", "max_issues_repo_path": "src/Nat/Wrapper/Cubical/Erased.agda", "max_line_length": 145, "max_stars_count": 3, "max_stars_repo_head_hexsha": "402b20615cfe9ca944662380d7b2d69b0f175200", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "nad/equality", "max_stars_repo_path": "src/Nat/Wrapper/Cubical/Erased.agda", "max_stars_repo_stars_event_max_datetime": "2021-09-02T17:18:15.000Z", "max_stars_repo_stars_event_min_datetime": "2020-05-21T22:58:50.000Z", "num_tokens": 2817, "size": 7786 }
module reverse-++-distrib where import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; sym; cong) open Eq.≡-Reasoning open import lists using (List; []; _∷_; [_]; _++_; ++-assoc; ++-identityʳ; reverse) -- 結合したリストの逆順は、逆順にしたリストの逆順の結合と等しいことの証明 reverse-++-distrib : ∀ {A : Set} → (xs ys : List A) → reverse (xs ++ ys) ≡ reverse ys ++ reverse xs reverse-++-distrib [] ys = begin reverse ([] ++ ys) ≡⟨⟩ reverse ys ≡⟨ sym (++-identityʳ (reverse ys)) ⟩ reverse ys ++ [] ≡⟨⟩ reverse ys ++ reverse [] ∎ reverse-++-distrib (x ∷ xs) ys = begin reverse (x ∷ xs ++ ys) ≡⟨⟩ reverse (xs ++ ys) ++ [ x ] ≡⟨ cong (_++ [ x ]) (reverse-++-distrib xs ys) ⟩ (reverse ys ++ reverse xs) ++ [ x ] ≡⟨ ++-assoc (reverse ys) (reverse xs) [ x ] ⟩ reverse ys ++ (reverse xs ++ [ x ]) ≡⟨⟩ reverse ys ++ reverse (x ∷ xs) ∎
{ "alphanum_fraction": 0.5565714286, "avg_line_length": 26.5151515152, "ext": "agda", "hexsha": "443635d03c57db39e921481c794cd9f0f6f40d92", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_forks_repo_licenses": [ "Apache-2.0" ], "max_forks_repo_name": "akiomik/plfa-solutions", "max_forks_repo_path": "part1/lists/reverse-++-distrib.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "Apache-2.0" ], "max_issues_repo_name": "akiomik/plfa-solutions", "max_issues_repo_path": "part1/lists/reverse-++-distrib.agda", "max_line_length": 83, "max_stars_count": 1, "max_stars_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "akiomik/plfa-solutions", "max_stars_repo_path": "part1/lists/reverse-++-distrib.agda", "max_stars_repo_stars_event_max_datetime": "2020-07-07T09:42:22.000Z", "max_stars_repo_stars_event_min_datetime": "2020-07-07T09:42:22.000Z", "num_tokens": 355, "size": 875 }
{-# OPTIONS --safe #-} open import Definition.Typed.EqualityRelation module Definition.LogicalRelation.Substitution.ProofIrrelevance {{eqrel : EqRelSet}} where open EqRelSet {{...}} open import Definition.Untyped as U hiding (wk) open import Definition.Untyped.Properties using (wkSingleSubstId) open import Definition.Typed open import Definition.Typed.Weakening open import Definition.Typed.Properties open import Definition.LogicalRelation open import Definition.LogicalRelation.Properties open import Definition.LogicalRelation.Substitution open import Tools.Product open import Tools.Unit open import Tools.Empty open import Tools.Nat import Tools.PropositionalEquality as PE import Data.Nat as Nat ~-quasirefl : ∀ {Γ n n′ A r} → Γ ⊢ n ~ n′ ∷ A ^ r → Γ ⊢ n ~ n ∷ A ^ r ~-quasirefl p = ~-trans p (~-sym p) ≅-quasirefl : ∀ {Γ n n′ A r} → Γ ⊢ n ≅ n′ ∷ A ^ r → Γ ⊢ n ≅ n ∷ A ^ r ≅-quasirefl p = ≅ₜ-trans p (≅ₜ-sym p) proof-irrelevanceRel : ∀ {Γ A t u l l′} ([A] : Γ ⊩⟨ l ⟩ A ^ [ % , l′ ]) → Γ ⊩⟨ l ⟩ t ∷ A ^ [ % , l′ ] / [A] → Γ ⊩⟨ l ⟩ u ∷ A ^ [ % , l′ ] / [A] → Γ ⊩⟨ l ⟩ t ≡ u ∷ A ^ [ % , l′ ] / [A] proof-irrelevanceRel (Emptyᵣ x) (Emptyₜ (ne ⊢t)) (Emptyₜ (ne ⊢t₁)) = Emptyₜ₌ (ne ⊢t ⊢t₁) proof-irrelevanceRel (ne x) (neₜ ⊢t) (neₜ ⊢t₁) = neₜ₌ ⊢t ⊢t₁ proof-irrelevanceRel {Γ} {l = l} (Πᵣ′ rF lF lG _ _ F G D ⊢F ⊢G A≡A [F] [G] G-ext) [f] [f₁] = [f] , [f₁] proof-irrelevanceRel {Γ} {l = l} (∃ᵣ′ F G D ⊢F ⊢G A≡A [F] [G] G-ext) [f] [f₁] = [f] , [f₁] proof-irrelevanceRel (emb emb< [A]) [t] [u] = proof-irrelevanceRel [A] [t] [u] proof-irrelevanceRel (emb ∞< [A]) [t] [u] = proof-irrelevanceRel [A] [t] [u] proof-irrelevanceᵛ : ∀ {Γ A t u l l′} ([Γ] : ⊩ᵛ Γ) ([A] : Γ ⊩ᵛ⟨ l ⟩ A ^ [ % , l′ ] / [Γ]) → Γ ⊩ᵛ⟨ l ⟩ t ∷ A ^ [ % , l′ ] / [Γ] / [A] → Γ ⊩ᵛ⟨ l ⟩ u ∷ A ^ [ % , l′ ] / [Γ] / [A] → Γ ⊩ᵛ⟨ l ⟩ t ≡ u ∷ A ^ [ % , l′ ] / [Γ] / [A] proof-irrelevanceᵛ [Γ] [A] [t] [u] {σ = σ} ⊢Δ [σ] = proof-irrelevanceRel (proj₁ ([A] ⊢Δ [σ])) (proj₁ ([t] ⊢Δ [σ])) (proj₁ ([u] ⊢Δ [σ])) validityIrr : ∀ {l A t Γ l'} ([Γ] : ⊩ᵛ Γ) ([A] : Γ ⊩ᵛ⟨ l ⟩ A ^ [ % , l' ] / [Γ]) (⊢t : ∀ {Δ σ} (⊢Δ : ⊢ Δ) ([σ] : Δ ⊩ˢ σ ∷ Γ / [Γ] / ⊢Δ) → Δ ⊢ subst σ t ∷ subst σ A ^ [ % , l' ]) → Γ ⊩ᵛ⟨ l ⟩ t ∷ A ^ [ % , l' ] / [Γ] / [A] validityIrr [Γ] [A] ⊢t {Δ} {σ} ⊢Δ [σ] = let [Aσ] = proj₁ ([A] ⊢Δ [σ]) [tσ] = logRelIrr [Aσ] (⊢t ⊢Δ [σ]) -- [tσ] = proj₁ ([t] ⊢Δ [σ]) in logRelIrr [Aσ] (⊢t ⊢Δ [σ]) , λ [σ′] [σ≡σ′] → let [Aσ′] = proj₁ ([A] ⊢Δ [σ′]) [tσ′] = logRelIrr [Aσ′] (⊢t ⊢Δ [σ′]) [Aσ≡σ′] = proj₂ ([A] ⊢Δ [σ]) [σ′] [σ≡σ′] in logRelIrrEq [Aσ] (⊢t ⊢Δ [σ]) (escapeTerm [Aσ] (convTerm₂ [Aσ] [Aσ′] [Aσ≡σ′] [tσ′]))
{ "alphanum_fraction": 0.4710743802, "avg_line_length": 40.9014084507, "ext": "agda", "hexsha": "f222de4bd6dbfb4c40508928f9cf77055f573953", "lang": "Agda", "max_forks_count": 2, "max_forks_repo_forks_event_max_datetime": "2022-02-15T19:42:19.000Z", "max_forks_repo_forks_event_min_datetime": "2022-01-26T14:55:51.000Z", "max_forks_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "CoqHott/logrel-mltt", "max_forks_repo_path": "Definition/LogicalRelation/Substitution/ProofIrrelevance.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "CoqHott/logrel-mltt", "max_issues_repo_path": "Definition/LogicalRelation/Substitution/ProofIrrelevance.agda", "max_line_length": 155, "max_stars_count": 2, "max_stars_repo_head_hexsha": "e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "CoqHott/logrel-mltt", "max_stars_repo_path": "Definition/LogicalRelation/Substitution/ProofIrrelevance.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-17T16:13:53.000Z", "max_stars_repo_stars_event_min_datetime": "2018-06-21T08:39:01.000Z", "num_tokens": 1353, "size": 2904 }
{-# OPTIONS --without-K --safe #-} module Tools.List where infixr 30 _∷_ data List (A : Set) : Set where [] : List A _∷_ : A → List A → List A
{ "alphanum_fraction": 0.58, "avg_line_length": 15, "ext": "agda", "hexsha": "047e6ccf63ab657a1092c5c452ac4912c403c3b7", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "loic-p/logrel-mltt", "max_forks_repo_path": "Tools/List.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "loic-p/logrel-mltt", "max_issues_repo_path": "Tools/List.agda", "max_line_length": 34, "max_stars_count": null, "max_stars_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "loic-p/logrel-mltt", "max_stars_repo_path": "Tools/List.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 53, "size": 150 }
-- Andreas, 2014-07-02 wondering about the ETA pragma (legacy?) open import Common.Equality data Prod (A B : Set) : Set where pair : A → B → Prod A B {-# ETA Prod #-} -- The ETA pragma does not exist anymore. fst : {A B : Set} → Prod A B → A fst (pair a b) = a snd : {A B : Set} → Prod A B → B snd (pair a b) = b -- Just an illusion... test : {A B : Set} (x : Prod A B) → x ≡ pair (fst x) (snd x) test x = refl
{ "alphanum_fraction": 0.580952381, "avg_line_length": 20, "ext": "agda", "hexsha": "e98d86facb292fed6240af528b4493bcc4450e97", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_path": "test/Fail/EtaData.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "shlevy/agda", "max_issues_repo_path": "test/Fail/EtaData.agda", "max_line_length": 63, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "shlevy/agda", "max_stars_repo_path": "test/Fail/EtaData.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 146, "size": 420 }
{-# POLARITY F #-} {-# POLARITY G #-}
{ "alphanum_fraction": 0.4736842105, "avg_line_length": 12.6666666667, "ext": "agda", "hexsha": "de4e340c596cf8f099515c29124266aa62c64351", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "222c4c64b2ccf8e0fc2498492731c15e8fef32d4", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "pthariensflame/agda", "max_forks_repo_path": "test/Fail/Unknown-names-in-polarity-pragmas.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "222c4c64b2ccf8e0fc2498492731c15e8fef32d4", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "pthariensflame/agda", "max_issues_repo_path": "test/Fail/Unknown-names-in-polarity-pragmas.agda", "max_line_length": 18, "max_stars_count": 3, "max_stars_repo_head_hexsha": "222c4c64b2ccf8e0fc2498492731c15e8fef32d4", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "pthariensflame/agda", "max_stars_repo_path": "test/Fail/Unknown-names-in-polarity-pragmas.agda", "max_stars_repo_stars_event_max_datetime": "2015-12-07T20:14:00.000Z", "max_stars_repo_stars_event_min_datetime": "2015-03-28T14:51:03.000Z", "num_tokens": 12, "size": 38 }
---------------------------------------------------------------------- -- Copyright: 2013, Jan Stolarek, Lodz University of Technology -- -- -- -- License: See LICENSE file in root of the repo -- -- Repo address: https://github.com/jstolarek/dep-typed-wbl-heaps -- -- -- -- Definition of datatypes that represent ordering and functions -- -- that operate on them. These datatypes are based on ideas -- -- introduced in "Why Dependent Types Matter". -- ---------------------------------------------------------------------- module Basics.Ordering where open import Basics.Nat hiding (_≥_) -- The ≥ type is a proof of greater-equal relation between two natural -- numbers. It proves that: a) any number natural is greater or equal -- to zero and b) any two natural numbers are in ≥ relation if their -- predecessors are also in that relation. data _≥_ : Nat → Nat → Set where ge0 : { y : Nat} → y ≥ zero geS : {x y : Nat} → x ≥ y → suc x ≥ suc y infixl 4 _≥_ -- Order datatype tells whether two numbers are in ≥ relation or -- not. In that sense it is an equivalent of Bool datatype. Unlike -- Bool however, Order supplies a proof of WHY the numbers are (or are -- not) in the ≥ relation. data Order : Nat → Nat → Set where ge : {x : Nat} {y : Nat} → x ≥ y → Order x y le : {x : Nat} {y : Nat} → y ≥ x → Order x y -- order function takes two natural numbers and compares them, -- returning the result of comparison together with a proof of the -- result (result and its proof are encoded by Order datatype). order : (a : Nat) → (b : Nat) → Order a b order a zero = ge ge0 order zero (suc b) = le ge0 order (suc a) (suc b) with order a b order (suc a) (suc b) | ge a≥b = ge (geS a≥b) order (suc a) (suc b) | le b≥a = le (geS b≥a)
{ "alphanum_fraction": 0.5514592934, "avg_line_length": 45.4186046512, "ext": "agda", "hexsha": "161d2ff2064ebad178566cf83d93d21b78bb4a4a", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "57db566cb840dc70331c29eb7bf3a0c849f8b27e", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "jstolarek/dep-typed-wbl-heaps", "max_forks_repo_path": "src/Basics/Ordering.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "57db566cb840dc70331c29eb7bf3a0c849f8b27e", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "jstolarek/dep-typed-wbl-heaps", "max_issues_repo_path": "src/Basics/Ordering.agda", "max_line_length": 70, "max_stars_count": 1, "max_stars_repo_head_hexsha": "57db566cb840dc70331c29eb7bf3a0c849f8b27e", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "jstolarek/dep-typed-wbl-heaps", "max_stars_repo_path": "src/Basics/Ordering.agda", "max_stars_repo_stars_event_max_datetime": "2018-05-02T21:48:43.000Z", "max_stars_repo_stars_event_min_datetime": "2018-05-02T21:48:43.000Z", "num_tokens": 493, "size": 1953 }
module Numeral.Natural.Oper.Comparisons where import Lvl open import Data.Boolean import Data.Boolean.Operators open Data.Boolean.Operators.Programming open import Numeral.Natural open import Numeral.Sign ℕbool : Bool → ℕ ℕbool = if_then 1 else 0 -- Compare _⋚?_ : ℕ → ℕ → (−|0|+) 𝟎 ⋚? 𝟎 = 𝟎 𝟎 ⋚? 𝐒(b) = ➖ 𝐒(a) ⋚? 𝟎 = ➕ 𝐒(a) ⋚? 𝐒(b) = a ⋚? b -- Equality check _≡?_ : ℕ → ℕ → Bool a ≡? b = elim₃ 𝐹 𝑇 𝐹 (a ⋚? b) {-# BUILTIN NATEQUALS _≡?_ #-} -- Non-equality check _≢?_ : ℕ → ℕ → Bool x ≢? y = !(x ≡? y) -- Positivity check positive? : ℕ → Bool positive? (𝟎) = 𝐹 positive? (𝐒(_)) = 𝑇 -- Zero check zero? : ℕ → Bool zero? n = !(positive? n) -- Lesser-than check _<?_ : ℕ → ℕ → Bool _ <? 𝟎 = 𝐹 𝟎 <? 𝐒(_) = 𝑇 𝐒(x) <? 𝐒(y) = (x <? y) {-# BUILTIN NATLESS _<?_ #-} -- Lesser-than or equals check _≤?_ : ℕ → ℕ → Bool x ≤? y = x <? 𝐒(y) -- Greater-than check _>?_ : ℕ → ℕ → Bool x >? y = y <? x -- Greater-than or equals check _≥?_ : ℕ → ℕ → Bool x ≥? y = y ≤? x
{ "alphanum_fraction": 0.5402985075, "avg_line_length": 17.9464285714, "ext": "agda", "hexsha": "1b37b597b4ab15bf65213df7b0ef5089995655eb", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_path": "Numeral/Natural/Oper/Comparisons.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_path": "Numeral/Natural/Oper/Comparisons.agda", "max_line_length": 46, "max_stars_count": 6, "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_path": "Numeral/Natural/Oper/Comparisons.agda", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "num_tokens": 463, "size": 1005 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Properties satisfied by preorders ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} open import Relation.Binary module Relation.Binary.Properties.Preorder {p₁ p₂ p₃} (P : Preorder p₁ p₂ p₃) where open import Function open import Data.Product as Prod open Relation.Binary.Preorder P -- The inverse relation is also a preorder. invIsPreorder : IsPreorder _≈_ (flip _∼_) invIsPreorder = record { isEquivalence = isEquivalence ; reflexive = reflexive ∘ Eq.sym ; trans = flip trans } invPreorder : Preorder p₁ p₂ p₃ invPreorder = record { isPreorder = invIsPreorder } ------------------------------------------------------------------------ -- For every preorder there is an induced equivalence InducedEquivalence : Setoid _ _ InducedEquivalence = record { _≈_ = λ x y → x ∼ y × y ∼ x ; isEquivalence = record { refl = (refl , refl) ; sym = swap ; trans = Prod.zip trans (flip trans) } }
{ "alphanum_fraction": 0.5414069457, "avg_line_length": 26.1162790698, "ext": "agda", "hexsha": "0ea50eb6b8a72066b86a7ef6eef57811e94d5402", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/Properties/Preorder.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/Properties/Preorder.agda", "max_line_length": 72, "max_stars_count": null, "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Relation/Binary/Properties/Preorder.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 269, "size": 1123 }
module Data.List.Functions.Multi where import Lvl open import Data open import Data.List open import Data.List.Functions hiding (separate) open import Data.Option open import Data.Tuple open import Data.Tuple.Raise import Data.Tuple.Raiseᵣ.Functions as Raise open import Numeral.Finite open import Numeral.Natural open import Numeral.Natural.Oper.Modulo open import Type private variable ℓ : Lvl.Level private variable T : Type{ℓ} -- TODO: Also called zip in other languages -- module _ where -- open import Data.Tuple.Raise as Tuple using (_^_) -- open import Function.Multi as Multi using (_⇉_) --map₊ : ∀{n}{As : Type{ℓ} ^ n}{B} → (As ⇉ B) → (Tuple.map List(As) ⇉ List(B)) -- map₊ {n = 𝟎} = const ∅ -- map₊ {n = 𝐒(𝟎)} = map -- map₊ {n = 𝐒(𝐒(n))} _ ∅ = Multi.const ∅ -- map₊ {n = 𝐒(𝐒(n))} f (x ⊰ l) = {!!} {- separate : (n : ℕ) → List(T) → (List(T) ^ n) separate(0) _ = <> separate(1) l = l separate(𝐒(𝐒(n))) l = {!!} -- Raise.repeat (𝐒(𝐒(n))) ∅ -- (x ⊰ l) = Raise.map₂ {!skip!} {!!} (∅ , separate(𝐒(n)) l) -} -- Separates a list by a function assigning which list index it should lie in. -- Example: -- separateBy(_mod 3) [0,1,2,3,4,5,6,7,8,9] = [[0,3,6,9] , [1,4,7] , [2,5,8]] separateBy : ∀{n} → (T → 𝕟(n)) → List(T) → (List(T) ^ n) separateBy f ∅ = Raise.repeat _ ∅ separateBy f (x ⊰ l) = Raise.updateAt (f(x)) (x ⊰_) (separateBy f l)
{ "alphanum_fraction": 0.5918653576, "avg_line_length": 31.6888888889, "ext": "agda", "hexsha": "962c19608bc88aabe9c844f3295f0286873e86ba", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Lolirofle/stuff-in-agda", "max_forks_repo_path": "Data/List/Functions/Multi.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Lolirofle/stuff-in-agda", "max_issues_repo_path": "Data/List/Functions/Multi.agda", "max_line_length": 80, "max_stars_count": 6, "max_stars_repo_head_hexsha": "70f4fba849f2fd779c5aaa5af122ccb6a5b271ba", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Lolirofle/stuff-in-agda", "max_stars_repo_path": "Data/List/Functions/Multi.agda", "max_stars_repo_stars_event_max_datetime": "2022-02-05T06:53:22.000Z", "max_stars_repo_stars_event_min_datetime": "2020-04-07T17:58:13.000Z", "num_tokens": 546, "size": 1426 }
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import homotopy.SuspSmash module homotopy.SuspSmashComm where module Σ∧Σ-PathElim {i} {j} {k} {A : Type i} {B : Type j} {C : Type k} (f g : ⊙Susp A ∧ ⊙Susp B → C) (n-n : f (smin north north) == g (smin north north)) (n-s : f (smin north south) == g (smin north south)) (s-n : f (smin south north) == g (smin south north)) (s-s : f (smin south south) == g (smin south south)) (n-m : ∀ b → Square n-n (ap (λ sb → f (smin north sb)) (merid b)) (ap (λ sb → g (smin north sb)) (merid b)) n-s) (s-m : ∀ b → Square s-n (ap (λ sb → f (smin south sb)) (merid b)) (ap (λ sb → g (smin south sb)) (merid b)) s-s) (m-n : ∀ a → Square n-n (ap (λ sa → f (smin sa north)) (merid a)) (ap (λ sa → g (smin sa north)) (merid a)) s-n) (m-s : ∀ a → Square n-s (ap (λ sa → f (smin sa south)) (merid a)) (ap (λ sa → g (smin sa south)) (merid a)) s-s) (m-m : ∀ a b → Cube (m-n a) (m-s a) (n-m b) (natural-square (λ sb → ap (λ sa → f (smin sa sb)) (merid a)) (merid b)) (natural-square (λ sb → ap (λ sa → g (smin sa sb)) (merid a)) (merid b)) (s-m b)) (basel : f smbasel == g smbasel) (baser : f smbaser == g smbaser) (gluel-north : Square n-n (ap f (smgluel north)) (ap g (smgluel north)) basel) (gluel-south : Square s-n (ap f (smgluel south)) (ap g (smgluel south)) basel) (gluel-merid : ∀ a → Cube gluel-north gluel-south (m-n a) (natural-square (λ sa → ap f (smgluel sa)) (merid a)) (natural-square (λ sa → ap g (smgluel sa)) (merid a)) (natural-square (λ sa → basel) (merid a))) (gluer-north : Square n-n (ap f (smgluer north)) (ap g (smgluer north)) baser) (gluer-south : Square n-s (ap f (smgluer south)) (ap g (smgluer south)) baser) (gluer-merid : ∀ b → Cube gluer-north gluer-south (n-m b) (natural-square (λ a → ap f (smgluer a)) (merid b)) (natural-square (λ a → ap g (smgluer a)) (merid b)) (natural-square (λ a → baser) (merid b)) ) where private module M = SuspDoublePathElim (λ sa sb → f (smin sa sb)) (λ sa sb → g (smin sa sb)) n-n n-s s-n s-s n-m s-m m-n m-s m-m module P = SmashElim {P = λ sa∧sb → f sa∧sb == g sa∧sb} M.p basel baser (λ sa → ↓-='-from-square $ Susp-elim {P = λ sa → Square (M.p sa north) (ap f (smgluel sa)) (ap g (smgluel sa)) basel} gluel-north gluel-south (λ a → cube-to-↓-square $ cube-shift-back (! (M.merid-north-square-β a)) $ gluel-merid a) sa) (λ sb → ↓-='-from-square $ Susp-elim {P = λ sb → Square (M.p north sb) (ap f (smgluer sb)) (ap g (smgluer sb)) baser} gluer-north gluer-south (λ b → cube-to-↓-square $ cube-shift-back (! (M.north-merid-square-β b)) $ gluer-merid b) sb) open P using (f) public module _ {i j} (X : Ptd i) (Y : Ptd j) where private f : ⊙Susp (de⊙ X) ∧ ⊙Susp (de⊙ Y) → Susp (Susp (X ∧ Y)) f = Susp-fmap (∧Σ-out X Y) ∘ Σ∧-out X (⊙Susp (de⊙ Y)) g : ⊙Susp (de⊙ X) ∧ ⊙Susp (de⊙ Y) → Susp (Susp (X ∧ Y)) g = Susp-flip ∘ Susp-fmap (Σ∧-out X Y) ∘ ∧Σ-out (⊙Susp (de⊙ X)) Y f-merid-x : ∀ x sy → ap (λ sx → f (smin sx sy)) (merid x) =-= merid (Susp-fmap (smin x) sy) f-merid-x x sy = ap (Susp-fmap (∧Σ-out X Y) ∘ Susp-fmap (λ x' → smin x' sy)) (merid x) =⟪ ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' sy)) (merid x) ⟫ ap (Susp-fmap (∧Σ-out X Y)) (ap (Susp-fmap (λ x' → smin x' sy)) (merid x)) =⟪ ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' sy) x) ⟫ ap (Susp-fmap (∧Σ-out X Y)) (merid (smin x sy)) =⟪ SuspFmap.merid-β (∧Σ-out X Y) (smin x sy) ⟫ merid (Susp-fmap (smin x) sy) ∎∎ g-merid-y : ∀ sx y → ap (g ∘ smin sx) (merid y) =-= ! (merid (Susp-fmap (λ x' → smin x' y) sx)) g-merid-y sx y = ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y) ∘ Susp-fmap (smin sx)) (merid y) =⟪ ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin sx)) (merid y) ⟫ ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (ap (Susp-fmap (smin sx)) (merid y)) =⟪ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin sx) y) ⟫ ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin sx y)) =⟪ ap-∘ Susp-flip (Susp-fmap (Σ∧-out X Y)) (merid (smin sx y)) ⟫ ap Susp-flip (ap (Susp-fmap (Σ∧-out X Y)) (merid (smin sx y))) =⟪ ap (ap Susp-flip) (SuspFmap.merid-β (Σ∧-out X Y) (smin sx y)) ⟫ ap Susp-flip (merid (Susp-fmap (λ x' → smin x' y) sx)) =⟪ SuspFlip.merid-β (Susp-fmap (λ x' → smin x' y) sx) ⟫ ! (merid (Susp-fmap (λ x' → smin x' y) sx)) ∎∎ n-n : f (smin north north) == g (smin north north) n-n = merid north n-s : f (smin north south) == g (smin north south) n-s = idp s-n : f (smin south north) == g (smin south north) s-n = idp s-s : f (smin south south) == g (smin south south) s-s = ! (merid south) n-m : ∀ y → Square n-n (ap (f ∘ smin north) (merid y)) (ap (g ∘ smin north) (merid y)) n-s n-m y = ap-cst north (merid y) ∙v⊡ (lb-square (merid north) ⊡v∙ ! (↯ (g-merid-y north y))) s-m : ∀ y → Square s-n (ap (f ∘ smin south) (merid y)) (ap (g ∘ smin south) (merid y)) s-s s-m y = ap-cst south (merid y) ∙v⊡ br-square (! (merid south)) ⊡v∙ ! (↯ (g-merid-y south y)) m-n : ∀ x → Square n-n (ap (λ sx → f (smin sx north)) (merid x)) (ap (λ sx → g (smin sx north)) (merid x)) s-n m-n x = ↯ (f-merid-x x north) ∙v⊡ (lt-square (merid north) ⊡v∙ ! (ap-cst south (merid x))) m-s : ∀ x → Square n-s (ap (λ sx → f (smin sx south)) (merid x)) (ap (λ sx → g (smin sx south)) (merid x)) s-s m-s x = ↯ (f-merid-x x south) ∙v⊡ (tr-square (merid south) ⊡v∙ ! (ap-cst north (merid x))) m-m : ∀ x y → Cube (m-n x) (m-s x) (n-m y) (natural-square (λ sy → ap (λ sx → f (smin sx sy)) (merid x)) (merid y)) (natural-square (λ sy → ap (λ sx → g (smin sx sy)) (merid x)) (merid y)) (s-m y) m-m x y = custom-cube-∙v⊡ (↯ (f-merid-x x north)) (↯ (f-merid-x x south)) (ap-cst north (merid y)) (ap-cst south (merid y)) $ cube-shift-top (! top-path) $ custom-cube-⊡v∙ (! (ap-cst south (merid x))) (ap-cst north (merid x)) (! (↯ (g-merid-y north y))) (↯ (g-merid-y south y)) $ cube-shift-bot (! bot-path) $ custom-cube (merid north) (merid south) (ap merid (merid (smin x y))) where custom-cube-∙v⊡ : ∀ {i} {A : Type i} {a₀₀₀ a₀₁₀ a₁₀₀ a₁₁₀ a₀₀₁ a₀₁₁ a₁₀₁ a₁₁₁ : A} {p₀₋₀ : a₀₀₀ == a₀₁₀} {p₋₀₀ p₋₀₀' : a₀₀₀ == a₁₀₀} (q₋₀₀ : p₋₀₀ == p₋₀₀') {p₋₁₀ : a₀₁₀ == a₁₁₀} {p₁₋₀ : a₁₀₀ == a₁₁₀} {sq₋₋₀ : Square p₀₋₀ p₋₀₀' p₋₁₀ p₁₋₀} -- left {p₀₋₁ : a₀₀₁ == a₀₁₁} {p₋₀₁ p₋₀₁' : a₀₀₁ == a₁₀₁} (q₋₀₁ : p₋₀₁ == p₋₀₁') {p₋₁₁ : a₀₁₁ == a₁₁₁} {p₁₋₁ : a₁₀₁ == a₁₁₁} {sq₋₋₁ : Square p₀₋₁ p₋₀₁' p₋₁₁ p₁₋₁} -- right {p₀₀₋ p₀₀₋' : a₀₀₀ == a₀₀₁} (q₀₀₋ : p₀₀₋ == p₀₀₋') {p₀₁₋ : a₀₁₀ == a₀₁₁} {p₁₀₋ p₁₀₋' : a₁₀₀ == a₁₀₁} (q₁₀₋ : p₁₀₋ == p₁₀₋') {p₁₁₋ : a₁₁₀ == a₁₁₁} {sq₀₋₋ : Square p₀₋₀ p₀₀₋' p₀₁₋ p₀₋₁} -- back {sq₋₀₋ : Square p₋₀₀ p₀₀₋ p₁₀₋ p₋₀₁} -- top {sq₋₁₋ : Square p₋₁₀ p₀₁₋ p₁₁₋ p₋₁₁} -- bottom {sq₁₋₋ : Square p₁₋₀ p₁₀₋' p₁₁₋ p₁₋₁} -- front → Cube sq₋₋₀ sq₋₋₁ sq₀₋₋ (! q₀₀₋ ∙v⊡ (! q₋₀₀ ∙h⊡ sq₋₀₋ ⊡h∙ q₋₀₁) ⊡v∙ q₁₀₋) sq₋₁₋ sq₁₋₋ → Cube (q₋₀₀ ∙v⊡ sq₋₋₀) (q₋₀₁ ∙v⊡ sq₋₋₁) (q₀₀₋ ∙v⊡ sq₀₋₋) sq₋₀₋ sq₋₁₋ (q₁₀₋ ∙v⊡ sq₁₋₋) custom-cube-∙v⊡ idp idp idp idp c = c custom-cube-⊡v∙ : ∀ {i} {A : Type i} {a₀₀₀ a₀₁₀ a₁₀₀ a₁₁₀ a₀₀₁ a₀₁₁ a₁₀₁ a₁₁₁ : A} {p₀₋₀ : a₀₀₀ == a₀₁₀} {p₋₀₀ : a₀₀₀ == a₁₀₀} {p₋₁₀ p₋₁₀' : a₀₁₀ == a₁₁₀} (q₋₁₀ : p₋₁₀ == p₋₁₀') {p₁₋₀ : a₁₀₀ == a₁₁₀} {sq₋₋₀ : Square p₀₋₀ p₋₀₀ p₋₁₀ p₁₋₀} -- left {p₀₋₁ : a₀₀₁ == a₀₁₁} {p₋₀₁ : a₀₀₁ == a₁₀₁} {p₋₁₁ p₋₁₁' : a₀₁₁ == a₁₁₁} (q₋₁₁ : p₋₁₁' == p₋₁₁) {p₁₋₁ : a₁₀₁ == a₁₁₁} {sq₋₋₁ : Square p₀₋₁ p₋₀₁ p₋₁₁ p₁₋₁} -- right {p₀₀₋ : a₀₀₀ == a₀₀₁} {p₀₁₋ p₀₁₋' : a₀₁₀ == a₀₁₁} (q₀₁₋ : p₀₁₋ == p₀₁₋') {p₁₀₋ : a₁₀₀ == a₁₀₁} {p₁₁₋ p₁₁₋' : a₁₁₀ == a₁₁₁} (q₁₁₋ : p₁₁₋' == p₁₁₋) {sq₀₋₋ : Square p₀₋₀ p₀₀₋ p₀₁₋ p₀₋₁} -- back {sq₋₀₋ : Square p₋₀₀ p₀₀₋ p₁₀₋ p₋₀₁} -- top {sq₋₁₋ : Square p₋₁₀' p₀₁₋' p₁₁₋' p₋₁₁'} -- bottom {sq₁₋₋ : Square p₁₋₀ p₁₀₋ p₁₁₋ p₁₋₁} -- front → Cube sq₋₋₀ sq₋₋₁ sq₀₋₋ sq₋₀₋ (square-symmetry (q₋₁₀ ∙v⊡ (q₀₁₋ ∙h⊡ square-symmetry sq₋₁₋ ⊡h∙ q₁₁₋) ⊡v∙ q₋₁₁)) sq₁₋₋ → Cube (sq₋₋₀ ⊡v∙ q₋₁₀) (sq₋₋₁ ⊡v∙ ! q₋₁₁) (sq₀₋₋ ⊡v∙ q₀₁₋) sq₋₀₋ sq₋₁₋ (sq₁₋₋ ⊡v∙ ! q₁₁₋) custom-cube-⊡v∙ idp idp idp idp {sq₋₁₋ = sq₋₁₋} c = cube-shift-bot (square-sym-inv sq₋₁₋) c custom-cube : ∀ {i} {S : Type i} {n s : S} (p q : n == s) (r : p == q) → Cube (lt-square p) (tr-square q) (lb-square p) (horiz-degen-square r) (vert-degen-square (ap ! r)) (br-square (! q)) custom-cube p@idp [email protected] r@idp = idc top-path : ! (ap-cst north (merid y)) ∙v⊡ (! (↯ (f-merid-x x north)) ∙h⊡ natural-square (λ sy → ap (λ sx → f (smin sx sy)) (merid x)) (merid y) ⊡h∙ ↯ (f-merid-x x south)) ⊡v∙ ap-cst south (merid y) == horiz-degen-square (ap merid (merid (smin x y))) top-path = ! (ap-cst north (merid y)) ∙v⊡ (! (↯ (f-merid-x x north)) ∙h⊡ natural-square (λ sy → ap (λ sx → f (smin sx sy)) (merid x)) (merid y) ⊡h∙ ↯ (f-merid-x x south)) ⊡v∙ ap-cst south (merid y) =⟨ ap (λ u → ! (ap-cst north (merid y)) ∙v⊡ u ⊡v∙ ap-cst south (merid y)) $ natural-square-path (λ sy → merid (Susp-fmap (smin x) sy)) (λ sy → ap (λ sx → f (smin sx sy)) (merid x)) (λ sy → ↯ (f-merid-x x sy)) (merid y) ⟩ ! (ap-cst north (merid y)) ∙v⊡ natural-square (λ sy → merid (Susp-fmap (smin x) sy)) (merid y) ⊡v∙ ap-cst south (merid y) =⟨ natural-square-cst north south (λ sy → merid (Susp-fmap (smin x) sy)) (merid y) ⟩ horiz-degen-square (ap (merid ∘ Susp-fmap (smin x)) (merid y)) =⟨ ap horiz-degen-square (ap-∘ merid (Susp-fmap (smin x)) (merid y)) ⟩ horiz-degen-square (ap merid (ap (Susp-fmap (smin x)) (merid y))) =⟨ ap (horiz-degen-square ∘ ap merid) (SuspFmap.merid-β (smin x) y) ⟩ horiz-degen-square (ap merid (merid (smin x y))) =∎ bot-path : square-symmetry (! (ap-cst south (merid x)) ∙v⊡ (! (↯ (g-merid-y north y)) ∙h⊡ square-symmetry (natural-square (λ sy → ap (λ sx → g (smin sx sy)) (merid x)) (merid y)) ⊡h∙ ↯ (g-merid-y south y)) ⊡v∙ ap-cst north (merid x)) == vert-degen-square (ap ! (ap merid (merid (smin x y)))) bot-path = square-symmetry (! (ap-cst south (merid x)) ∙v⊡ (! (↯ (g-merid-y north y)) ∙h⊡ square-symmetry (natural-square (λ sy → ap (λ sx → g (smin sx sy)) (merid x)) (merid y)) ⊡h∙ ↯ (g-merid-y south y)) ⊡v∙ ap-cst north (merid x)) =⟨ ap (λ u → square-symmetry (! (ap-cst south (merid x)) ∙v⊡ (! (↯ (g-merid-y north y)) ∙h⊡ u ⊡h∙ ↯ (g-merid-y south y)) ⊡v∙ ap-cst north (merid x))) $ natural-square-symmetry (λ sx sy → g (smin sx sy)) (merid x) (merid y) ⟩ square-symmetry (! (ap-cst south (merid x)) ∙v⊡ (! (↯ (g-merid-y north y)) ∙h⊡ natural-square (λ sx → ap (g ∘ smin sx) (merid y)) (merid x) ⊡h∙ ↯ (g-merid-y south y)) ⊡v∙ ap-cst north (merid x)) =⟨ ap (λ u → square-symmetry (! (ap-cst south (merid x)) ∙v⊡ u ⊡v∙ ap-cst north (merid x))) $ natural-square-path (λ sx → ! (merid (Susp-fmap (λ x' → smin x' y) sx))) (λ sx → ap (g ∘ smin sx) (merid y)) (λ sx → ↯ (g-merid-y sx y)) (merid x) ⟩ square-symmetry (! (ap-cst south (merid x)) ∙v⊡ natural-square (λ sx → ! (merid (Susp-fmap (λ x' → smin x' y) sx))) (merid x) ⊡v∙ ap-cst north (merid x)) =⟨ ap square-symmetry $ natural-square-cst south north (λ sx → ! (merid (Susp-fmap (λ x' → smin x' y) sx))) (merid x) ⟩ square-symmetry (horiz-degen-square (ap (λ sx → ! (merid (Susp-fmap (λ x' → smin x' y) sx))) (merid x))) =⟨ horiz-degen-square-symmetry (ap (λ sx → ! (merid (Susp-fmap (λ x' → smin x' y) sx))) (merid x)) ⟩ vert-degen-square (ap (! ∘ merid ∘ Susp-fmap (λ x' → smin x' y)) (merid x)) =⟨ ap vert-degen-square (ap-∘ (! ∘ merid) (Susp-fmap (λ x' → smin x' y)) (merid x)) ⟩ vert-degen-square (ap (! ∘ merid) (ap (Susp-fmap (λ x' → smin x' y)) (merid x))) =⟨ ap (vert-degen-square ∘ ap (! ∘ merid)) (SuspFmap.merid-β (λ x' → smin x' y) x) ⟩ vert-degen-square (ap (! ∘ merid) (merid (smin x y))) =⟨ ap vert-degen-square (ap-∘ ! merid (merid (smin x y))) ⟩ vert-degen-square (ap ! (ap merid (merid (smin x y)))) =∎ basel : f smbasel == g smbasel basel = merid north baser : f smbaser == g smbaser baser = merid north f-smgluel : ∀ sx → ap f (smgluel sx) == ap (Susp-fmap (∧Σ-out X Y)) (Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y)) sx) f-smgluel sx = ap f (smgluel sx) =⟨ ap-∘ (Susp-fmap (∧Σ-out X Y)) (Σ∧-out X (⊙Susp (de⊙ Y))) (smgluel sx) ⟩ ap (Susp-fmap (∧Σ-out X Y)) (ap (Σ∧-out X (⊙Susp (de⊙ Y))) (smgluel sx)) =⟨ ap (ap (Susp-fmap (∧Σ-out X Y))) (Σ∧Out.smgluel-β X (⊙Susp (de⊙ Y)) sx) ⟩ ap (Susp-fmap (∧Σ-out X Y)) (Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y)) sx) =∎ f-smgluel-north : ap f (smgluel north) == idp f-smgluel-north = f-smgluel north f-smgluel-south : ap f (smgluel south) =-= ! (merid north) f-smgluel-south = ap f (smgluel south) =⟪ f-smgluel south ⟫ ap (Susp-fmap (∧Σ-out X Y)) (! (merid (smin (pt X) north))) =⟪ ap-! (Susp-fmap (∧Σ-out X Y)) (merid (smin (pt X) north)) ⟫ ! (ap (Susp-fmap (∧Σ-out X Y)) (merid (smin (pt X) north))) =⟪ ap ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) ⟫ ! (merid north) ∎∎ g-smgluel : ∀ sx → ap g (smgluel sx) == idp g-smgluel sx = ap g (smgluel sx) =⟨ ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (∧Σ-out (⊙Susp (de⊙ X)) Y) (smgluel sx) ⟩ ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (ap (∧Σ-out (⊙Susp (de⊙ X)) Y) (smgluel sx)) =⟨ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (∧ΣOut.smgluel-β (⊙Susp (de⊙ X)) Y sx) ⟩ idp =∎ smgluel-north : Square n-n (ap f (smgluel north)) (ap g (smgluel north)) basel smgluel-north = f-smgluel-north ∙v⊡ hid-square ⊡v∙ ! (g-smgluel north) smgluel-south : Square s-n (ap f (smgluel south)) (ap g (smgluel south)) basel smgluel-south = ↯ f-smgluel-south ∙v⊡ rt-square (merid north) ⊡v∙ ! (g-smgluel south) custom-cube-⊡v∙ : ∀ {i} {A : Type i} {a₀₀₀ a₀₁₀ a₁₀₀ a₁₁₀ a₀₀₁ a₀₁₁ a₁₀₁ a₁₁₁ : A} {p₀₋₀ : a₀₀₀ == a₀₁₀} {p₋₀₀ : a₀₀₀ == a₁₀₀} {p₋₁₀ p₋₁₀' : a₀₁₀ == a₁₁₀} (q₋₁₀ : p₋₁₀ == p₋₁₀') {p₁₋₀ : a₁₀₀ == a₁₁₀} {sq₋₋₀ : Square p₀₋₀ p₋₀₀ p₋₁₀ p₁₋₀} -- left {p₀₋₁ : a₀₀₁ == a₀₁₁} {p₋₀₁ : a₀₀₁ == a₁₀₁} {p₋₁₁ p₋₁₁' : a₀₁₁ == a₁₁₁} (q₋₁₁ : p₋₁₁' == p₋₁₁) {p₁₋₁ : a₁₀₁ == a₁₁₁} {sq₋₋₁ : Square p₀₋₁ p₋₀₁ p₋₁₁ p₁₋₁} -- right {p₀₀₋ : a₀₀₀ == a₀₀₁} {p₀₁₋ p₀₁₋' : a₀₁₀ == a₀₁₁} (q₀₁₋ : p₀₁₋ == p₀₁₋') {p₁₀₋ : a₁₀₀ == a₁₀₁} {p₁₁₋ p₁₁₋' : a₁₁₀ == a₁₁₁} (q₁₁₋ : p₁₁₋ == p₁₁₋') {sq₀₋₋ : Square p₀₋₀ p₀₀₋ p₀₁₋ p₀₋₁} -- back {sq₋₀₋ : Square p₋₀₀ p₀₀₋ p₁₀₋ p₋₀₁} -- top {sq₋₁₋ : Square p₋₁₀' p₀₁₋' p₁₁₋ p₋₁₁'} -- bottom {sq₁₋₋ : Square p₁₋₀ p₁₀₋ p₁₁₋ p₁₋₁} -- front → Cube sq₋₋₀ sq₋₋₁ sq₀₋₋ sq₋₀₋ (q₀₁₋ ∙v⊡ (q₋₁₀ ∙h⊡ sq₋₁₋ ⊡h∙ q₋₁₁) ⊡v∙ q₁₁₋) (sq₁₋₋ ⊡v∙ q₁₁₋) → Cube (sq₋₋₀ ⊡v∙ q₋₁₀) (sq₋₋₁ ⊡v∙ ! q₋₁₁) (sq₀₋₋ ⊡v∙ q₀₁₋) sq₋₀₋ sq₋₁₋ sq₁₋₋ custom-cube-⊡v∙ idp idp idp idp c = c smgluel-merid : ∀ x → Cube smgluel-north smgluel-south (m-n x) (natural-square (λ sx → ap f (smgluel sx)) (merid x)) (natural-square (λ sx → ap g (smgluel sx)) (merid x)) (natural-square (λ sx → basel) (merid x)) smgluel-merid x = custom-cube-∙v⊡ f-smgluel-north (f-smgluel south) (↯ (tail f-smgluel-south)) (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) (↯ (tail (f-merid-x x north))) (ap-cst north (merid x)) $ cube-shift-top (! (top-path x)) $ custom-cube-⊡v∙ (! (g-smgluel north)) (g-smgluel south) (! (ap-cst south (merid x))) (ap-cst south (merid x)) $ cube-shift-front (! (front-path x)) $ cube-shift-bot (! (bot-path x)) $ custom-cube (merid north) where custom-cube-∙v⊡ : ∀ {i} {A : Type i} {a₀₀₀ a₀₁₀ a₁₀₀ a₁₁₀ a₀₀₁ a₀₁₁ a₁₀₁ a₁₁₁ : A} {p₀₋₀ : a₀₀₀ == a₀₁₀} {p₋₀₀ p₋₀₀' : a₀₀₀ == a₁₀₀} (q₋₀₀ : p₋₀₀ == p₋₀₀') {p₋₁₀ : a₀₁₀ == a₁₁₀} {p₁₋₀ : a₁₀₀ == a₁₁₀} {sq₋₋₀ : Square p₀₋₀ p₋₀₀' p₋₁₀ p₁₋₀} -- left {p₀₋₁ : a₀₀₁ == a₀₁₁} {p₋₀₁ p₋₀₁' p₋₀₁'' : a₀₀₁ == a₁₀₁} (q₋₀₁ : p₋₀₁ == p₋₀₁') (q₋₀₁' : p₋₀₁' == p₋₀₁'') {p₋₁₁ : a₀₁₁ == a₁₁₁} {p₁₋₁ : a₁₀₁ == a₁₁₁} {sq₋₋₁ : Square p₀₋₁ p₋₀₁'' p₋₁₁ p₁₋₁} -- right {p₀₀₋ p₀₀₋' p₀₀₋'' : a₀₀₀ == a₀₀₁} (q₀₀₋ : p₀₀₋ == p₀₀₋') (q₀₀₋' : p₀₀₋' == p₀₀₋'') {p₀₁₋ : a₀₁₀ == a₀₁₁} {p₁₀₋ p₁₀₋' : a₁₀₀ == a₁₀₁} (q₁₀₋ : p₁₀₋ == p₁₀₋') {p₁₁₋ : a₁₁₀ == a₁₁₁} {sq₀₋₋ : Square p₀₋₀ p₀₀₋'' p₀₁₋ p₀₋₁} -- back {sq₋₀₋ : Square p₋₀₀ p₀₀₋ p₁₀₋ p₋₀₁} -- top {sq₋₁₋ : Square p₋₁₀ p₀₁₋ p₁₁₋ p₋₁₁} -- bottom {sq₁₋₋ : Square p₁₋₀ p₁₀₋ p₁₁₋ p₁₋₁} -- front → Cube sq₋₋₀ sq₋₋₁ sq₀₋₋ ((! q₀₀₋' ∙v⊡ (! q₀₀₋ ∙v⊡ (! q₋₀₀ ∙h⊡ sq₋₀₋ ⊡h∙ q₋₀₁)) ⊡v∙ q₁₀₋) ⊡h∙ q₋₀₁') sq₋₁₋ (! q₁₀₋ ∙v⊡ sq₁₋₋) → Cube (q₋₀₀ ∙v⊡ sq₋₋₀) ((q₋₀₁ ∙ q₋₀₁') ∙v⊡ sq₋₋₁) ((q₀₀₋ ∙ q₀₀₋') ∙v⊡ sq₀₋₋) sq₋₀₋ sq₋₁₋ sq₁₋₋ custom-cube-∙v⊡ idp idp idp idp idp idp c = c custom-cube : ∀ {i} {S : Type i} {n s : S} (p : n == s) → Cube hid-square (rt-square p) (lt-square p) (tr-square p) ids hid-square custom-cube p@idp = idc top-path : ∀ x → (! (↯ (tail (f-merid-x x north))) ∙v⊡ (! (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) ∙v⊡ (! f-smgluel-north ∙h⊡ natural-square (λ sx → ap f (smgluel sx)) (merid x) ⊡h∙ f-smgluel south)) ⊡v∙ ap-cst north (merid x)) ⊡h∙ ↯ (tail f-smgluel-south) == tr-square (merid north) top-path x = (! (↯ (tail (f-merid-x x north))) ∙v⊡ (! (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) ∙v⊡ (! f-smgluel-north ∙h⊡ natural-square (λ sx → ap f (smgluel sx)) (merid x) ⊡h∙ f-smgluel south)) ⊡v∙ ap-cst north (merid x)) ⊡h∙ ↯ (tail f-smgluel-south) =⟨ ap (λ u → (! (↯ (tail (f-merid-x x north))) ∙v⊡ (! (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) ∙v⊡ u) ⊡v∙ ap-cst north (merid x)) ⊡h∙ ↯ (tail f-smgluel-south)) $ natural-square-path (ap (Susp-fmap (∧Σ-out X Y)) ∘ Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (λ sx → ap f (smgluel sx)) f-smgluel (merid x) ⟩ (! (↯ (tail (f-merid-x x north))) ∙v⊡ (! (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) ∙v⊡ natural-square (ap (Susp-fmap (∧Σ-out X Y)) ∘ Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (merid x)) ⊡v∙ ap-cst north (merid x)) ⊡h∙ ↯ (tail f-smgluel-south) =⟨ ap (λ v → (! (↯ (tail (f-merid-x x north))) ∙v⊡ v ⊡v∙ ap-cst north (merid x)) ⊡h∙ ↯ (tail f-smgluel-south)) $ ! (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) ∙v⊡ natural-square (ap (Susp-fmap (∧Σ-out X Y)) ∘ Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (merid x) =⟨ ap (! (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) ∙v⊡_) $ natural-square-ap (Susp-fmap (∧Σ-out X Y)) (Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (merid x) ⟩ ! (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) ∙v⊡ ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x) ∙v⊡ ap-square (Susp-fmap (∧Σ-out X Y)) (natural-square (Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (merid x)) ⊡v∙ ∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x) =⟨ ! $ ∙v⊡-assoc (! (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x))) (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) (ap-square (Susp-fmap (∧Σ-out X Y)) (natural-square (Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (merid x)) ⊡v∙ ∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x)) ⟩ (! (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) ∙ ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) ∙v⊡ ap-square (Susp-fmap (∧Σ-out X Y)) (natural-square (Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (merid x)) ⊡v∙ ∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x) =⟨ ap (_∙v⊡ ap-square (Susp-fmap (∧Σ-out X Y)) (natural-square (Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (merid x)) ⊡v∙ ∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x)) $ !-inv-l (ap-∘ (Susp-fmap (∧Σ-out X Y)) (Susp-fmap (λ x' → smin x' north)) (merid x)) ⟩ ap-square (Susp-fmap (∧Σ-out X Y)) (natural-square (Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (merid x)) ⊡v∙ ∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x) =∎ ⟩ (! (↯ (tail (f-merid-x x north))) ∙v⊡ (ap-square (Susp-fmap (∧Σ-out X Y)) (natural-square (Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (merid x)) ⊡v∙ ∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x)) ⊡v∙ ap-cst north (merid x)) ⊡h∙ ↯ (tail f-smgluel-south) =⟨ ap (λ u → (! (↯ (tail (f-merid-x x north))) ∙v⊡ u) ⊡h∙ ↯ (tail f-smgluel-south)) $ (ap-square (Susp-fmap (∧Σ-out X Y)) (natural-square (Σ∧OutSmgluel.f X (⊙Susp (de⊙ Y))) (merid x)) ⊡v∙ ∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x)) ⊡v∙ ap-cst north (merid x) =⟨ ap (λ u → (ap-square (Susp-fmap (∧Σ-out X Y)) u ⊡v∙ ∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x)) ⊡v∙ ap-cst north (merid x)) $ Σ∧OutSmgluel.merid-square-β X (⊙Susp (de⊙ Y)) x ⟩ (ap-square (Susp-fmap (∧Σ-out X Y)) (Σ∧-out-smgluel-merid X (⊙Susp (de⊙ Y)) x) ⊡v∙ ∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x)) ⊡v∙ ap-cst north (merid x) =⟨ ⊡v∙-assoc (ap-square (Susp-fmap (∧Σ-out X Y)) (Σ∧-out-smgluel-merid X (⊙Susp (de⊙ Y)) x)) (∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x)) (ap-cst north (merid x)) ⟩ ap-square (Susp-fmap (∧Σ-out X Y)) (Σ∧-out-smgluel-merid X (⊙Susp (de⊙ Y)) x) ⊡v∙ (∘-ap (Susp-fmap (∧Σ-out X Y)) (λ _ → north) (merid x) ∙ ap-cst north (merid x)) =⟨ ap (ap-square (Susp-fmap (∧Σ-out X Y)) (Σ∧-out-smgluel-merid X (⊙Susp (de⊙ Y)) x) ⊡v∙_) $ =ₛ-out $ ap-∘-cst-coh (Susp-fmap (∧Σ-out X Y)) north (merid x) ⟩ ap-square (Susp-fmap (∧Σ-out X Y)) (Σ∧-out-smgluel-merid X (⊙Susp (de⊙ Y)) x) ⊡v∙ ap (ap (Susp-fmap (∧Σ-out X Y))) (ap-cst north (merid x)) =⟨ ap-square-⊡v∙ (Susp-fmap (∧Σ-out X Y)) (Σ∧-out-smgluel-merid X (⊙Susp (de⊙ Y)) x) (ap-cst north (merid x)) ⟩ ap-square (Susp-fmap (∧Σ-out X Y)) (Σ∧-out-smgluel-merid X (⊙Susp (de⊙ Y)) x ⊡v∙ ap-cst north (merid x)) =⟨ ap (ap-square (Susp-fmap (∧Σ-out X Y))) $ ⊡v∙-assoc ((SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x)) ∙v⊡ tr-square (merid (smin (pt X) north))) (! (ap-cst north (merid x))) (ap-cst north (merid x)) ⟩ ap-square (Susp-fmap (∧Σ-out X Y)) (((SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x)) ∙v⊡ tr-square (merid (smin (pt X) north))) ⊡v∙ (! (ap-cst north (merid x)) ∙ ap-cst north (merid x))) =⟨ ap (λ u → ap-square (Susp-fmap (∧Σ-out X Y)) $ ((SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x)) ∙v⊡ tr-square (merid (smin (pt X) north))) ⊡v∙ u) $ !-inv-l (ap-cst north (merid x)) ⟩ ap-square (Susp-fmap (∧Σ-out X Y)) ((SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x)) ∙v⊡ tr-square (merid (smin (pt X) north))) =⟨ ! $ ap-square-∙v⊡ (Susp-fmap (∧Σ-out X Y)) (SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x)) (tr-square (merid (smin (pt X) north))) ⟩ ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x)) ∙v⊡ ap-square (Susp-fmap (∧Σ-out X Y)) (tr-square (merid (smin (pt X) north))) =∎ ⟩ (! (↯ (tail (f-merid-x x north))) ∙v⊡ ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x)) ∙v⊡ ap-square (Susp-fmap (∧Σ-out X Y)) (tr-square (merid (smin (pt X) north)))) ⊡h∙ ↯ (tail f-smgluel-south) =⟨ ! $ ap (_⊡h∙ ↯ (tail f-smgluel-south)) $ ∙v⊡-assoc (! (↯ (tail (f-merid-x x north)))) (ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x))) (ap-square (Susp-fmap (∧Σ-out X Y)) (tr-square (merid (smin (pt X) north)))) ⟩ ((! (↯ (tail (f-merid-x x north))) ∙ ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x))) ∙v⊡ ap-square (Susp-fmap (∧Σ-out X Y)) (tr-square (merid (smin (pt X) north)))) ⊡h∙ ↯ (tail f-smgluel-south) =⟨ ap (λ u → (u ∙v⊡ ap-square (Susp-fmap (∧Σ-out X Y)) (tr-square (merid (smin (pt X) north)))) ⊡h∙ ↯ (tail f-smgluel-south)) $ =ₛ-out $ ! (↯ (tail (f-merid-x x north))) ◃∙ ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x)) ◃∎ =ₛ⟨ 0 & 1 & !-∙-seq (tail (f-merid-x x north)) ⟩ ! (SuspFmap.merid-β (∧Σ-out X Y) (smin x north)) ◃∙ ! (ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x)) ◃∙ ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x ∙ ap merid (∧-norm-l x)) ◃∎ =ₛ⟨ 2 & 1 & ap-seq-∙ (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x ◃∙ ap merid (∧-norm-l x) ◃∎) ⟩ ! (SuspFmap.merid-β (∧Σ-out X Y) (smin x north)) ◃∙ ! (ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x)) ◃∙ ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x) ◃∙ ap (ap (Susp-fmap (∧Σ-out X Y))) (ap merid (∧-norm-l x)) ◃∎ =ₛ⟨ 1 & 2 & seq-!-inv-l $ ap (ap (Susp-fmap (∧Σ-out X Y))) (SuspFmap.merid-β (λ x' → smin x' north) x) ◃∎ ⟩ ! (SuspFmap.merid-β (∧Σ-out X Y) (smin x north)) ◃∙ ap (ap (Susp-fmap (∧Σ-out X Y))) (ap merid (∧-norm-l x)) ◃∎ =ₛ₁⟨ 1 & 1 & ∘-ap (ap (Susp-fmap (∧Σ-out X Y))) merid (∧-norm-l x) ⟩ ! (SuspFmap.merid-β (∧Σ-out X Y) (smin x north)) ◃∙ ap (ap (Susp-fmap (∧Σ-out X Y)) ∘ merid) (∧-norm-l x) ◃∎ =ₛ⟨ !ₛ $ homotopy-naturality (merid ∘ ∧Σ-out X Y) (ap (Susp-fmap (∧Σ-out X Y)) ∘ merid) (! ∘ SuspFmap.merid-β (∧Σ-out X Y)) (∧-norm-l x) ⟩ ap (merid ∘ ∧Σ-out X Y) (∧-norm-l x) ◃∙ ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) ◃∎ =ₛ⟨ 0 & 1 & =ₛ-in {t = []} $ ap-∘ merid (∧Σ-out X Y) (∧-norm-l x) ∙ ap (ap merid) (∧Σ-out-∧-norm-l X Y x) ⟩ ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) ◃∎ ∎ₛ ⟩ (! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) ∙v⊡ ap-square (Susp-fmap (∧Σ-out X Y)) (tr-square (merid (smin (pt X) north)))) ⊡h∙ ↯ (tail f-smgluel-south) =⟨ ∙v⊡-⊡h∙-comm (! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north))) (ap-square (Susp-fmap (∧Σ-out X Y)) (tr-square (merid (smin (pt X) north)))) (↯ (tail f-smgluel-south)) ⟩ ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) ∙v⊡ ap-square (Susp-fmap (∧Σ-out X Y)) (tr-square (merid (smin (pt X) north))) ⊡h∙ ↯ (tail f-smgluel-south) =⟨ ! $ ap (! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) ∙v⊡_) $ ⊡h∙-assoc (ap-square (Susp-fmap (∧Σ-out X Y)) (tr-square (merid (smin (pt X) north)))) (ap-! (Susp-fmap (∧Σ-out X Y)) (merid (smin (pt X) north))) (ap ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north))) ⟩ ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) ∙v⊡ ap-square (Susp-fmap (∧Σ-out X Y)) (tr-square (merid (smin (pt X) north))) ⊡h∙ ap-! (Susp-fmap (∧Σ-out X Y)) (merid (smin (pt X) north)) ⊡h∙ ap ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) =⟨ ap (λ u → ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) ∙v⊡ u ⊡h∙ ap ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north))) $ ap-tr-square (Susp-fmap (∧Σ-out X Y)) (merid (smin (pt X) north)) ⟩ ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) ∙v⊡ tr-square (ap (Susp-fmap (∧Σ-out X Y)) (merid (smin (pt X) north))) ⊡h∙ ap ! (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) =⟨ tr-square-∙v⊡-⊡h∙ (SuspFmap.merid-β (∧Σ-out X Y) (smin (pt X) north)) ⟩ tr-square (merid north) =∎ front-path : ∀ (x : de⊙ X) → (! (ap-cst north (merid x)) ∙v⊡ natural-square (λ sx → basel) (merid x)) ⊡v∙ ap-cst south (merid x) == hid-square front-path x = (! (ap-cst north (merid x)) ∙v⊡ natural-square (λ sx → basel) (merid x)) ⊡v∙ ap-cst south (merid x) =⟨ ∙v⊡-⊡v∙-comm (! (ap-cst north (merid x))) (natural-square (λ sx → basel) (merid x)) (ap-cst south (merid x)) ⟩ ! (ap-cst north (merid x)) ∙v⊡ natural-square (λ sx → basel) (merid x) ⊡v∙ ap-cst south (merid x) =⟨ natural-square-cst north south (λ sx → basel) (merid x) ⟩ horiz-degen-square (ap (λ sx → basel) (merid x)) =⟨ ap horiz-degen-square (ap-cst basel (merid x)) ⟩ horiz-degen-square idp =⟨ horiz-degen-square-idp ⟩ hid-square =∎ bot-path : ∀ (x : de⊙ X) → ! (ap-cst south (merid x)) ∙v⊡ (! (g-smgluel north) ∙h⊡ natural-square (λ sx → ap g (smgluel sx)) (merid x) ⊡h∙ g-smgluel south) ⊡v∙ ap-cst south (merid x) == ids bot-path x = ! (ap-cst south (merid x)) ∙v⊡ (! (g-smgluel north) ∙h⊡ natural-square (λ sx → ap g (smgluel sx)) (merid x) ⊡h∙ g-smgluel south) ⊡v∙ ap-cst south (merid x) =⟨ ap (λ u → ! (ap-cst south (merid x)) ∙v⊡ u ⊡v∙ ap-cst south (merid x)) $ natural-square-path (λ sx → idp) (λ sx → ap g (smgluel sx)) g-smgluel (merid x) ⟩ ! (ap-cst south (merid x)) ∙v⊡ natural-square (λ sx → idp) (merid x) ⊡v∙ ap-cst south (merid x) =⟨ natural-square-cst south south (λ sx → idp) (merid x) ⟩ disc-to-square (ap (λ sx → idp) (merid x)) =⟨ ap disc-to-square (ap-cst idp (merid x)) ⟩ ids =∎ f-smgluer : ∀ sy → ap f (smgluer sy) == idp f-smgluer sy = ap f (smgluer sy) =⟨ ap-∘ (Susp-fmap (∧Σ-out X Y)) (Σ∧-out X (⊙Susp (de⊙ Y))) (smgluer sy) ⟩ ap (Susp-fmap (∧Σ-out X Y)) (ap (Σ∧-out X (⊙Susp (de⊙ Y))) (smgluer sy)) =⟨ ap (ap (Susp-fmap (∧Σ-out X Y))) (Σ∧Out.smgluer-β X (⊙Susp (de⊙ Y)) sy) ⟩ idp =∎ g-smgluer : ∀ sy → ap g (smgluer sy) == ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (∧ΣOutSmgluer.f (⊙Susp (de⊙ X)) Y sy) g-smgluer sy = ap g (smgluer sy) =⟨ ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (∧Σ-out (⊙Susp (de⊙ X)) Y) (smgluer sy) ⟩ ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (ap (∧Σ-out (⊙Susp (de⊙ X)) Y) (smgluer sy)) =⟨ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (∧ΣOut.smgluer-β (⊙Susp (de⊙ X)) Y sy) ⟩ ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (∧ΣOutSmgluer.f (⊙Susp (de⊙ X)) Y sy) =∎ g-smgluer-north : ap g (smgluer north) == idp g-smgluer-north = g-smgluer north g-smgluer-south-step : ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y))) == ! (merid north) g-smgluer-south-step = ↯ $ ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y))) =⟪ ap-∘ Susp-flip (Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y))) ⟫ ap Susp-flip (ap (Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) =⟪ ap (ap Susp-flip) (SuspFmap.merid-β (Σ∧-out X Y) (smin north (pt Y))) ⟫ ap Susp-flip (merid north) =⟪ SuspFlip.merid-β north ⟫ ! (merid north) ∎∎ g-smgluer-south : ap g (smgluer south) =-= merid north g-smgluer-south = ap g (smgluer south) =⟪ g-smgluer south ⟫ ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (! (merid (smin north (pt Y)))) =⟪ ap-! (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y))) ⟫ ! (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) =⟪ ap ! g-smgluer-south-step ⟫ ! (! (merid north)) =⟪ !-! (merid north) ⟫ merid north ∎∎ smgluer-north : Square n-n (ap f (smgluer north)) (ap g (smgluer north)) baser smgluer-north = f-smgluer north ∙v⊡ hid-square ⊡v∙ ! g-smgluer-north smgluer-south : Square n-s (ap f (smgluer south)) (ap g (smgluer south)) baser smgluer-south = f-smgluer south ∙v⊡ br-square (merid north) ⊡v∙ ! (↯ (g-smgluer-south)) smgluer-merid : ∀ (y : de⊙ Y) → Cube smgluer-north smgluer-south (n-m y) (natural-square (λ a → ap f (smgluer a)) (merid y)) (natural-square (λ a → ap g (smgluer a)) (merid y)) (natural-square (λ a → baser) (merid y)) smgluer-merid y = smgluer-merid-custom-cube-∙v⊡ (f-smgluer north) (f-smgluer south) (ap-cst north (merid y)) (ap-cst north (merid y)) $ cube-shift-top (! top-path) $ custom-cube-⊡v∙ (! g-smgluer-north) (↯ g-smgluer-south) (! (↯ (g-merid-y north y))) (ap-cst south (merid y)) $ cube-shift-front (! front-path) $ cube-shift-bot (! bot-path) $ custom-cube (merid north) where smgluer-merid-custom-cube-∙v⊡ : ∀ {i} {A : Type i} {a₀₀₀ a₀₁₀ a₁₀₀ a₁₁₀ a₀₀₁ a₀₁₁ a₁₀₁ a₁₁₁ : A} {p₀₋₀ : a₀₀₀ == a₀₁₀} {p₋₀₀ p₋₀₀' : a₀₀₀ == a₁₀₀} (q₋₀₀ : p₋₀₀' == p₋₀₀) {p₋₁₀ : a₀₁₀ == a₁₁₀} {p₁₋₀ : a₁₀₀ == a₁₁₀} {sq₋₋₀ : Square p₀₋₀ p₋₀₀ p₋₁₀ p₁₋₀} -- left {p₀₋₁ : a₀₀₁ == a₀₁₁} {p₋₀₁ p₋₀₁' : a₀₀₁ == a₁₀₁} (q₋₀₁ : p₋₀₁' == p₋₀₁) {p₋₁₁ : a₀₁₁ == a₁₁₁} {p₁₋₁ : a₁₀₁ == a₁₁₁} {sq₋₋₁ : Square p₀₋₁ p₋₀₁ p₋₁₁ p₁₋₁} -- right {p₀₀₋ p₀₀₋' : a₀₀₀ == a₀₀₁} (q₀₀₋ : p₀₀₋' == p₀₀₋) {p₀₁₋ : a₀₁₀ == a₀₁₁} {p₁₀₋ p₁₀₋' : a₁₀₀ == a₁₀₁} (q₁₀₋ : p₁₀₋ == p₁₀₋') {p₁₁₋ : a₁₁₀ == a₁₁₁} {sq₀₋₋ : Square p₀₋₀ p₀₀₋ p₀₁₋ p₀₋₁} -- back {sq₋₀₋ : Square p₋₀₀' p₀₀₋' p₁₀₋ p₋₀₁'} -- top {sq₋₁₋ : Square p₋₁₀ p₀₁₋ p₁₁₋ p₋₁₁} -- bottom {sq₁₋₋ : Square p₁₋₀ p₁₀₋ p₁₁₋ p₁₋₁} -- front → Cube sq₋₋₀ sq₋₋₁ sq₀₋₋ (! q₀₀₋ ∙v⊡ (! q₋₀₀ ∙h⊡ sq₋₀₋ ⊡h∙ q₋₀₁) ⊡v∙ q₁₀₋) sq₋₁₋ (! q₁₀₋ ∙v⊡ sq₁₋₋) → Cube (q₋₀₀ ∙v⊡ sq₋₋₀) (q₋₀₁ ∙v⊡ sq₋₋₁) (q₀₀₋ ∙v⊡ sq₀₋₋) sq₋₀₋ sq₋₁₋ sq₁₋₋ smgluer-merid-custom-cube-∙v⊡ idp idp idp idp c = c top-path : ! (ap-cst north (merid y)) ∙v⊡ (! (f-smgluer north) ∙h⊡ natural-square (λ sy → ap f (smgluer sy)) (merid y) ⊡h∙ f-smgluer south) ⊡v∙ ap-cst north (merid y) == ids top-path = ! (ap-cst north (merid y)) ∙v⊡ (! (f-smgluer north) ∙h⊡ natural-square (λ sy → ap f (smgluer sy)) (merid y) ⊡h∙ f-smgluer south) ⊡v∙ ap-cst north (merid y) =⟨ ap (λ u → ! (ap-cst north (merid y)) ∙v⊡ u ⊡v∙ ap-cst north (merid y)) $ natural-square-path (λ sy → idp) (λ sy → ap f (smgluer sy)) f-smgluer (merid y) ⟩ ! (ap-cst north (merid y)) ∙v⊡ natural-square (λ sy → idp) (merid y) ⊡v∙ ap-cst north (merid y) =⟨ natural-square-cst north north (λ sy → idp) (merid y) ⟩ disc-to-square (ap (λ sy → idp) (merid y)) =⟨ ap disc-to-square (ap-cst idp (merid y)) ⟩ ids =∎ front-path : (! (ap-cst north (merid y)) ∙v⊡ natural-square (λ sy → baser) (merid y)) ⊡v∙ ap-cst south (merid y) == hid-square front-path = (! (ap-cst north (merid y)) ∙v⊡ natural-square (λ sy → baser) (merid y)) ⊡v∙ ap-cst south (merid y) =⟨ ∙v⊡-⊡v∙-comm (! (ap-cst north (merid y))) (natural-square (λ sy → baser) (merid y)) (ap-cst south (merid y)) ⟩ ! (ap-cst north (merid y)) ∙v⊡ natural-square (λ sy → baser) (merid y) ⊡v∙ ap-cst south (merid y) =⟨ natural-square-cst north south (λ sy → baser) (merid y) ⟩ horiz-degen-square (ap (λ sy → baser) (merid y)) =⟨ ap horiz-degen-square (ap-cst baser (merid y)) ⟩ horiz-degen-square idp =⟨ horiz-degen-square-idp ⟩ hid-square =∎ bot-path : ! (↯ (g-merid-y north y)) ∙v⊡ (! g-smgluer-north ∙h⊡ natural-square (λ sy → ap g (smgluer sy)) (merid y) ⊡h∙ ↯ g-smgluer-south) ⊡v∙ ap-cst south (merid y) == rt-square (merid north) bot-path = ! (↯ (g-merid-y north y)) ∙v⊡ (! g-smgluer-north ∙h⊡ natural-square (λ sy → ap g (smgluer sy)) (merid y) ⊡h∙ ↯ g-smgluer-south) ⊡v∙ ap-cst south (merid y) =⟨ ap (λ u → ! (↯ (g-merid-y north y)) ∙v⊡ u ⊡v∙ ap-cst south (merid y)) $ ! g-smgluer-north ∙h⊡ natural-square (λ sy → ap g (smgluer sy)) (merid y) ⊡h∙ ↯ g-smgluer-south =⟨ ! $ ap (! g-smgluer-north ∙h⊡_) $ ⊡h∙-assoc (natural-square (λ sy → ap g (smgluer sy)) (merid y)) (g-smgluer south) (↯ (tail g-smgluer-south)) ⟩ ! g-smgluer-north ∙h⊡ natural-square (λ sy → ap g (smgluer sy)) (merid y) ⊡h∙ g-smgluer south ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ! $ ∙h⊡-⊡h∙-comm (! g-smgluer-north) (natural-square (λ sy → ap g (smgluer sy)) (merid y) ⊡h∙ g-smgluer south) (↯ (tail g-smgluer-south)) ⟩ (! g-smgluer-north ∙h⊡ natural-square (λ sy → ap g (smgluer sy)) (merid y) ⊡h∙ g-smgluer south) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (_⊡h∙ ↯ (tail g-smgluer-south)) $ natural-square-path (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) ∘ ∧ΣOutSmgluer.f (⊙Susp (de⊙ X)) Y) (λ sy → ap g (smgluer sy)) g-smgluer (merid y) ⟩ natural-square (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) ∘ ∧ΣOutSmgluer.f (⊙Susp (de⊙ X)) Y) (merid y) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (_⊡h∙ ↯ (tail g-smgluer-south)) $ natural-square-ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (∧ΣOutSmgluer.f (⊙Susp (de⊙ X)) Y) (merid y) ⟩ (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (natural-square (∧ΣOutSmgluer.f (⊙Susp (de⊙ X)) Y) (merid y)) ⊡v∙ ∘-ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (λ _ → north) (merid y)) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (λ u → (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) u ⊡v∙ ∘-ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (λ _ → north) (merid y)) ⊡h∙ ↯ (tail g-smgluer-south)) $ ∧ΣOutSmgluer.merid-square-β (⊙Susp (de⊙ X)) Y y ⟩ (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (∧Σ-out-smgluer-merid (⊙Susp (de⊙ X)) Y y) ⊡v∙ ∘-ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (λ _ → north) (merid y)) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (λ u → (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ u ⊡v∙ ∘-ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (λ _ → north) (merid y)) ⊡h∙ ↯ (tail g-smgluer-south)) $ ! $ ap-square-⊡v∙ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) ((SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) ∙v⊡ tr-square (merid (smin north (pt Y)))) (! (ap-cst north (merid y))) ⟩ (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) ((SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) ∙v⊡ tr-square (merid (smin north (pt Y)))) ⊡v∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (! (ap-cst north (merid y))) ⊡v∙ ∘-ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (λ _ → north) (merid y)) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (λ u → (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ u) ⊡h∙ ↯ (tail g-smgluer-south)) $ ⊡v∙-assoc (ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) ((SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) ∙v⊡ tr-square (merid (smin north (pt Y))))) (ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (! (ap-cst north (merid y)))) (∘-ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (λ _ → north) (merid y)) ⟩ (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) ((SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) ∙v⊡ tr-square (merid (smin north (pt Y)))) ⊡v∙ (ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (! (ap-cst north (merid y))) ∙ ∘-ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (λ _ → north) (merid y))) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (λ u → (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) ((SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) ∙v⊡ tr-square (merid (smin north (pt Y)))) ⊡v∙ u) ⊡h∙ ↯ (tail g-smgluer-south)) $ =ₛ-out $ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (! (ap-cst north (merid y))) ◃∙ ∘-ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (λ _ → north) (merid y) ◃∎ =ₛ⟨ 1 & 1 & post-rotate-in {p = _ ◃∎} $ ap-∘-cst-coh (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) north (merid y) ⟩ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (! (ap-cst north (merid y))) ◃∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (ap-cst north (merid y)) ◃∙ ! (ap-cst south (merid y)) ◃∎ =ₛ⟨ 0 & 2 & ap-seq-=ₛ (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) $ seq-!-inv-l (ap-cst north (merid y) ◃∎) ⟩ ! (ap-cst south (merid y)) ◃∎ ∎ₛ ⟩ (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) ((SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) ∙v⊡ tr-square (merid (smin north (pt Y)))) ⊡v∙ ! (ap-cst south (merid y))) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (λ u → (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ u ⊡v∙ (! (ap-cst south (merid y)))) ⊡h∙ ↯ (tail g-smgluer-south)) $ ! $ ap-square-∙v⊡ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) (tr-square (merid (smin north (pt Y)))) ⟩ (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ (ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) ⊡v∙ ! (ap-cst south (merid y))) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ! $ ap (_⊡h∙ ↯ (tail g-smgluer-south)) $ ∙v⊡-⊡v∙-comm (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y)) (ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) (! (ap-cst south (merid y))) ⟩ (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙v⊡ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) ⊡v∙ ! (ap-cst south (merid y)) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ! $ ap (λ u → u ⊡v∙ ! (ap-cst south (merid y)) ⊡h∙ ↯ (tail g-smgluer-south)) $ ∙v⊡-assoc (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y)) (ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) (ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) ⟩ ((ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) ⊡v∙ ! (ap-cst south (merid y)) ⊡h∙ ↯ (tail g-smgluer-south) =∎ ⟩ ! (↯ (g-merid-y north y)) ∙v⊡ (((ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) ⊡v∙ ! (ap-cst south (merid y)) ⊡h∙ ↯ (tail g-smgluer-south)) ⊡v∙ ap-cst south (merid y) =⟨ ap (! (↯ (g-merid-y north y)) ∙v⊡_) $ ! $ ⊡v∙-⊡h∙-comm (((ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) ⊡v∙ ! (ap-cst south (merid y))) (ap-cst south (merid y)) (↯ (tail g-smgluer-south)) ⟩ ! (↯ (g-merid-y north y)) ∙v⊡ (((ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) ⊡v∙ ! (ap-cst south (merid y)) ⊡v∙ ap-cst south (merid y)) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (λ u → ! (↯ (g-merid-y north y)) ∙v⊡ u ⊡h∙ ↯ (tail g-smgluer-south)) $ ⊡v∙-assoc ((ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) (! (ap-cst south (merid y))) (ap-cst south (merid y)) ⟩ ! (↯ (g-merid-y north y)) ∙v⊡ (((ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) ⊡v∙ (! (ap-cst south (merid y)) ∙ ap-cst south (merid y))) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (λ u → ! (↯ (g-merid-y north y)) ∙v⊡ (((ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) ⊡v∙ u) ⊡h∙ ↯ (tail g-smgluer-south)) $ !-inv-l (ap-cst south (merid y)) ⟩ ! (↯ (g-merid-y north y)) ∙v⊡ ((ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (! (↯ (g-merid-y north y)) ∙v⊡_) $ ∙v⊡-⊡h∙-comm (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) (ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) (↯ (tail g-smgluer-south)) ⟩ ! (↯ (g-merid-y north y)) ∙v⊡ (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y)))) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ! $ ∙v⊡-assoc (! (↯ (g-merid-y north y))) (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) (ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y)))) ⊡h∙ ↯ (tail g-smgluer-south)) ⟩ (! (↯ (g-merid-y north y)) ∙ ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y))) ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y)))) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ap (_∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y)))) ⊡h∙ ↯ (tail g-smgluer-south)) $ =ₛ-out $ ! (↯ (g-merid-y north y)) ◃∙ ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ◃∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y ∙ ap merid (∧-norm-r y)) ◃∎ =ₛ⟨ 2 & 1 & ap-seq-∙ (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) $ (SuspFmap.merid-β (smin north) y ◃∙ ap merid (∧-norm-r y) ◃∎) ⟩ ! (↯ (g-merid-y north y)) ◃∙ ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ◃∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y) ◃∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (ap merid (∧-norm-r y)) ◃∎ =ₛ⟨ 0 & 1 & !-∙-seq (g-merid-y north y) ⟩ ! (SuspFlip.merid-β north) ◃∙ ! (ap (ap Susp-flip) (SuspFmap.merid-β (Σ∧-out X Y) (smin north y))) ◃∙ ! (ap-∘ Susp-flip (Susp-fmap (Σ∧-out X Y)) (merid (smin north y))) ◃∙ ! (ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y)) ◃∙ ! (ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y)) ◃∙ ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ◃∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y) ◃∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (ap merid (∧-norm-r y)) ◃∎ =ₛ⟨ 3 & 4 & seq-!-inv-l $ ap-∘ (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (Susp-fmap (smin north)) (merid y) ◃∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (SuspFmap.merid-β (smin north) y) ◃∎ ⟩ ! (SuspFlip.merid-β north) ◃∙ ! (ap (ap Susp-flip) (SuspFmap.merid-β (Σ∧-out X Y) (smin north y))) ◃∙ ! (ap-∘ Susp-flip (Susp-fmap (Σ∧-out X Y)) (merid (smin north y))) ◃∙ ap (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (ap merid (∧-norm-r y)) ◃∎ =ₛ⟨ 2 & 2 & !ₛ $ homotopy-naturality (ap Susp-flip ∘ ap (Susp-fmap (Σ∧-out X Y))) (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y))) (λ p → ! (ap-∘ Susp-flip (Susp-fmap (Σ∧-out X Y)) p)) (ap merid (∧-norm-r y)) ⟩ ! (SuspFlip.merid-β north) ◃∙ ! (ap (ap Susp-flip) (SuspFmap.merid-β (Σ∧-out X Y) (smin north y))) ◃∙ ap (ap Susp-flip ∘ ap (Susp-fmap (Σ∧-out X Y))) (ap merid (∧-norm-r y)) ◃∙ ! (ap-∘ Susp-flip (Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) ◃∎ =ₛ₁⟨ 2 & 1 & ∘-ap (ap Susp-flip ∘ ap (Susp-fmap (Σ∧-out X Y))) merid (∧-norm-r y) ⟩ ! (SuspFlip.merid-β north) ◃∙ ! (ap (ap Susp-flip) (SuspFmap.merid-β (Σ∧-out X Y) (smin north y))) ◃∙ ap (ap Susp-flip ∘ ap (Susp-fmap (Σ∧-out X Y)) ∘ merid) (∧-norm-r y) ◃∙ ! (ap-∘ Susp-flip (Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) ◃∎ =ₛ⟨ 1 & 2 & !ₛ $ homotopy-naturality (ap Susp-flip ∘ merid ∘ Σ∧Out.f X Y) (ap Susp-flip ∘ ap (Susp-fmap (Σ∧-out X Y)) ∘ merid) (λ w → ! (ap (ap Susp-flip) (SuspFmap.merid-β (Σ∧-out X Y) w))) (∧-norm-r y) ⟩ ! (SuspFlip.merid-β north) ◃∙ ap (ap Susp-flip ∘ merid ∘ Σ∧-out X Y) (∧-norm-r y) ◃∙ ! (ap (ap Susp-flip) (SuspFmap.merid-β (Σ∧-out X Y) (smin north (pt Y)))) ◃∙ ! (ap-∘ Susp-flip (Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) ◃∎ =ₛ⟨ 1 & 1 & =ₛ-in {t = []} $ ap-∘ (ap Susp-flip ∘ merid) (Σ∧-out X Y) (∧-norm-r y) ∙ ap (ap (ap Susp-flip ∘ merid)) (Σ∧-out-∧-norm-r X Y y) ⟩ ! (SuspFlip.merid-β north) ◃∙ ! (ap (ap Susp-flip) (SuspFmap.merid-β (Σ∧-out X Y) (smin north (pt Y)))) ◃∙ ! (ap-∘ Susp-flip (Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) ◃∎ =ₛ⟨ ∙-!-seq $ ap-∘ Susp-flip (Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y))) ◃∙ ap (ap Susp-flip) (SuspFmap.merid-β (Σ∧-out X Y) (smin north (pt Y))) ◃∙ SuspFlip.merid-β north ◃∎ ⟩ ! g-smgluer-south-step ◃∎ ∎ₛ ⟩ ! g-smgluer-south-step ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y)))) ⊡h∙ ↯ (tail g-smgluer-south) =⟨ ! $ ap (! g-smgluer-south-step ∙v⊡_) $ ⊡h∙-assoc (ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y))))) (ap-! (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) (ap ! g-smgluer-south-step ∙ !-! (merid north)) ⟩ ! g-smgluer-south-step ∙v⊡ ap-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (tr-square (merid (smin north (pt Y)))) ⊡h∙ ap-! (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y))) ⊡h∙ (ap ! g-smgluer-south-step ∙ !-! (merid north)) =⟨ ap (λ u → ! g-smgluer-south-step ∙v⊡ u ⊡h∙ (ap ! g-smgluer-south-step ∙ !-! (merid north))) $ ap-tr-square (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y))) ⟩ ! g-smgluer-south-step ∙v⊡ tr-square (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) ⊡h∙ (ap ! g-smgluer-south-step ∙ !-! (merid north)) =⟨ ! $ ap (! g-smgluer-south-step ∙v⊡_) $ ⊡h∙-assoc (tr-square (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y))))) (ap ! g-smgluer-south-step) (!-! (merid north)) ⟩ ! g-smgluer-south-step ∙v⊡ tr-square (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) ⊡h∙ ap ! g-smgluer-south-step ⊡h∙ !-! (merid north) =⟨ ! $ ∙v⊡-⊡h∙-comm (! g-smgluer-south-step) (tr-square (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) ⊡h∙ ap ! g-smgluer-south-step) (!-! (merid north)) ⟩ (! g-smgluer-south-step ∙v⊡ tr-square (ap (Susp-flip ∘ Susp-fmap (Σ∧-out X Y)) (merid (smin north (pt Y)))) ⊡h∙ ap ! g-smgluer-south-step) ⊡h∙ !-! (merid north) =⟨ ap (_⊡h∙ !-! (merid north)) $ tr-square-∙v⊡-⊡h∙ g-smgluer-south-step ⟩ tr-square (! (merid north)) ⊡h∙ !-! (merid north) =⟨ tr-square-! (merid north) ⟩ rt-square (merid north) =∎ custom-cube : ∀ {i} {S : Type i} {n s : S} (p : n == s) → Cube hid-square (br-square p) (lb-square p) ids (rt-square p) hid-square custom-cube p@idp = idc module ∧Σ-Σ∧-Out = Σ∧Σ-PathElim f g n-n n-s s-n s-s n-m s-m m-n m-s m-m basel baser smgluel-north smgluel-south smgluel-merid smgluer-north smgluer-south smgluer-merid ∧Σ-Σ∧-out : Susp-fmap (∧Σ-out X Y) ∘ Σ∧-out X (⊙Susp (de⊙ Y)) ∼ Susp-flip ∘ Susp-fmap (Σ∧-out X Y) ∘ ∧Σ-out (⊙Susp (de⊙ X)) Y ∧Σ-Σ∧-out = ∧Σ-Σ∧-Out.f ⊙∧Σ-Σ∧-out : ⊙Susp-fmap (∧Σ-out X Y) ◃⊙∘ ⊙Σ∧-out X (⊙Susp (de⊙ Y)) ◃⊙idf =⊙∘ ⊙Susp-flip (⊙Susp (X ∧ Y)) ◃⊙∘ ⊙Susp-fmap (Σ∧-out X Y) ◃⊙∘ ⊙∧Σ-out (⊙Susp (de⊙ X)) Y ◃⊙idf ⊙∧Σ-Σ∧-out = ⊙seq-λ= ∧Σ-Σ∧-out $ !ₛ $ merid north ◃∙ idp ◃∙ idp ◃∙ ! (merid north) ◃∎ =ₛ⟨ 1 & 1 & expand [] ⟩ merid north ◃∙ idp ◃∙ ! (merid north) ◃∎ =ₛ⟨ 1 & 1 & expand [] ⟩ merid north ◃∙ ! (merid north) ◃∎ =ₛ₁⟨ !-inv-r (merid north) ⟩ idp ◃∎ =ₛ⟨ 0 & 0 & contract ⟩ idp ◃∙ idp ◃∎ ∎ₛ
{ "alphanum_fraction": 0.4465131396, "avg_line_length": 50.6379310345, "ext": "agda", "hexsha": "165377586bb04e1f10110d855519fcbdd4b221cd", "lang": "Agda", "max_forks_count": 50, "max_forks_repo_forks_event_max_datetime": "2022-02-14T03:03:25.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-10T01:48:08.000Z", "max_forks_repo_head_hexsha": "1037d82edcf29b620677a311dcfd4fc2ade2faa6", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "AntoineAllioux/HoTT-Agda", "max_forks_repo_path": "theorems/homotopy/SuspSmashComm.agda", "max_issues_count": 31, "max_issues_repo_head_hexsha": "1037d82edcf29b620677a311dcfd4fc2ade2faa6", "max_issues_repo_issues_event_max_datetime": "2021-10-03T19:15:25.000Z", "max_issues_repo_issues_event_min_datetime": "2015-03-05T20:09:00.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "AntoineAllioux/HoTT-Agda", "max_issues_repo_path": "theorems/homotopy/SuspSmashComm.agda", "max_line_length": 127, "max_stars_count": 294, "max_stars_repo_head_hexsha": "1037d82edcf29b620677a311dcfd4fc2ade2faa6", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "AntoineAllioux/HoTT-Agda", "max_stars_repo_path": "theorems/homotopy/SuspSmashComm.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-20T13:54:45.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T16:23:23.000Z", "num_tokens": 27777, "size": 64614 }
{-# OPTIONS --type-in-type #-} open import Data.Unit open import Data.Product hiding ( curry ; uncurry ) open import Data.List hiding ( concat ) open import Data.String open import Relation.Binary.PropositionalEquality module Spire.Examples.PropositionalDesc where ---------------------------------------------------------------------- elimEq : (A : Set) (x : A) (P : (y : A) → x ≡ y → Set) → P x refl → (y : A) (p : x ≡ y) → P y p elimEq A .x P prefl x refl = prefl ---------------------------------------------------------------------- Label : Set Label = String Enum : Set Enum = List Label data Tag : Enum → Set where here : ∀{l E} → Tag (l ∷ E) there : ∀{l E} → Tag E → Tag (l ∷ E) Cases : (E : Enum) (P : Tag E → Set) → Set Cases [] P = ⊤ Cases (l ∷ E) P = P here × Cases E λ t → P (there t) case : (E : Enum) (P : Tag E → Set) (cs : Cases E P) (t : Tag E) → P t case (l ∷ E) P (c , cs) here = c case (l ∷ E) P (c , cs) (there t) = case E (λ t → P (there t)) cs t UncurriedCases : (E : Enum) (P : Tag E → Set) (X : Set) → Set UncurriedCases E P X = Cases E P → X CurriedCases : (E : Enum) (P : Tag E → Set) (X : Set) → Set CurriedCases [] P X = X CurriedCases (l ∷ E) P X = P here → CurriedCases E (λ t → P (there t)) X curryCases : (E : Enum) (P : Tag E → Set) (X : Set) (f : UncurriedCases E P X) → CurriedCases E P X curryCases [] P X f = f tt curryCases (l ∷ E) P X f = λ c → curryCases E (λ t → P (there t)) X (λ cs → f (c , cs)) uncurryCases : (E : Enum) (P : Tag E → Set) (X : Set) (f : CurriedCases E P X) → UncurriedCases E P X uncurryCases [] P X x tt = x uncurryCases (l ∷ E) P X f (c , cs) = uncurryCases E (λ t → P (there t)) X (f c) cs ---------------------------------------------------------------------- data Desc (I : Set) : Set₁ where `End : (i : I) → Desc I `Rec : (i : I) (D : Desc I) → Desc I `Arg : (A : Set) (B : A → Desc I) → Desc I `RecFun : (A : Set) (B : A → I) (D : Desc I) → Desc I ISet : Set → Set₁ ISet I = I → Set El : (I : Set) (D : Desc I) (X : ISet I) → ISet I El I (`End j) X i = j ≡ i El I (`Rec j D) X i = X j × El I D X i El I (`Arg A B) X i = Σ A (λ a → El I (B a) X i) El I (`RecFun A B D) X i = ((a : A) → X (B a)) × El I D X i Hyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (i : I) (xs : El I D X i) → Set Hyps I (`End j) X P i q = ⊤ Hyps I (`Rec j D) X P i (x , xs) = P j x × Hyps I D X P i xs Hyps I (`Arg A B) X P i (a , b) = Hyps I (B a) X P i b Hyps I (`RecFun A B D) X P i (f , xs) = ((a : A) → P (B a) (f a)) × Hyps I D X P i xs caseD : (E : Enum) (I : Set) (cs : Cases E (λ _ → Desc I)) (t : Tag E) → Desc I caseD E I cs t = case E (λ _ → Desc I) cs t ---------------------------------------------------------------------- TagDesc : (I : Set) → Set TagDesc I = Σ Enum (λ E → Cases E (λ _ → Desc I)) toCase : (I : Set) (E,cs : TagDesc I) → Tag (proj₁ E,cs) → Desc I toCase I (E , cs) = case E (λ _ → Desc I) cs toDesc : (I : Set) → TagDesc I → Desc I toDesc I (E , cs) = `Arg (Tag E) (toCase I (E , cs)) ---------------------------------------------------------------------- UncurriedEl : (I : Set) (D : Desc I) (X : ISet I) → Set UncurriedEl I D X = {i : I} → El I D X i → X i CurriedEl : (I : Set) (D : Desc I) (X : ISet I) → Set CurriedEl I (`End i) X = X i CurriedEl I (`Rec j D) X = (x : X j) → CurriedEl I D X CurriedEl I (`Arg A B) X = (a : A) → CurriedEl I (B a) X CurriedEl I (`RecFun A B D) X = ((a : A) → X (B a)) → CurriedEl I D X curryEl : (I : Set) (D : Desc I) (X : ISet I) (cn : UncurriedEl I D X) → CurriedEl I D X curryEl I (`End i) X cn = cn refl curryEl I (`Rec i D) X cn = λ x → curryEl I D X (λ xs → cn (x , xs)) curryEl I (`Arg A B) X cn = λ a → curryEl I (B a) X (λ xs → cn (a , xs)) curryEl I (`RecFun A B D) X cn = λ f → curryEl I D X (λ xs → cn (f , xs)) uncurryEl : (I : Set) (D : Desc I) (X : ISet I) (cn : CurriedEl I D X) → UncurriedEl I D X uncurryEl I (`End i) X cn refl = cn uncurryEl I (`Rec i D) X cn (x , xs) = uncurryEl I D X (cn x) xs uncurryEl I (`Arg A B) X cn (a , xs) = uncurryEl I (B a) X (cn a) xs uncurryEl I (`RecFun A B D) X cn (f , xs) = uncurryEl I D X (cn f) xs data μ (I : Set) (D : Desc I) : I → Set where con : UncurriedEl I D (μ I D) con2 : (I : Set) (D : Desc I) → CurriedEl I D (μ I D) con2 I D = curryEl I D (μ I D) con ---------------------------------------------------------------------- UncurriedHyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (cn : UncurriedEl I D X) → Set UncurriedHyps I D X P cn = (i : I) (xs : El I D X i) → Hyps I D X P i xs → P i (cn xs) CurriedHyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (cn : UncurriedEl I D X) → Set CurriedHyps I (`End i) X P cn = P i (cn refl) CurriedHyps I (`Rec i D) X P cn = (x : X i) → P i x → CurriedHyps I D X P (λ xs → cn (x , xs)) CurriedHyps I (`Arg A B) X P cn = (a : A) → CurriedHyps I (B a) X P (λ xs → cn (a , xs)) CurriedHyps I (`RecFun A B D) X P cn = (f : (a : A) → X (B a)) (ihf : (a : A) → P (B a) (f a)) → CurriedHyps I D X P (λ xs → cn (f , xs)) curryHyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (cn : UncurriedEl I D X) (pf : UncurriedHyps I D X P cn) → CurriedHyps I D X P cn curryHyps I (`End i) X P cn pf = pf i refl tt curryHyps I (`Rec i D) X P cn pf = λ x ih → curryHyps I D X P (λ xs → cn (x , xs)) (λ i xs ihs → pf i (x , xs) (ih , ihs)) curryHyps I (`Arg A B) X P cn pf = λ a → curryHyps I (B a) X P (λ xs → cn (a , xs)) (λ i xs ihs → pf i (a , xs) ihs) curryHyps I (`RecFun A B D) X P cn pf = λ f ihf → curryHyps I D X P (λ xs → cn (f , xs)) (λ i xs ihs → pf i (f , xs) (ihf , ihs)) uncurryHyps : (I : Set) (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (cn : UncurriedEl I D X) (pf : CurriedHyps I D X P cn) → UncurriedHyps I D X P cn uncurryHyps I (`End .i) X P cn pf i refl tt = pf uncurryHyps I (`Rec j D) X P cn pf i (x , xs) (ih , ihs) = uncurryHyps I D X P (λ ys → cn (x , ys)) (pf x ih) i xs ihs uncurryHyps I (`Arg A B) X P cn pf i (a , xs) ihs = uncurryHyps I (B a) X P (λ ys → cn (a , ys)) (pf a) i xs ihs uncurryHyps I (`RecFun A B D) X P cn pf i (f , xs) (ihf , ihs) = uncurryHyps I D X P (λ ys → cn (f , ys)) (pf f ihf) i xs ihs ---------------------------------------------------------------------- ind : (I : Set) (D : Desc I) (P : (i : I) → μ I D i → Set) (pcon : UncurriedHyps I D (μ I D) P con) (i : I) (x : μ I D i) → P i x hyps : (I : Set) (D₁ : Desc I) (P : (i : I) → μ I D₁ i → Set) (pcon : UncurriedHyps I D₁ (μ I D₁) P con) (D₂ : Desc I) (i : I) (xs : El I D₂ (μ I D₁) i) → Hyps I D₂ (μ I D₁) P i xs ind I D P pcon i (con xs) = pcon i xs (hyps I D P pcon D i xs) hyps I D P pcon (`End j) i q = tt hyps I D P pcon (`Rec j A) i (x , xs) = ind I D P pcon j x , hyps I D P pcon A i xs hyps I D P pcon (`Arg A B) i (a , b) = hyps I D P pcon (B a) i b hyps I D P pcon (`RecFun A B E) i (f , xs) = (λ a → ind I D P pcon (B a) (f a)) , hyps I D P pcon E i xs ---------------------------------------------------------------------- ind2 : (I : Set) (D : Desc I) (P : (i : I) → μ I D i → Set) (pcon : CurriedHyps I D (μ I D) P con) (i : I) (x : μ I D i) → P i x ind2 I D P pcon i x = ind I D P (uncurryHyps I D (μ I D) P con pcon) i x elim : (I : Set) (TD : TagDesc I) → let D = toDesc I TD E = proj₁ TD Cs = toCase I TD in (P : (i : I) → μ I D i → Set) → let Q = λ t → CurriedHyps I (Cs t) (μ I D) P (λ xs → con (t , xs)) X = (i : I) (x : μ I D i) → P i x in UncurriedCases E Q X elim I TD P cs i x = let D = toDesc I TD E = proj₁ TD Cs = toCase I TD Q = λ t → CurriedHyps I (Cs t) (μ I D) P (λ xs → con (t , xs)) p = case E Q cs in ind2 I D P p i x elim2 : (I : Set) (TD : TagDesc I) → let D = toDesc I TD E = proj₁ TD Cs = toCase I TD in (P : (i : I) → μ I D i → Set) → let Q = λ t → CurriedHyps I (Cs t) (μ I D) P (λ xs → con (t , xs)) X = (i : I) (x : μ I D i) → P i x in CurriedCases E Q X elim2 I TD P = let D = toDesc I TD E = proj₁ TD Cs = toCase I TD Q = λ t → CurriedHyps I (Cs t) (μ I D) P (λ xs → con (t , xs)) X = (i : I) (x : μ I D i) → P i x in curryCases E Q X (elim I TD P) ---------------------------------------------------------------------- module Sugared where data ℕT : Set where `zero `suc : ℕT data VecT : Set where `nil `cons : VecT ℕD : Desc ⊤ ℕD = `Arg ℕT λ { `zero → `End tt ; `suc → `Rec tt (`End tt) } ℕ : ⊤ → Set ℕ = μ ⊤ ℕD zero : ℕ tt zero = con (`zero , refl) suc : ℕ tt → ℕ tt suc n = con (`suc , n , refl) VecD : (A : Set) → Desc (ℕ tt) VecD A = `Arg VecT λ { `nil → `End zero ; `cons → `Arg (ℕ tt) λ n → `Arg A λ _ → `Rec n (`End (suc n)) } Vec : (A : Set) (n : ℕ tt) → Set Vec A n = μ (ℕ tt) (VecD A) n nil : (A : Set) → Vec A zero nil A = con (`nil , refl) cons : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n) cons A n x xs = con (`cons , n , x , xs , refl) ---------------------------------------------------------------------- add : ℕ tt → ℕ tt → ℕ tt add = ind ⊤ ℕD (λ _ _ → ℕ tt → ℕ tt) (λ { tt (`zero , q) tt n → n ; tt (`suc , m , q) (ih , tt) n → suc (ih n) } ) tt mult : ℕ tt → ℕ tt → ℕ tt mult = ind ⊤ ℕD (λ _ _ → ℕ tt → ℕ tt) (λ { tt (`zero , q) tt n → zero ; tt (`suc , m , q) (ih , tt) n → add n (ih n) } ) tt append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n) append A = ind (ℕ tt) (VecD A) (λ m xs → (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)) (λ { .(con (`zero , refl)) (`nil , refl) ih n ys → ys ; .(con (`suc , m , refl)) (`cons , m , x , xs , refl) (ih , tt) n ys → cons A (add m n) x (ih n ys) } ) concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m) concat A m = ind (ℕ tt) (VecD (Vec A m)) (λ n xss → Vec A (mult n m)) (λ { .(con (`zero , refl)) (`nil , refl) tt → nil A ; .(con (`suc , n , refl)) (`cons , n , xs , xss , refl) (ih , tt) → append A m xs (mult n m) ih } ) ---------------------------------------------------------------------- module Desugared where ℕT : Enum ℕT = "zero" ∷ "suc" ∷ [] VecT : Enum VecT = "nil" ∷ "cons" ∷ [] ℕTD : TagDesc ⊤ ℕTD = ℕT , `End tt , `Rec tt (`End tt) , tt ℕCs : Tag ℕT → Desc ⊤ ℕCs = toCase ⊤ ℕTD ℕD : Desc ⊤ ℕD = toDesc ⊤ ℕTD ℕ : ⊤ → Set ℕ = μ ⊤ ℕD zero : ℕ tt zero = con (here , refl) suc : ℕ tt → ℕ tt suc n = con (there here , n , refl) zero2 : ℕ tt zero2 = con2 ⊤ ℕD here suc2 : ℕ tt → ℕ tt suc2 = con2 ⊤ ℕD (there here) VecTD : (A : Set) → TagDesc (ℕ tt) VecTD A = VecT , `End zero , `Arg (ℕ tt) (λ n → `Arg A λ _ → `Rec n (`End (suc n))) , tt VecCs : (A : Set) → Tag VecT → Desc (ℕ tt) VecCs A = toCase (ℕ tt) (VecTD A) VecD : (A : Set) → Desc (ℕ tt) VecD A = toDesc (ℕ tt) (VecTD A) Vec : (A : Set) (n : ℕ tt) → Set Vec A n = μ (ℕ tt) (VecD A) n nil : (A : Set) → Vec A zero nil A = con (here , refl) cons : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n) cons A n x xs = con (there here , n , x , xs , refl) nil2 : (A : Set) → Vec A zero nil2 A = con2 (ℕ tt) (VecD A) here cons2 : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n) cons2 A = con2 (ℕ tt) (VecD A) (there here) ---------------------------------------------------------------------- module Induction where add : ℕ tt → ℕ tt → ℕ tt add = ind ⊤ ℕD (λ _ _ → ℕ tt → ℕ tt) (λ u t,c → case ℕT (λ t → (c : El ⊤ (ℕCs t) ℕ u) (ih : Hyps ⊤ ℕD ℕ (λ u n → ℕ u → ℕ u) u (t , c)) → ℕ u → ℕ u ) ( (λ q ih n → n) , (λ m,q ih,tt n → suc (proj₁ ih,tt n)) , tt ) (proj₁ t,c) (proj₂ t,c) ) tt mult : ℕ tt → ℕ tt → ℕ tt mult = ind ⊤ ℕD (λ _ _ → ℕ tt → ℕ tt) (λ u t,c → case ℕT (λ t → (c : El ⊤ (ℕCs t) ℕ u) (ih : Hyps ⊤ ℕD ℕ (λ u n → ℕ u → ℕ u) u (t , c)) → ℕ u → ℕ u ) ( (λ q ih n → zero) , (λ m,q ih,tt n → add n (proj₁ ih,tt n)) , tt ) (proj₁ t,c) (proj₂ t,c) ) tt append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n) append A = ind (ℕ tt) (VecD A) (λ m xs → (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)) (λ m t,c → case VecT (λ t → (c : El (ℕ tt) (VecCs A t) (Vec A) m) (ih : Hyps (ℕ tt) (VecD A) (Vec A) (λ m xs → (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)) m (t , c)) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n) ) ( (λ q ih n ys → subst (λ m → Vec A (add m n)) q ys) , (λ m',x,xs,q ih,tt n ys → let m' = proj₁ m',x,xs,q x = proj₁ (proj₂ m',x,xs,q) q = proj₂ (proj₂ (proj₂ m',x,xs,q)) ih = proj₁ ih,tt in subst (λ m → Vec A (add m n)) q (cons A (add m' n) x (ih n ys)) ) , tt ) (proj₁ t,c) (proj₂ t,c) ) concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m) concat A m = ind (ℕ tt) (VecD (Vec A m)) (λ n xss → Vec A (mult n m)) (λ n t,c → case VecT (λ t → (c : El (ℕ tt) (VecCs (Vec A m) t) (Vec (Vec A m)) n) (ih : Hyps (ℕ tt) (VecD (Vec A m)) (Vec (Vec A m)) (λ n xss → Vec A (mult n m)) n (t , c)) → Vec A (mult n m) ) ( (λ q ih → subst (λ n → Vec A (mult n m)) q (nil A)) , (λ n',xs,xss,q ih,tt → let n' = proj₁ n',xs,xss,q xs = proj₁ (proj₂ n',xs,xss,q) q = proj₂ (proj₂ (proj₂ n',xs,xss,q)) ih = proj₁ ih,tt in subst (λ n → Vec A (mult n m)) q (append A m xs (mult n' m) ih) ) , tt ) (proj₁ t,c) (proj₂ t,c) ) ---------------------------------------------------------------------- module Eliminator where elimℕ : (P : (ℕ tt) → Set) (pzero : P zero) (psuc : (m : ℕ tt) → P m → P (suc m)) (n : ℕ tt) → P n elimℕ P pzero psuc = ind ⊤ ℕD (λ u n → P n) (λ u t,c → case ℕT (λ t → (c : El ⊤ (ℕCs t) ℕ u) (ih : Hyps ⊤ ℕD ℕ (λ u n → P n) u (t , c)) → P (con (t , c)) ) ( (λ q ih → elimEq ⊤ tt (λ u q → P (con (here , q))) pzero u q ) , (λ n,q ih,tt → elimEq ⊤ tt (λ u q → P (con (there here , proj₁ n,q , q))) (psuc (proj₁ n,q) (proj₁ ih,tt)) u (proj₂ n,q) ) , tt ) (proj₁ t,c) (proj₂ t,c) ) tt elimVec : (A : Set) (P : (n : ℕ tt) → Vec A n → Set) (pnil : P zero (nil A)) (pcons : (n : ℕ tt) (a : A) (xs : Vec A n) → P n xs → P (suc n) (cons A n a xs)) (n : ℕ tt) (xs : Vec A n) → P n xs elimVec A P pnil pcons = ind (ℕ tt) (VecD A) (λ n xs → P n xs) (λ n t,c → case VecT (λ t → (c : El (ℕ tt) (VecCs A t) (Vec A) n) (ih : Hyps (ℕ tt) (VecD A) (Vec A) (λ n xs → P n xs) n (t , c)) → P n (con (t , c)) ) ( (λ q ih → elimEq (ℕ tt) zero (λ n q → P n (con (here , q))) pnil n q ) , (λ n',x,xs,q ih,tt → let n' = proj₁ n',x,xs,q x = proj₁ (proj₂ n',x,xs,q) xs = proj₁ (proj₂ (proj₂ n',x,xs,q)) q = proj₂ (proj₂ (proj₂ n',x,xs,q)) ih = proj₁ ih,tt in elimEq (ℕ tt) (suc n') (λ n q → P n (con (there here , n' , x , xs , q))) (pcons n' x xs ih ) n q ) , tt ) (proj₁ t,c) (proj₂ t,c) ) ---------------------------------------------------------------------- add : ℕ tt → ℕ tt → ℕ tt add = elimℕ (λ _ → ℕ tt → ℕ tt) (λ n → n) (λ m ih n → suc (ih n)) mult : ℕ tt → ℕ tt → ℕ tt mult = elimℕ (λ _ → ℕ tt → ℕ tt) (λ n → zero) (λ m ih n → add n (ih n)) append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n) append A = elimVec A (λ m xs → (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)) (λ n ys → ys) (λ m x xs ih n ys → cons A (add m n) x (ih n ys)) concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m) concat A m = elimVec (Vec A m) (λ n xss → Vec A (mult n m)) (nil A) (λ n xs xss ih → append A m xs (mult n m) ih) ---------------------------------------------------------------------- module GenericEliminator where add : ℕ tt → ℕ tt → ℕ tt add = elim2 ⊤ ℕTD _ (λ n → n) (λ m ih n → suc (ih n)) tt mult : ℕ tt → ℕ tt → ℕ tt mult = elim2 ⊤ ℕTD _ (λ n → zero) (λ m ih n → add n (ih n)) tt append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n) append A = elim2 (ℕ tt) (VecTD A) _ (λ n ys → ys) (λ m x xs ih n ys → cons A (add m n) x (ih n ys)) concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m) concat A m = elim2 (ℕ tt) (VecTD (Vec A m)) _ (nil A) (λ n xs xss ih → append A m xs (mult n m) ih) ----------------------------------------------------------------------
{ "alphanum_fraction": 0.4265655079, "avg_line_length": 30.0885860307, "ext": "agda", "hexsha": "012e927e18ce60815dbacd4bca9fff2b257ee28c", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2015-08-17T21:00:07.000Z", "max_forks_repo_forks_event_min_datetime": "2015-08-17T21:00:07.000Z", "max_forks_repo_head_hexsha": "3d67f137ee9423b7e6f8593634583998cd692353", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "spire/spire", "max_forks_repo_path": "formalization/agda/Spire/Examples/PropositionalDesc.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "3d67f137ee9423b7e6f8593634583998cd692353", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "spire/spire", "max_issues_repo_path": "formalization/agda/Spire/Examples/PropositionalDesc.agda", "max_line_length": 115, "max_stars_count": 43, "max_stars_repo_head_hexsha": "3d67f137ee9423b7e6f8593634583998cd692353", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "spire/spire", "max_stars_repo_path": "formalization/agda/Spire/Examples/PropositionalDesc.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-08T17:10:59.000Z", "max_stars_repo_stars_event_min_datetime": "2015-05-28T23:25:33.000Z", "num_tokens": 7071, "size": 17662 }
{-# OPTIONS --safe --warning=error --without-K --guardedness #-} open import Numbers.Naturals.Semiring open import Numbers.Naturals.Order open import LogicalFormulae open import Orders.Total.Definition open import Orders.Partial.Definition open import Setoids.Setoids open import Functions.Definition open import Sequences open import Setoids.Orders.Partial.Definition open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) module Setoids.Orders.Partial.Sequences {a b c : _} {A : Set a} {S : Setoid {a} {b} A} {_<_ : Rel {a} {c} A} (p : SetoidPartialOrder S _<_) where open SetoidPartialOrder p WeaklyIncreasing' : (Sequence A) → Set (b ⊔ c) WeaklyIncreasing' s = (m n : ℕ) → (m <N n) → (index s m) <= (index s n) WeaklyIncreasing : (Sequence A) → Set (b ⊔ c) WeaklyIncreasing s = (m : ℕ) → (index s m) <= index s (succ m) tailRespectsWeaklyIncreasing : (a : Sequence A) → WeaklyIncreasing a → WeaklyIncreasing (Sequence.tail a) tailRespectsWeaklyIncreasing a incr m = incr (succ m) weaklyIncreasingImplies' : (a : Sequence A) → WeaklyIncreasing a → WeaklyIncreasing' a weaklyIncreasingImplies' a x zero (succ zero) m<n = x 0 weaklyIncreasingImplies' a x zero (succ (succ n)) m<n = <=Transitive (weaklyIncreasingImplies' a x zero (succ n) (succIsPositive n)) (x (succ n)) weaklyIncreasingImplies' a x (succ m) (succ n) m<n = weaklyIncreasingImplies' (Sequence.tail a) (tailRespectsWeaklyIncreasing a x) m n (canRemoveSuccFrom<N m<n) weaklyIncreasing'Implies : (a : Sequence A) → WeaklyIncreasing' a → WeaklyIncreasing a weaklyIncreasing'Implies a incr m = incr m (succ m) (le 0 refl) StrictlyIncreasing' : (Sequence A) → Set (c) StrictlyIncreasing' s = (m n : ℕ) → (m <N n) → (index s m) < (index s n) StrictlyIncreasing : (Sequence A) → Set (c) StrictlyIncreasing s = (m : ℕ) → (index s m) < index s (succ m) tailRespectsStrictlyIncreasing : (a : Sequence A) → StrictlyIncreasing a → StrictlyIncreasing (Sequence.tail a) tailRespectsStrictlyIncreasing a incr m = incr (succ m) strictlyIncreasingImplies' : (a : Sequence A) → StrictlyIncreasing a → StrictlyIncreasing' a strictlyIncreasingImplies' a x zero (succ zero) m<n = x 0 strictlyIncreasingImplies' a x zero (succ (succ n)) m<n = <Transitive (strictlyIncreasingImplies' a x zero (succ n) (succIsPositive n)) (x (succ n)) strictlyIncreasingImplies' a x (succ m) (succ n) m<n = strictlyIncreasingImplies' (Sequence.tail a) (tailRespectsStrictlyIncreasing a x) m n (canRemoveSuccFrom<N m<n) strictlyIncreasing'Implies : (a : Sequence A) → StrictlyIncreasing' a → StrictlyIncreasing a strictlyIncreasing'Implies a incr m = incr m (succ m) (le 0 refl)
{ "alphanum_fraction": 0.7342737324, "avg_line_length": 50.4423076923, "ext": "agda", "hexsha": "4cb6436e84b9be518ff65f3da1526c7e7ea7ba3c", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_path": "Setoids/Orders/Partial/Sequences.agda", "max_issues_count": 14, "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_path": "Setoids/Orders/Partial/Sequences.agda", "max_line_length": 166, "max_stars_count": 4, "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_path": "Setoids/Orders/Partial/Sequences.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "num_tokens": 803, "size": 2623 }
open import Level using (Level; suc; zero; _⊔_) open import Function using (const) open import Algebra open import Algebra.Structures open import Algebra.OrderedMonoid open import Algebra.Pregroup open import Algebra.FunctionProperties as FunctionProperties using (Op₁; Op₂) open import Data.Product using (_×_; _,_; proj₁; proj₂) open import Relation.Binary open import Relation.Binary.PartialOrderReasoning as ≤-Reasoning using () module Algebra.PregroupPlus where record IsPregroupPlus {a ℓ₁ ℓ₂} {A : Set a} (≈ : Rel A ℓ₁) (≤ : Rel A ℓ₂) (∙ : Op₂ A) (ε₁ : A) (ˡ : Op₁ A) (ʳ : Op₁ A) (+ : Op₂ A) (ε₀ : A) (ᵘ : Op₁ A) (ᵈ : Op₁ A) : Set (a ⊔ ℓ₁ ⊔ ℓ₂) where field ∙-isPregroup : IsPregroup ≈ ≤ ∙ ε₁ ˡ ʳ +-isPregroup : IsPregroup ≈ ≤ + ε₀ ᵘ ᵈ open IsPregroup ∙-isPregroup public using (ˡ-cong; ʳ-cong; ˡ-contract; ʳ-contract ;ˡ-expand; ʳ-expand; ∙-cong) renaming (assoc to ∙-assoc; identity to ∙-identity ;compatibility to ∙-compatibility) open IsPregroup +-isPregroup public using (≤-refl; ≤-reflexive; ≤-trans; ≤-resp-≈; refl; sym; trans; antisym) renaming (ˡ-cong to ᵈ-cong; ʳ-cong to ᵘ-cong ;ˡ-contract to ᵈ-contract; ʳ-contract to ᵘ-contract ;ˡ-expand to ᵈ-expand; ʳ-expand to ᵘ-expand ;∙-cong to +-cong; assoc to +-assoc; identity to +-identity ;compatibility to +-compatibility) record PregroupPlus c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where infixl 7 _∙_ infixl 6 _+_ infix 4 _≈_ infix 4 _≤_ field Carrier : Set c _≈_ : Rel Carrier ℓ₁ _≤_ : Rel Carrier ℓ₂ _∙_ : Op₂ Carrier ε₁ : Carrier _ˡ : Op₁ Carrier _ʳ : Op₁ Carrier _+_ : Op₂ Carrier ε₀ : Carrier _ᵘ : Op₁ Carrier _ᵈ : Op₁ Carrier isPregroupPlus : IsPregroupPlus _≈_ _≤_ _∙_ ε₁ _ˡ _ʳ _+_ ε₀ _ᵘ _ᵈ open IsPregroupPlus isPregroupPlus public ∙-pregroup : Pregroup _ _ _ ∙-pregroup = record { isPregroup = ∙-isPregroup } open Pregroup ∙-pregroup public using ( ˡ-unique; ˡ-identity; ˡ-distrib; ˡ-contra; ˡʳ-cancel; ʳ-unique; ʳ-identity; ʳ-distrib; ʳ-contra; ʳˡ-cancel) +-pregroup : Pregroup _ _ _ +-pregroup = record { isPregroup = +-isPregroup } open Pregroup +-pregroup public using () renaming ( ˡ-unique to ᵈ-unique; ˡ-identity to ᵈ-identity; ˡ-distrib to ᵈ-distrib; ˡ-contra to ᵈ-contra; ˡʳ-cancel to ᵈᵘ-cancel; ʳ-unique to ᵘ-unique; ʳ-identity to ᵘ-identity; ʳ-distrib to ᵘ-distrib; ʳ-contra to ᵘ-contra; ʳˡ-cancel to ᵘᵈ-calcel)
{ "alphanum_fraction": 0.6097289268, "avg_line_length": 37.4027777778, "ext": "agda", "hexsha": "ae277632d6891097f33b39ed7c016a8f39d0ccd1", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "2cc4f28f23cc369d2582ad065739cabfa46ce799", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "wenkokke/agda-pregroup", "max_forks_repo_path": "Algebra/PregroupPlus.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "2cc4f28f23cc369d2582ad065739cabfa46ce799", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "wenkokke/agda-pregroup", "max_issues_repo_path": "Algebra/PregroupPlus.agda", "max_line_length": 80, "max_stars_count": 1, "max_stars_repo_head_hexsha": "2cc4f28f23cc369d2582ad065739cabfa46ce799", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "wenkokke/agda-pregroup", "max_stars_repo_path": "Algebra/PregroupPlus.agda", "max_stars_repo_stars_event_max_datetime": "2017-03-02T01:23:52.000Z", "max_stars_repo_stars_event_min_datetime": "2017-03-02T01:23:52.000Z", "num_tokens": 1046, "size": 2693 }
-- Everything is strictly positive, but Agda doesn't see this. {-# OPTIONS --no-positivity-check #-} module Generic.Core where open import Generic.Lib.Prelude public infix 4 _≤ℓ_ infixr 5 _⇒_ _⊛_ _≤ℓ_ : Level -> Level -> Set α ≤ℓ β = α ⊔ β ≡ β mutual Binder : ∀ {ι} α β γ -> ArgInfo -> ι ⊔ lsuc (α ⊔ β) ≡ γ -> Set ι -> Set γ Binder α β γ i q I = Coerce q (∃ λ (A : Set α) -> < relevance i > A -> Desc I β) data Desc {ι} (I : Set ι) β : Set (ι ⊔ lsuc β) where var : I -> Desc I β π : ∀ {α} i -> (q : α ≤ℓ β) -> Binder α β _ i (cong (λ αβ -> ι ⊔ lsuc αβ) q) I -> Desc I β _⊛_ : Desc I β -> Desc I β -> Desc I β pattern DPi i A D = π i refl (coerce (A , D)) {-# DISPLAY π i refl (coerce (A , D)) = DPi i A D #-} pattern explRelDPi A D = DPi explRelInfo A D pattern explIrrDPi A D = DPi explIrrInfo A D pattern implRelDPi A D = DPi implRelInfo A D pattern implIrrDPi A D = DPi implIrrInfo A D pattern instRelDPi A D = DPi instRelInfo A D pattern instIrrDPi A D = DPi instIrrInfo A D {-# DISPLAY DPi explRelInfo A D = explRelDPi A D #-} {-# DISPLAY DPi explIrrInfo A D = explIrrDPi A D #-} {-# DISPLAY DPi implRelInfo A D = implRelDPi A D #-} {-# DISPLAY DPi implIrrInfo A D = implIrrDPi A D #-} {-# DISPLAY DPi instRelInfo A D = instRelDPi A D #-} {-# DISPLAY DPi instIrrInfo A D = instIrrDPi A D #-} _⇒_ : ∀ {ι α β} {I : Set ι} {{q : α ≤ℓ β}} -> Set α -> Desc I β -> Desc I β _⇒_ {{q}} A D = π (explRelInfo) q (qcoerce (A , λ _ -> D)) mutual ⟦_⟧ : ∀ {ι β} {I : Set ι} -> Desc I β -> (I -> Set β) -> Set β ⟦ var i ⟧ B = B i ⟦ π i q C ⟧ B = ⟦ i / C ⟧ᵇ q B ⟦ D ⊛ E ⟧ B = ⟦ D ⟧ B × ⟦ E ⟧ B ⟦_/_⟧ᵇ : ∀ {α ι β γ q} {I : Set ι} i -> Binder α β γ i q I -> α ≤ℓ β -> (I -> Set β) -> Set β ⟦ i / coerce (A , D) ⟧ᵇ q B = Coerce′ q $ Pi i A λ x -> ⟦ D x ⟧ B mutual Extend : ∀ {ι β} {I : Set ι} -> Desc I β -> (I -> Set β) -> I -> Set β Extend (var i) B j = Lift _ (i ≡ j) Extend (π i q C) B j = Extendᵇ i C q B j Extend (D ⊛ E) B j = ⟦ D ⟧ B × Extend E B j Extendᵇ : ∀ {ι α β γ q} {I : Set ι} i -> Binder α β γ i q I -> α ≤ℓ β -> (I -> Set β) -> I -> Set β Extendᵇ i (coerce (A , D)) q B j = Coerce′ q $ ∃ λ x -> Extend (D x) B j module _ {ι β} {I : Set ι} (D : Data (Desc I β)) where mutual data μ j : Set β where node : Node D j -> μ j Node : Data (Desc I β) -> I -> Set β Node D j = Any (λ C -> Extend C μ j) (consTypes D) mutual Cons : ∀ {ι β} {I : Set ι} -> (I -> Set β) -> Desc I β -> Set β Cons B (var i) = B i Cons B (π i q C) = Consᵇ B i C q Cons B (D ⊛ E) = ⟦ D ⟧ B -> Cons B E Consᵇ : ∀ {ι α β γ q} {I : Set ι} -> (I -> Set β) -> ∀ i -> Binder α β γ i q I -> α ≤ℓ β -> Set β Consᵇ B i (coerce (A , D)) q = Coerce′ q $ Pi i A λ x -> Cons B (D x) cons : ∀ {ι β} {I : Set ι} {D} -> (D₀ : Data (Desc I β)) -> D ∈ consTypes D₀ -> Cons (μ D₀) D cons {D = D} D₀ p = go D λ e -> node (mapAny (consTypes D₀) (λ q -> subst (λ E -> Extend E _ _) q e) p) where mutual go : ∀ {ι β} {I : Set ι} {B : I -> Set β} -> (D : Desc I β) -> (∀ {j} -> Extend D B j -> B j) -> Cons B D go (var i) k = k lrefl go (π a q C) k = goᵇ a C k go (D ⊛ E) k = λ x -> go E (k ∘ _,_ x) goᵇ : ∀ {ι α β γ q q′} {I : Set ι} {B : I -> Set β} i -> (C : Binder α β γ i q′ I) -> (∀ {j} -> Extendᵇ i C q B j -> B j) -> Consᵇ B i C q goᵇ {q = q} i (coerce (A , D)) k = coerce′ q $ lamPi i λ x -> go (D x) (k ∘ coerce′ q ∘ _,_ x) allCons : ∀ {ι β} {I : Set ι} -> (D : Data (Desc I β)) -> All (Cons (μ D)) (consTypes D) allCons D = allIn _ (cons D) node-inj : ∀ {i β} {I : Set i} {D : Data (Desc I β)} {j} {e₁ e₂ : Node D D j} -> node {D = D} e₁ ≡ node e₂ -> e₁ ≡ e₂ node-inj refl = refl μ′ : ∀ {β} -> Data (Desc ⊤₀ β) -> Set β μ′ D = μ D tt pos : ∀ {β} -> Desc ⊤₀ β pos = var tt pattern #₀ p = node (inj₁ p) pattern #₁ p = node (inj₂ (inj₁ p)) pattern #₂ p = node (inj₂ (inj₂ (inj₁ p))) pattern #₃ p = node (inj₂ (inj₂ (inj₂ (inj₁ p)))) pattern #₄ p = node (inj₂ (inj₂ (inj₂ (inj₂ (inj₁ p))))) pattern #₅ p = node (inj₂ (inj₂ (inj₂ (inj₂ (inj₂ (inj₁ p)))))) pattern !#₀ p = node p pattern !#₁ p = node (inj₂ p) pattern !#₂ p = node (inj₂ (inj₂ p)) pattern !#₃ p = node (inj₂ (inj₂ (inj₂ p))) pattern !#₄ p = node (inj₂ (inj₂ (inj₂ (inj₂ p)))) pattern !#₅ p = node (inj₂ (inj₂ (inj₂ (inj₂ (inj₂ p)))))
{ "alphanum_fraction": 0.5051124744, "avg_line_length": 34.9285714286, "ext": "agda", "hexsha": "5de26d9e58db44a08e38116a6497c41994468a87", "lang": "Agda", "max_forks_count": 4, "max_forks_repo_forks_event_max_datetime": "2021-01-27T12:57:09.000Z", "max_forks_repo_forks_event_min_datetime": "2017-07-17T07:23:39.000Z", "max_forks_repo_head_hexsha": "e102b0ec232f2796232bd82bf8e3906c1f8a93fe", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "turion/Generic", "max_forks_repo_path": "src/Generic/Core.agda", "max_issues_count": 9, "max_issues_repo_head_hexsha": "e102b0ec232f2796232bd82bf8e3906c1f8a93fe", "max_issues_repo_issues_event_max_datetime": "2022-01-04T15:43:14.000Z", "max_issues_repo_issues_event_min_datetime": "2017-04-06T18:58:09.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "turion/Generic", "max_issues_repo_path": "src/Generic/Core.agda", "max_line_length": 94, "max_stars_count": 30, "max_stars_repo_head_hexsha": "e102b0ec232f2796232bd82bf8e3906c1f8a93fe", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "turion/Generic", "max_stars_repo_path": "src/Generic/Core.agda", "max_stars_repo_stars_event_max_datetime": "2022-02-05T10:19:38.000Z", "max_stars_repo_stars_event_min_datetime": "2016-07-19T21:10:54.000Z", "num_tokens": 1961, "size": 4401 }
{-# OPTIONS --cubical --safe --postfix-projections #-} module Data.Rational.Unnormalised where open import Prelude open import Data.Integer using (ℤ; ⁺) import Data.Integer as ℤ import Data.Nat as ℕ open import Data.Nat.DivMod using (nonZero) infixl 7 _/_ _/suc_ record ℚ : Type where constructor _/suc_ field num : ℤ den-pred : ℕ den : ℕ den = suc den-pred open ℚ public _/_ : (n : ℤ) → (d : ℕ) → ⦃ d≢0 : T (nonZero d) ⦄ → ℚ n / suc d = n /suc d {-# DISPLAY _/suc_ n d = n / suc d #-} infixl 6 _+_ _+_ : ℚ → ℚ → ℚ (x + y) .num = num x ℤ.* ⁺ (den y) ℤ.+ num y ℤ.* ⁺ (den x) (x + y) .den-pred = x .den-pred ℕ.+ y .den-pred ℕ.+ x .den-pred ℕ.* y .den-pred infixl 7 _*_ _*_ : ℚ → ℚ → ℚ (x * y) .num = x .num ℤ.* y .num (x * y) .den-pred = x .den-pred ℕ.+ y .den-pred ℕ.+ x .den-pred ℕ.* y .den-pred
{ "alphanum_fraction": 0.5829268293, "avg_line_length": 22.7777777778, "ext": "agda", "hexsha": "b0666bcadf783b9b4cc0f15674492c5824425ec5", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-11T12:30:21.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-11T12:30:21.000Z", "max_forks_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "oisdk/agda-playground", "max_forks_repo_path": "Data/Rational/Unnormalised.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "oisdk/agda-playground", "max_issues_repo_path": "Data/Rational/Unnormalised.agda", "max_line_length": 79, "max_stars_count": 6, "max_stars_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "oisdk/agda-playground", "max_stars_repo_path": "Data/Rational/Unnormalised.agda", "max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z", "max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z", "num_tokens": 349, "size": 820 }
------------------------------------------------------------------------ -- The Agda standard library -- -- This module is DEPRECATED. Please use -- Data.List.Relation.Binary.Permutation.Propositional.Properties -- directly. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.List.Relation.Binary.Permutation.Inductive.Properties where {-# WARNING_ON_IMPORT "Data.List.Relation.Binary.Permutation.Inductive.Properties was deprecated in v1.1. Use Data.List.Relation.Binary.Permutation.Propositional.Properties instead." #-} open import Data.List.Relation.Binary.Permutation.Propositional.Properties public
{ "alphanum_fraction": 0.6253687316, "avg_line_length": 35.6842105263, "ext": "agda", "hexsha": "0f1af353a72bf8e85e78cc446dd9011181deb22c", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_path": "agda-stdlib/src/Data/List/Relation/Binary/Permutation/Inductive/Properties.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_path": "agda-stdlib/src/Data/List/Relation/Binary/Permutation/Inductive/Properties.agda", "max_line_length": 83, "max_stars_count": 5, "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_path": "agda-stdlib/src/Data/List/Relation/Binary/Permutation/Inductive/Properties.agda", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "num_tokens": 122, "size": 678 }
-- This example comes from the discussion on Issue423. module SolveNeutralApplication where postulate A : Set a b : A T : A → Set mkT : ∀ a → T a data Bool : Set where true false : Bool f : Bool → A → A f true x = a f false x = b -- We can solve the constraint -- f x _4 == f x y -- with -- _4 := y -- since the application of f is neutral. g : (x : Bool)(y : A) → T (f x y) g x y = mkT (f x _)
{ "alphanum_fraction": 0.5893719807, "avg_line_length": 16.56, "ext": "agda", "hexsha": "09c870fcaef2c3a1d3afd5a28c0dba9bef7d766e", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "asr/agda-kanso", "max_forks_repo_path": "test/succeed/SolveNeutralApplication.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "asr/agda-kanso", "max_issues_repo_path": "test/succeed/SolveNeutralApplication.agda", "max_line_length": 54, "max_stars_count": null, "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_path": "test/succeed/SolveNeutralApplication.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 147, "size": 414 }
-- ASR (31 December 2015). The error message for this test was changed -- by fixing Issue 1763. module Issue586 where {-# NO_TERMINATION_CHECK #-} Foo : Set Foo = Foo
{ "alphanum_fraction": 0.7159763314, "avg_line_length": 18.7777777778, "ext": "agda", "hexsha": "32da5d007ad58c97a7ec27636a9bcf598bf20503", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Fail/Issue586.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Fail/Issue586.agda", "max_line_length": 70, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Fail/Issue586.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 46, "size": 169 }
-- Andreas, 2017-07-29, issue and test case by Nisse {-# OPTIONS --profile=interactive #-} A : Set A = {!Set!} -- Give to provoke error -- This issue concerns the AgdaInfo buffer, -- the behavior on the command line might be different. -- ERROR WAS (note the "Total 0ms"): -- Set₁ != Set -- when checking that the expression Set has type SetTotal 0ms -- Expected: -- Set₁ != Set -- when checking that the expression Set has type Set -- Issue2602.out: -- ... -- ((last . 1) . (agda2-goals-action '(0))) -- (agda2-verbose "Total 0ms ") -- (agda2-info-action "*Error*" "1,1-4 Set₁ != Set when checking that the expression Set has type Set" nil) -- ...
{ "alphanum_fraction": 0.6595419847, "avg_line_length": 26.2, "ext": "agda", "hexsha": "269f8ca7421aefdbabbcb3e92f5fa9d226761486", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "b5b3b1657556f720a7310cb7744edb1fac71eaf4", "max_forks_repo_licenses": [ "BSD-2-Clause" ], "max_forks_repo_name": "Seanpm2001-Agda-lang/agda", "max_forks_repo_path": "test/interaction/Issue2602.agda", "max_issues_count": 6, "max_issues_repo_head_hexsha": "b5b3b1657556f720a7310cb7744edb1fac71eaf4", "max_issues_repo_issues_event_max_datetime": "2021-11-24T08:31:10.000Z", "max_issues_repo_issues_event_min_datetime": "2021-10-18T08:12:24.000Z", "max_issues_repo_licenses": [ "BSD-2-Clause" ], "max_issues_repo_name": "Seanpm2001-Agda-lang/agda", "max_issues_repo_path": "test/interaction/Issue2602.agda", "max_line_length": 107, "max_stars_count": 1, "max_stars_repo_head_hexsha": "6b13364d36eeb60d8ec15eaf8effe23c73401900", "max_stars_repo_licenses": [ "BSD-2-Clause" ], "max_stars_repo_name": "sseefried/agda", "max_stars_repo_path": "test/interaction/Issue2602.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-05T00:25:14.000Z", "max_stars_repo_stars_event_min_datetime": "2022-03-05T00:25:14.000Z", "num_tokens": 189, "size": 655 }
import cedille-options open import general-util module untyped-spans (options : cedille-options.options) {F : Set → Set} {{monadF : monad F}} where open import lib open import ctxt open import cedille-types open import conversion open import spans options {F} open import syntax-util open import to-string options open import is-free {-# TERMINATING #-} untyped-term-spans : term → spanM ⊤ untyped-type-spans : type → spanM ⊤ untyped-kind-spans : kind → spanM ⊤ untyped-tk-spans : tk → spanM ⊤ untyped-liftingType-spans : liftingType → spanM ⊤ untyped-optTerm-spans : optTerm → spanM (posinfo → posinfo) untyped-optType-spans : optType → spanM ⊤ untyped-optGuide-spans : optGuide → spanM (𝕃 tagged-val) untyped-lterms-spans : lterms → spanM ⊤ untyped-optClass-spans : optClass → spanM ⊤ untyped-defTermOrType-spans : posinfo → (ctxt → posinfo → var → (atk : tk) → (if tk-is-type atk then term else type) → span) → defTermOrType → spanM ⊤ → spanM ⊤ untyped-var-spans : posinfo → var → (ctxt → posinfo → var → checking-mode → 𝕃 tagged-val → err-m → span) → spanM ⊤ → spanM ⊤ untyped-caseArgs-spans : caseArgs → (body : term) → spanM (𝕃 tagged-val) untyped-case-spans : case → (ℕ → ℕ → err-m) → spanM ((ℕ → ℕ → err-m) × 𝕃 tagged-val) untyped-cases-spans : cases → spanM (err-m × 𝕃 tagged-val) untyped-var-spans pi x f m = get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi x Γ) (get-ctxt λ Γ → spanM-add (f Γ pi x untyped [] nothing) ≫span m) untyped-term-spans (App t me t') = untyped-term-spans t ≫span untyped-term-spans t' ≫span spanM-add (App-span ff t t' untyped [] nothing) untyped-term-spans (AppTp t T) = untyped-term-spans t ≫span untyped-type-spans T ≫span spanM-add (AppTp-span t T untyped [] nothing) untyped-term-spans (Beta pi ot ot') = untyped-optTerm-spans ot ≫=span λ f → untyped-optTerm-spans ot' ≫=span λ f' → spanM-add (Beta-span pi (f' (f (posinfo-plus pi 1))) untyped [] nothing) untyped-term-spans (Chi pi mT t) = untyped-optType-spans mT ≫span untyped-term-spans t ≫span get-ctxt λ Γ → spanM-add (Chi-span Γ pi mT t untyped [] nothing) untyped-term-spans (Delta pi mT t) = untyped-optType-spans mT ≫span untyped-term-spans t ≫span get-ctxt λ Γ → spanM-add (Delta-span Γ pi mT t untyped [] nothing) untyped-term-spans (Epsilon pi lr mm t) = untyped-term-spans t ≫span spanM-add (Epsilon-span pi lr mm t untyped [] nothing) untyped-term-spans (Hole pi) = get-ctxt λ Γ → spanM-add (hole-span Γ pi nothing []) untyped-term-spans (IotaPair pi t t' og pi') = untyped-term-spans t ≫span untyped-term-spans t' ≫span untyped-optGuide-spans og ≫=span λ tvs → spanM-add (IotaPair-span pi pi' untyped tvs nothing) untyped-term-spans (IotaProj t n pi) = untyped-term-spans t ≫span spanM-add (IotaProj-span t pi untyped [] nothing) untyped-term-spans (Lam pi me pi' x oc t) = untyped-optClass-spans oc ≫span get-ctxt λ Γ → spanM-add (Lam-span Γ untyped pi pi' me x (Tkt $ TpHole pi) t [] occursCheck) ≫span untyped-var-spans pi' x Var-span (untyped-term-spans t) where occursCheck = maybe-if (me && is-free-in skip-erased x t) ≫maybe just "The bound variable occurs free in the erasure of the body (not allowed)" untyped-term-spans (Let pi fe d t) = untyped-defTermOrType-spans pi (λ Γ pi' x atk val → Let-span Γ untyped pi pi' fe x atk val t [] nothing) d (untyped-term-spans t) -- ≫span get-ctxt λ Γ → spanM-add (Let-span Γ untyped pi d t [] nothing) untyped-term-spans (Open pi o pi' x t) = get-ctxt λ Γ → spanM-add (Open-span Γ o pi' x t untyped [] nothing) ≫span spanM-add (Var-span Γ pi' x untyped [] (maybe-not (ctxt-lookup-term-loc Γ x) ≫maybe just "This term variable is not currently in scope")) ≫span untyped-term-spans t untyped-term-spans (Parens pi t pi') = untyped-term-spans t untyped-term-spans (Phi pi t t' t'' pi') = untyped-term-spans t ≫span untyped-term-spans t' ≫span untyped-term-spans t'' ≫span spanM-add (Phi-span pi pi' untyped [] nothing) untyped-term-spans (Rho pi op on t og t') = untyped-term-spans t ≫span untyped-term-spans t' ≫span untyped-optGuide-spans og ≫=span λ tvs → spanM-add (mk-span "Rho" pi (term-end-pos t') (ll-data-term :: checking-data untyped :: tvs) nothing) untyped-term-spans (Sigma pi t) = untyped-term-spans t ≫span get-ctxt λ Γ → spanM-add (mk-span "Sigma" pi (term-end-pos t) (ll-data-term :: [ checking-data untyped ]) nothing) untyped-term-spans (Theta pi θ t ls) = untyped-term-spans t ≫span untyped-lterms-spans ls ≫span get-ctxt λ Γ → spanM-add (Theta-span Γ pi θ t ls untyped [] nothing) untyped-term-spans (Var pi x) = get-ctxt λ Γ → spanM-add (Var-span Γ pi x untyped [] (if ctxt-binds-var Γ x then nothing else just "This variable is not currently in scope.")) untyped-term-spans (Mu pi pi' x t ot pi'' cs pi''') = get-ctxt λ Γ → untyped-term-spans t ≫span with-ctxt (ctxt-var-decl x Γ) (get-ctxt λ Γ → spanM-add (Var-span Γ pi' x untyped [ binder-data (ctxt-var-decl-loc pi' x Γ) pi' x (Tkt (TpHole pi')) NotErased nothing pi'' pi''' ] nothing) ≫span untyped-cases-spans cs) ≫=span uncurry λ e ts → spanM-add (Mu-span Γ pi (just x) pi''' (optType-elim ot nothing just) untyped ts e) untyped-term-spans (Mu' pi ot t oT pi' cs pi'') = get-ctxt λ Γ → untyped-optTerm-spans ot ≫span untyped-term-spans t ≫span untyped-optType-spans oT ≫span untyped-cases-spans cs ≫=span uncurry λ e ts → spanM-add (Mu-span Γ pi nothing pi'' (optType-elim oT nothing just) untyped ts e) untyped-caseArgs-spans [] t = untyped-term-spans t ≫span spanMr [] untyped-caseArgs-spans (c :: cs) t with caseArg-to-var c ...| pi , x , me , ll = let e? = maybe-if (me && is-free-in skip-erased x (caseArgs-to-lams cs t)) ≫maybe just "The bound variable occurs free in the erasure of the body (not allowed)" f = if ll then Var-span else TpVar-span in get-ctxt λ Γ → spanM-add (f (ctxt-var-decl-loc pi x Γ) pi x untyped [] e?) ≫span with-ctxt (ctxt-var-decl x Γ) (untyped-caseArgs-spans cs t) ≫=span λ ts → spanMr (binder-data (ctxt-var-decl x Γ) pi x (if ll then Tkt (TpHole pi) else Tkk star) me nothing (term-start-pos t) (term-end-pos t) :: ts) untyped-case-spans (Case pi x cas t) fₑ = get-ctxt λ Γ → let m = untyped-caseArgs-spans cas t x' = unqual-all (ctxt-get-qualif Γ) $ unqual-local x eᵤ = just $ "This is not a valid constructor name" eₗ = just $ "Constructor's datatype has a different number of constructors than " ^ x' eᵢ = just $ "This constructor overlaps with " ^ x' in case qual-lookup Γ x of λ where (just (as , ctr-def ps? T Cₗ cᵢ cₐ , _ , _)) → spanM-add (Var-span Γ pi x untyped [] $ fₑ Cₗ cᵢ) ≫span m ≫=span λ s → spanMr ((λ Cₗ' cᵢ' → if Cₗ =ℕ Cₗ' then if cᵢ =ℕ cᵢ' then eᵢ else nothing else eₗ) , s) _ → spanM-add (Var-span Γ pi x untyped [] eᵤ) ≫span m ≫=span λ s → spanMr ((λ _ _ → nothing) , s) untyped-cases-spans ms = let eₗ = just $ "Constructor's datatype should have " ^ ℕ-to-string (length ms) ^ " constructor" ^ (if 1 =ℕ length ms then "" else "s") in (λ c → foldr c (λ _ → spanMr (nothing , [])) ms λ Cₗ cᵢ → if Cₗ =ℕ length ms then nothing else eₗ) λ c m fₑ → untyped-case-spans c fₑ ≫=span uncurry λ e s → m e ≫=span (spanMr ∘ map-snd (s ++_)) untyped-type-spans (Abs pi me pi' x atk T) = untyped-tk-spans atk ≫span untyped-var-spans pi' x (if tk-is-type atk then Var-span else TpVar-span) (get-ctxt λ Γ → spanM-add (TpQuant-span Γ (~ me) pi pi' x atk T untyped [] nothing) ≫span untyped-type-spans T) untyped-type-spans (Iota pi pi' x T T') = untyped-type-spans T ≫span untyped-var-spans pi' x TpVar-span (get-ctxt λ Γ → spanM-add (Iota-span Γ pi pi' x T' untyped [] nothing) ≫span untyped-type-spans T') untyped-type-spans (Lft pi pi' x t lT) = untyped-liftingType-spans lT ≫span untyped-var-spans pi' x Var-span (get-ctxt λ Γ → spanM-add (Lft-span Γ pi pi' x t untyped [] nothing) ≫span untyped-term-spans t) untyped-type-spans (NoSpans T pi) = spanMok untyped-type-spans (TpApp T T') = untyped-type-spans T ≫span untyped-type-spans T' ≫span spanM-add (TpApp-span T T' untyped [] nothing) untyped-type-spans (TpAppt T t) = untyped-type-spans T ≫span untyped-term-spans t ≫span spanM-add (TpAppt-span T t untyped [] nothing) untyped-type-spans (TpArrow T a T') = untyped-type-spans T ≫span untyped-type-spans T' ≫span spanM-add (TpArrow-span T T' untyped [] nothing) untyped-type-spans (TpEq pi t t' pi') = untyped-term-spans t ≫span untyped-term-spans t' ≫span spanM-add (TpEq-span pi t t' pi' untyped [] nothing) untyped-type-spans (TpHole pi) = get-ctxt λ Γ → spanM-add (tp-hole-span Γ pi nothing []) untyped-type-spans (TpLambda pi pi' x atk T) = untyped-tk-spans atk ≫span untyped-var-spans pi' x TpVar-span (get-ctxt λ Γ → spanM-add (TpLambda-span Γ pi pi' x atk T untyped [] nothing) ≫span untyped-type-spans T) untyped-type-spans (TpParens pi T pi') = untyped-type-spans T untyped-type-spans (TpVar pi x) = get-ctxt λ Γ → spanM-add (TpVar-span Γ pi x untyped [] (if ctxt-binds-var Γ x then nothing else just "This variable is not currently in scope.")) untyped-type-spans (TpLet pi d T) = untyped-defTermOrType-spans pi (λ Γ pi' x atk val → TpLet-span Γ untyped pi pi' x atk val T [] nothing) d (untyped-type-spans T) --≫span get-ctxt λ Γ → spanM-add (TpLet-span Γ untyped pi d T [] nothing) untyped-kind-spans (KndArrow k k') = untyped-kind-spans k ≫span untyped-kind-spans k' ≫span spanM-add (KndArrow-span k k' untyped nothing) untyped-kind-spans (KndParens pi k pi') = untyped-kind-spans k untyped-kind-spans (KndPi pi pi' x atk k) = untyped-tk-spans atk ≫span untyped-var-spans pi' x (if tk-is-type atk then Var-span else TpVar-span) (get-ctxt λ Γ → spanM-add (KndPi-span Γ pi pi' x atk k untyped nothing) ≫span untyped-kind-spans k) untyped-kind-spans (KndTpArrow T k) = untyped-type-spans T ≫span untyped-kind-spans k ≫span spanM-add (KndTpArrow-span T k untyped nothing) untyped-kind-spans (KndVar pi x as) = get-ctxt λ Γ → spanM-add (KndVar-span Γ (pi , x) (kvar-end-pos pi x as) [] untyped [] (if ctxt-binds-var Γ x then nothing else just "This variable is not currently in scope.")) untyped-kind-spans (Star pi) = spanM-add (Star-span pi untyped nothing) untyped-liftingType-spans lT = spanMok -- Unimplemented untyped-tk-spans (Tkt T) = untyped-type-spans T untyped-tk-spans (Tkk k) = untyped-kind-spans k untyped-optTerm-spans NoTerm = spanMr λ pi → pi untyped-optTerm-spans (SomeTerm t pi) = untyped-term-spans t ≫span spanMr λ _ → pi untyped-optType-spans NoType = spanMok untyped-optType-spans (SomeType T) = untyped-type-spans T untyped-optGuide-spans NoGuide = spanMr [] untyped-optGuide-spans (Guide pi x T) = untyped-var-spans pi x Var-span (untyped-type-spans T) ≫span get-ctxt λ Γ → spanMr [ binder-data Γ pi x (Tkt $ TpHole pi) NotErased nothing (type-start-pos T) (type-end-pos T) ] untyped-lterms-spans [] = spanMok untyped-lterms-spans ((Lterm me t) :: ls) = untyped-term-spans t ≫span untyped-lterms-spans ls untyped-optClass-spans NoClass = spanMok untyped-optClass-spans (SomeClass atk) = untyped-tk-spans atk untyped-defTermOrType-spans pi s (DefTerm pi' x NoType t) m = untyped-term-spans t ≫span get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi' x Γ) $ get-ctxt λ Γ → spanM-add (s Γ pi' x (Tkt $ TpHole pi') t) ≫span spanM-add (Var-span Γ pi' x untyped [] nothing) ≫span m untyped-defTermOrType-spans pi s (DefTerm pi' x (SomeType tp) t) m = untyped-type-spans tp ≫span untyped-term-spans t ≫span get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi' x Γ) $ get-ctxt λ Γ → spanM-add (s Γ pi' x (Tkt $ TpHole pi') t) ≫span spanM-add (Var-span Γ pi' x untyped [] nothing) ≫span m untyped-defTermOrType-spans pi s (DefType pi' x k tp) m = untyped-kind-spans k ≫span untyped-type-spans tp ≫span get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi' x Γ) $ get-ctxt λ Γ → spanM-add (s Γ pi' x (Tkk k) tp) ≫span spanM-add (TpVar-span Γ pi' x untyped [] nothing) ≫span m
{ "alphanum_fraction": 0.689516129, "avg_line_length": 74.8679245283, "ext": "agda", "hexsha": "021abbf1327a9f1815c4643406bec24ab6cce33e", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "f5ce42258b7d9bc66f75cd679c785d6133b82b58", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "CarlOlson/cedille", "max_forks_repo_path": "src/untyped-spans.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "f5ce42258b7d9bc66f75cd679c785d6133b82b58", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "CarlOlson/cedille", "max_issues_repo_path": "src/untyped-spans.agda", "max_line_length": 422, "max_stars_count": null, "max_stars_repo_head_hexsha": "f5ce42258b7d9bc66f75cd679c785d6133b82b58", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "CarlOlson/cedille", "max_stars_repo_path": "src/untyped-spans.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 4137, "size": 11904 }
module Builtin where open import Agda.Primitive data Bool : Set where false : Bool true : Bool not : Bool -> Bool not true = false not false = true _||_ : Bool -> Bool -> Bool true || _ = true false || x = x _&&_ : Bool -> Bool -> Bool true && x = x false && _ = false {-# BUILTIN BOOL Bool #-} {-# BUILTIN TRUE true #-} {-# BUILTIN FALSE false #-} data Nat : Set where zero : Nat suc : Nat -> Nat {-# BUILTIN NATURAL Nat #-} zero' : Nat zero' = 0 one : Nat one = 1 data Int : Set where pos : Nat → Int negsuc : Nat → Int postulate String : Set Float : Set Char : Set {-# BUILTIN INTEGER Int #-} {-# BUILTIN INTEGERPOS pos #-} {-# BUILTIN INTEGERNEGSUC negsuc #-} {-# BUILTIN STRING String #-} {-# BUILTIN FLOAT Float #-} {-# BUILTIN CHAR Char #-} data Maybe (A : Set) : Set where just : A → Maybe A nothing : Maybe A {-# BUILTIN MAYBE Maybe #-} record Sigma {a b} (A : Set a) (B : A → Set b) : Set (a ⊔ b) where constructor _,_ field fst : A snd : B fst open Sigma public infixr 4 _,_ {-# BUILTIN SIGMA Sigma #-} infixr 10 _::_ data List (A : Set) : Set where nil : List A _::_ : A -> List A -> List A {-# BUILTIN LIST List #-} postulate Word64 : Set {-# BUILTIN WORD64 Word64 #-} primitive -- Integer functions primShowInteger : Int -> String -- Floating point function primFloatInequality : Float → Float → Bool primFloatEquality : Float → Float → Bool primFloatLess : Float → Float → Bool primFloatIsInfinite : Float → Bool primFloatIsNaN : Float → Bool primFloatIsNegativeZero : Float → Bool primFloatToWord64 : Float → Word64 primNatToFloat : Nat → Float primIntToFloat : Int → Float primFloatRound : Float → Maybe Int primFloatFloor : Float → Maybe Int primFloatCeiling : Float → Maybe Int primFloatToRatio : Float → (Sigma Int λ _ → Int) primRatioToFloat : Int → Int → Float primFloatDecode : Float → Maybe (Sigma Int λ _ → Int) primFloatEncode : Int → Int → Maybe Float primShowFloat : Float → String primFloatPlus : Float → Float → Float primFloatMinus : Float → Float → Float primFloatTimes : Float → Float → Float primFloatDiv : Float → Float → Float primFloatNegate : Float → Float primFloatSqrt : Float → Float primFloatExp : Float → Float primFloatLog : Float → Float primFloatSin : Float → Float primFloatCos : Float → Float primFloatTan : Float → Float primFloatASin : Float → Float primFloatACos : Float → Float primFloatATan : Float → Float primFloatATan2 : Float → Float → Float primFloatSinh : Float → Float primFloatCosh : Float → Float primFloatTanh : Float → Float primFloatASinh : Float → Float primFloatACosh : Float → Float primFloatATanh : Float → Float primFloatPow : Float → Float → Float -- Character functions primCharEquality : Char -> Char -> Bool primIsLower : Char -> Bool primIsDigit : Char -> Bool primIsAlpha : Char -> Bool primIsSpace : Char -> Bool primIsAscii : Char -> Bool primIsLatin1 : Char -> Bool primIsPrint : Char -> Bool primIsHexDigit : Char -> Bool primToUpper : Char -> Char primToLower : Char -> Char primCharToNat : Char -> Nat primNatToChar : Nat -> Char -- partial primShowChar : Char -> String -- String functions primStringToList : String -> List Char primStringFromList : List Char -> String primStringAppend : String -> String -> String primStringEquality : String -> String -> Bool primShowString : String -> String isLower : Char -> Bool isLower = primIsLower isAlpha : Char -> Bool isAlpha = primIsAlpha isUpper : Char -> Bool isUpper c = isAlpha c && not (isLower c) infixl 14 _/_ nat0 = primCharToNat '\0' int0 = pos nat0 _/_ = primFloatDiv pi : Float pi = 3.141592653589793 sin : Float -> Float sin = primFloatSin cos : Float -> Float cos = primFloatCos tan : Float -> Float tan = primFloatTan reverse : {A : Set} -> List A -> List A reverse xs = rev xs nil where rev : {A : Set} -> List A -> List A -> List A rev nil ys = ys rev (x :: xs) ys = rev xs (x :: ys) infixr 20 _∘_ _∘_ : {A B C : Set} -> (B -> C) -> (A -> B) -> A -> C f ∘ g = \x -> f (g x) map : {A B : Set} -> (A -> B) -> List A -> List B map f nil = nil map f (x :: xs) = f x :: map f xs stringAsList : (List Char -> List Char) -> String -> String stringAsList f = primStringFromList ∘ f ∘ primStringToList revStr : String -> String revStr = stringAsList reverse mapStr : (Char -> Char) -> String -> String mapStr f = stringAsList (map f) -- Testing unicode literals uString = "åäö⊢ξ∀" uChar = '∀' data _≡_ {a} {A : Set a} (x : A) : A → Set a where refl : x ≡ x thm-show-pos : primShowInteger (pos 42) ≡ "42" thm-show-pos = refl thm-show-neg : primShowInteger (negsuc 41) ≡ "-42" thm-show-neg = refl thm-floor : primFloatFloor 4.2 ≡ just (pos 4) thm-floor = refl thm-ceiling : primFloatCeiling -5.1 ≡ just (negsuc 4) thm-ceiling = refl
{ "alphanum_fraction": 0.5794069492, "avg_line_length": 24.9863636364, "ext": "agda", "hexsha": "be57f8c69cd757a97a28ba1916ebc99231a95e92", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "shlevy/agda", "max_forks_repo_path": "test/Succeed/Builtin.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "shlevy/agda", "max_issues_repo_path": "test/Succeed/Builtin.agda", "max_line_length": 66, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "shlevy/agda", "max_stars_repo_path": "test/Succeed/Builtin.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 1637, "size": 5497 }
module PiFrac.Interp where open import Data.Empty open import Data.Unit hiding (_≟_) open import Data.Sum open import Data.Product open import Data.Maybe open import Relation.Binary.Core open import Relation.Binary open import Relation.Nullary open import Relation.Binary.PropositionalEquality open import Function using (_∘_) open import PiFrac.Syntax open import PiFrac.Opsem interp : {t₁ t₂ : 𝕌} → (t₁ ↔ t₂) → ⟦ t₁ ⟧ → Maybe ⟦ t₂ ⟧ interp unite₊l (inj₂ v) = just v interp uniti₊l v = just (inj₂ v) interp swap⋆ (v₁ , v₂) = just (v₂ , v₁) interp swap₊ (inj₁ v) = just (inj₂ v) interp swap₊ (inj₂ v) = just (inj₁ v) interp assocl₊ (inj₁ v) = just (inj₁ (inj₁ v)) interp assocl₊ (inj₂ (inj₁ v)) = just (inj₁ (inj₂ v)) interp assocl₊ (inj₂ (inj₂ v)) = just (inj₂ v) interp assocr₊ (inj₁ (inj₁ v)) = just (inj₁ v) interp assocr₊ (inj₁ (inj₂ v)) = just (inj₂ (inj₁ v)) interp assocr₊ (inj₂ v) = just (inj₂ (inj₂ v)) interp unite⋆l v = just (proj₂ v) interp uniti⋆l v = just (tt , v) interp assocl⋆ (v₁ , v₂ , v₃) = just ((v₁ , v₂) , v₃) interp assocr⋆ ((v₁ , v₂) , v₃) = just (v₁ , v₂ , v₃) interp dist (inj₁ v₁ , v₃) = just (inj₁ (v₁ , v₃)) interp dist (inj₂ v₂ , v₃) = just (inj₂ (v₂ , v₃)) interp factor (inj₁ (v₁ , v₃)) = just (inj₁ v₁ , v₃) interp factor (inj₂ (v₂ , v₃)) = just (inj₂ v₂ , v₃) interp id↔ v = just v interp (c₁ ⊕ c₂) (inj₁ v) = interp c₁ v >>= just ∘ inj₁ interp (c₁ ⊕ c₂) (inj₂ v) = interp c₂ v >>= just ∘ inj₂ interp (c₁ ⊗ c₂) (v₁ , v₂) = interp c₁ v₁ >>= (λ v₁' → interp c₂ v₂ >>= λ v₂' → just (v₁' , v₂')) interp (c₁ ⨾ c₂) v = interp c₁ v >>= interp c₂ interp (ηₓ v) tt = just (v , ↻) interp (εₓ v) (v' , ○) with v ≟ v' ... | yes _ = just tt ... | no _ = nothing
{ "alphanum_fraction": 0.6110793832, "avg_line_length": 38.0652173913, "ext": "agda", "hexsha": "2f2b042348c701f30ceafdcc8d02ed9480a3884f", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "DreamLinuxer/popl21-artifact", "max_forks_repo_path": "PiFrac/Interp.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "DreamLinuxer/popl21-artifact", "max_issues_repo_path": "PiFrac/Interp.agda", "max_line_length": 59, "max_stars_count": 5, "max_stars_repo_head_hexsha": "fb380f2e67dcb4a94f353dbaec91624fcb5b8933", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "DreamLinuxer/popl21-artifact", "max_stars_repo_path": "PiFrac/Interp.agda", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "num_tokens": 741, "size": 1751 }
------------------------------------------------------------------------------ -- Elimination properties for the inequalities ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Data.Nat.Inequalities.EliminationPropertiesATP where open import FOTC.Base open import FOTC.Data.Nat open import FOTC.Data.Nat.Inequalities ------------------------------------------------------------------------------ 0<0→⊥ : ¬ (zero < zero) 0<0→⊥ h = prf where postulate prf : ⊥ {-# ATP prove prf #-} x<0→⊥ : ∀ {n} → N n → ¬ (n < zero) x<0→⊥ nzero h = prf where postulate prf : ⊥ {-# ATP prove prf #-} x<0→⊥ (nsucc Nn) h = prf where postulate prf : ⊥ {-# ATP prove prf #-} x<x→⊥ : ∀ {n} → N n → ¬ (n < n) x<x→⊥ nzero h = prf where postulate prf : ⊥ {-# ATP prove prf #-} x<x→⊥ (nsucc {n} Nn) h = prf (x<x→⊥ Nn) where postulate prf : ¬ (n < n) → ⊥ {-# ATP prove prf #-} 0>x→⊥ : ∀ {n} → N n → ¬ (zero > n) 0>x→⊥ nzero h = prf where postulate prf : ⊥ {-# ATP prove prf #-} 0>x→⊥ (nsucc Nn) h = prf where postulate prf : ⊥ {-# ATP prove prf #-} S≤0→⊥ : ∀ {n} → N n → ¬ (succ₁ n ≤ zero) S≤0→⊥ nzero h = prf where postulate prf : ⊥ {-# ATP prove prf #-} S≤0→⊥ (nsucc {n} Nn) h = prf where postulate prf : ⊥ {-# ATP prove prf #-} 0≥S→⊥ : ∀ {n} → N n → ¬ (zero ≥ succ₁ n) 0≥S→⊥ Nn h = prf where postulate prf : ⊥ {-# ATP prove prf S≤0→⊥ #-} postulate S≯0→⊥ : ∀ {n} → ¬ (succ₁ n ≯ zero) {-# ATP prove S≯0→⊥ #-} x<y→y<x→⊥ : ∀ {m n} → N m → N n → m < n → ¬ (n < m) x<y→y<x→⊥ nzero Nn h₁ h₂ = prf where postulate prf : ⊥ {-# ATP prove prf 0>x→⊥ #-} x<y→y<x→⊥ (nsucc Nm) nzero h₁ h₂ = prf where postulate prf : ⊥ {-# ATP prove prf 0>x→⊥ #-} x<y→y<x→⊥ (nsucc {m} Nm) (nsucc {n} Nn) h₁ h₂ = prf (x<y→y<x→⊥ Nm Nn m<n) where postulate m<n : m < n {-# ATP prove m<n #-} postulate prf : ¬ (n < m) → ⊥ {-# ATP prove prf #-} x>y→x≤y→⊥ : ∀ {m n} → N m → N n → m > n → ¬ (m ≤ n) x>y→x≤y→⊥ nzero Nn h₁ h₂ = prf where postulate prf : ⊥ {-# ATP prove prf x<0→⊥ #-} x>y→x≤y→⊥ (nsucc Nm) nzero h₁ h₂ = prf where postulate prf : ⊥ {-# ATP prove prf x<0→⊥ #-} x>y→x≤y→⊥ (nsucc {m} Nm) (nsucc {n} Nn) h₁ h₂ = prf (x>y→x≤y→⊥ Nm Nn m>n) where postulate m>n : m > n {-# ATP prove m>n #-} postulate prf : ¬ (m ≤ n) → ⊥ {-# ATP prove prf #-}
{ "alphanum_fraction": 0.4502332815, "avg_line_length": 27.9565217391, "ext": "agda", "hexsha": "8fa4d94ece065c67d193bb7f9d8314192a70d25f", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "asr/fotc", "max_forks_repo_path": "src/fot/FOTC/Data/Nat/Inequalities/EliminationPropertiesATP.agda", "max_issues_count": 2, "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "asr/fotc", "max_issues_repo_path": "src/fot/FOTC/Data/Nat/Inequalities/EliminationPropertiesATP.agda", "max_line_length": 78, "max_stars_count": 11, "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/fotc", "max_stars_repo_path": "src/fot/FOTC/Data/Nat/Inequalities/EliminationPropertiesATP.agda", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "num_tokens": 1078, "size": 2572 }
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import cohomology.Theory module cohomology.Sphere {i} (OT : OrdinaryTheory i) where open OrdinaryTheory OT abstract C-Sphere-≠-is-trivial : (n : ℤ) (m : ℕ) → (n ≠ ℕ-to-ℤ m) → is-trivialᴳ (C n (⊙Lift (⊙Sphere m))) C-Sphere-≠-is-trivial n O n≠0 = C-dimension n≠0 C-Sphere-≠-is-trivial n (S m) n≠Sm = iso-preserves'-trivial (C n (⊙Lift (⊙Sphere (S m))) ≃ᴳ⟨ C-emap n $ ⊙Susp-Lift-econv (⊙Sphere m) ⟩ C n (⊙Susp (⊙Lift (⊙Sphere m))) ≃ᴳ⟨ transportᴳ-iso (λ n → C n (⊙Susp (⊙Lift (⊙Sphere m)))) (succ-pred n) ⁻¹ᴳ ⟩ C (succ (pred n)) (⊙Susp (⊙Lift (⊙Sphere m))) ≃ᴳ⟨ C-Susp (pred n) (⊙Lift (⊙Sphere m)) ⟩ C (pred n) (⊙Lift (⊙Sphere m)) ≃ᴳ∎) (C-Sphere-≠-is-trivial (pred n) m (pred-≠ n≠Sm)) C-Sphere-diag : (m : ℕ) → C (ℕ-to-ℤ m) (⊙Lift (⊙Sphere m)) ≃ᴳ C2 0 C-Sphere-diag O = idiso _ C-Sphere-diag (S m) = C (ℕ-to-ℤ (S m)) (⊙Lift (⊙Sphere (S m))) ≃ᴳ⟨ C-emap (ℕ-to-ℤ (S m)) (⊙Susp-Lift-econv (⊙Sphere m)) ⟩ C (ℕ-to-ℤ (S m)) (⊙Susp (⊙Lift (⊙Sphere m))) ≃ᴳ⟨ C-Susp (ℕ-to-ℤ m) (⊙Lift (⊙Sphere m)) ⟩ C (ℕ-to-ℤ m) (⊙Lift (⊙Sphere m)) ≃ᴳ⟨ C-Sphere-diag m ⟩ C 0 (⊙Lift ⊙S⁰) ≃ᴳ∎
{ "alphanum_fraction": 0.5431893688, "avg_line_length": 33.4444444444, "ext": "agda", "hexsha": "80a8925685f6c522e11c8407ccae1331b845351e", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "timjb/HoTT-Agda", "max_forks_repo_path": "theorems/cohomology/Sphere.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "timjb/HoTT-Agda", "max_issues_repo_path": "theorems/cohomology/Sphere.agda", "max_line_length": 84, "max_stars_count": null, "max_stars_repo_head_hexsha": "66f800adef943afdf08c17b8ecfba67340fead5e", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "timjb/HoTT-Agda", "max_stars_repo_path": "theorems/cohomology/Sphere.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 661, "size": 1204 }
{-# OPTIONS --without-K #-} open import HoTT open import cohomology.Exactness open import cohomology.Theory {- Cohomology functor sends constant functions to constant functions -} module cohomology.ConstantFunction {i} (CT : CohomologyTheory i) where open import cohomology.Unit CT open CohomologyTheory CT module _ (n : ℤ) {X Y : Ptd i} where CF-cst : CF-hom n (⊙cst {X = X} {Y = Y}) == cst-hom CF-cst = CF-hom n (⊙cst {X = PLU} ⊙∘ ⊙cst {X = X}) =⟨ CF-comp n ⊙cst ⊙cst ⟩ (CF-hom n (⊙cst {X = X})) ∘ᴳ (CF-hom n (⊙cst {X = PLU})) =⟨ hom= (CF-hom n (⊙cst {X = PLU})) cst-hom (λ= (λ _ → prop-has-all-paths (C-Unit-is-prop n) _ _)) |in-ctx (λ w → CF-hom n (⊙cst {X = X} {Y = PLU}) ∘ᴳ w) ⟩ (CF-hom n (⊙cst {X = X} {Y = PLU})) ∘ᴳ cst-hom =⟨ pre∘-cst-hom (CF-hom n (⊙cst {X = X} {Y = PLU})) ⟩ cst-hom ∎ where PLU = ⊙Lift {j = i} ⊙Unit
{ "alphanum_fraction": 0.5530973451, "avg_line_length": 30.1333333333, "ext": "agda", "hexsha": "0a9991ce8301f17af74d15976e385bc594786208", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "1695a7f3dc60177457855ae846bbd86fcd96983e", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "danbornside/HoTT-Agda", "max_forks_repo_path": "cohomology/ConstantFunction.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "1695a7f3dc60177457855ae846bbd86fcd96983e", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "danbornside/HoTT-Agda", "max_issues_repo_path": "cohomology/ConstantFunction.agda", "max_line_length": 71, "max_stars_count": null, "max_stars_repo_head_hexsha": "1695a7f3dc60177457855ae846bbd86fcd96983e", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "danbornside/HoTT-Agda", "max_stars_repo_path": "cohomology/ConstantFunction.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 403, "size": 904 }
-- Andreas, 2018-10-29, issue #3331 -- Document that using and renaming lists cannot overlap. open import Agda.Builtin.Bool using (true) renaming (true to tt) -- Expected error: -- Repeated name in import directive: true
{ "alphanum_fraction": 0.7410714286, "avg_line_length": 24.8888888889, "ext": "agda", "hexsha": "d6e83897cbbc1a7b4132046b5bfe2a52b44bc737", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_path": "test/Fail/Issue3331.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "shlevy/agda", "max_issues_repo_path": "test/Fail/Issue3331.agda", "max_line_length": 64, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "shlevy/agda", "max_stars_repo_path": "test/Fail/Issue3331.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 57, "size": 224 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Many properties which hold for _∼_ also hold for _∼_ on f ------------------------------------------------------------------------ open import Relation.Binary module Relation.Binary.On where open import Function open import Data.Product module _ {a b} {A : Set a} {B : Set b} (f : B → A) where implies : ∀ {ℓ₁ ℓ₂} (≈ : Rel A ℓ₁) (∼ : Rel A ℓ₂) → ≈ ⇒ ∼ → (≈ on f) ⇒ (∼ on f) implies _ _ impl = impl reflexive : ∀ {ℓ} (∼ : Rel A ℓ) → Reflexive ∼ → Reflexive (∼ on f) reflexive _ refl = refl irreflexive : ∀ {ℓ₁ ℓ₂} (≈ : Rel A ℓ₁) (∼ : Rel A ℓ₂) → Irreflexive ≈ ∼ → Irreflexive (≈ on f) (∼ on f) irreflexive _ _ irrefl = irrefl symmetric : ∀ {ℓ} (∼ : Rel A ℓ) → Symmetric ∼ → Symmetric (∼ on f) symmetric _ sym = sym transitive : ∀ {ℓ} (∼ : Rel A ℓ) → Transitive ∼ → Transitive (∼ on f) transitive _ trans = trans antisymmetric : ∀ {ℓ₁ ℓ₂} (≈ : Rel A ℓ₁) (≤ : Rel A ℓ₂) → Antisymmetric ≈ ≤ → Antisymmetric (≈ on f) (≤ on f) antisymmetric _ _ antisym = antisym asymmetric : ∀ {ℓ} (< : Rel A ℓ) → Asymmetric < → Asymmetric (< on f) asymmetric _ asym = asym respects : ∀ {ℓ p} (∼ : Rel A ℓ) (P : A → Set p) → P Respects ∼ → (P ∘ f) Respects (∼ on f) respects _ _ resp = resp respects₂ : ∀ {ℓ₁ ℓ₂} (∼₁ : Rel A ℓ₁) (∼₂ : Rel A ℓ₂) → ∼₁ Respects₂ ∼₂ → (∼₁ on f) Respects₂ (∼₂ on f) respects₂ _ _ (resp₁ , resp₂) = ((λ {_} {_} {_} → resp₁) , λ {_} {_} {_} → resp₂) decidable : ∀ {ℓ} (∼ : Rel A ℓ) → Decidable ∼ → Decidable (∼ on f) decidable _ dec = λ x y → dec (f x) (f y) total : ∀ {ℓ} (∼ : Rel A ℓ) → Total ∼ → Total (∼ on f) total _ tot = λ x y → tot (f x) (f y) trichotomous : ∀ {ℓ₁ ℓ₂} (≈ : Rel A ℓ₁) (< : Rel A ℓ₂) → Trichotomous ≈ < → Trichotomous (≈ on f) (< on f) trichotomous _ _ compare = λ x y → compare (f x) (f y) isEquivalence : ∀ {ℓ} {≈ : Rel A ℓ} → IsEquivalence ≈ → IsEquivalence (≈ on f) isEquivalence {≈ = ≈} eq = record { refl = reflexive ≈ Eq.refl ; sym = symmetric ≈ Eq.sym ; trans = transitive ≈ Eq.trans } where module Eq = IsEquivalence eq isPreorder : ∀ {ℓ₁ ℓ₂} {≈ : Rel A ℓ₁} {∼ : Rel A ℓ₂} → IsPreorder ≈ ∼ → IsPreorder (≈ on f) (∼ on f) isPreorder {≈ = ≈} {∼} pre = record { isEquivalence = isEquivalence Pre.isEquivalence ; reflexive = implies ≈ ∼ Pre.reflexive ; trans = transitive ∼ Pre.trans } where module Pre = IsPreorder pre isDecEquivalence : ∀ {ℓ} {≈ : Rel A ℓ} → IsDecEquivalence ≈ → IsDecEquivalence (≈ on f) isDecEquivalence {≈ = ≈} dec = record { isEquivalence = isEquivalence Dec.isEquivalence ; _≟_ = decidable ≈ Dec._≟_ } where module Dec = IsDecEquivalence dec isPartialOrder : ∀ {ℓ₁ ℓ₂} {≈ : Rel A ℓ₁} {≤ : Rel A ℓ₂} → IsPartialOrder ≈ ≤ → IsPartialOrder (≈ on f) (≤ on f) isPartialOrder {≈ = ≈} {≤} po = record { isPreorder = isPreorder Po.isPreorder ; antisym = antisymmetric ≈ ≤ Po.antisym } where module Po = IsPartialOrder po isDecPartialOrder : ∀ {ℓ₁ ℓ₂} {≈ : Rel A ℓ₁} {≤ : Rel A ℓ₂} → IsDecPartialOrder ≈ ≤ → IsDecPartialOrder (≈ on f) (≤ on f) isDecPartialOrder dpo = record { isPartialOrder = isPartialOrder DPO.isPartialOrder ; _≟_ = decidable _ DPO._≟_ ; _≤?_ = decidable _ DPO._≤?_ } where module DPO = IsDecPartialOrder dpo isStrictPartialOrder : ∀ {ℓ₁ ℓ₂} {≈ : Rel A ℓ₁} {< : Rel A ℓ₂} → IsStrictPartialOrder ≈ < → IsStrictPartialOrder (≈ on f) (< on f) isStrictPartialOrder {≈ = ≈} {<} spo = record { isEquivalence = isEquivalence Spo.isEquivalence ; irrefl = irreflexive ≈ < Spo.irrefl ; trans = transitive < Spo.trans ; <-resp-≈ = respects₂ < ≈ Spo.<-resp-≈ } where module Spo = IsStrictPartialOrder spo isTotalOrder : ∀ {ℓ₁ ℓ₂} {≈ : Rel A ℓ₁} {≤ : Rel A ℓ₂} → IsTotalOrder ≈ ≤ → IsTotalOrder (≈ on f) (≤ on f) isTotalOrder {≈ = ≈} {≤} to = record { isPartialOrder = isPartialOrder To.isPartialOrder ; total = total ≤ To.total } where module To = IsTotalOrder to isDecTotalOrder : ∀ {ℓ₁ ℓ₂} {≈ : Rel A ℓ₁} {≤ : Rel A ℓ₂} → IsDecTotalOrder ≈ ≤ → IsDecTotalOrder (≈ on f) (≤ on f) isDecTotalOrder {≈ = ≈} {≤} dec = record { isTotalOrder = isTotalOrder Dec.isTotalOrder ; _≟_ = decidable ≈ Dec._≟_ ; _≤?_ = decidable ≤ Dec._≤?_ } where module Dec = IsDecTotalOrder dec isStrictTotalOrder : ∀ {ℓ₁ ℓ₂} {≈ : Rel A ℓ₁} {< : Rel A ℓ₂} → IsStrictTotalOrder ≈ < → IsStrictTotalOrder (≈ on f) (< on f) isStrictTotalOrder {≈ = ≈} {<} sto = record { isEquivalence = isEquivalence Sto.isEquivalence ; trans = transitive < Sto.trans ; compare = trichotomous ≈ < Sto.compare ; <-resp-≈ = respects₂ < ≈ Sto.<-resp-≈ } where module Sto = IsStrictTotalOrder sto preorder : ∀ {p₁ p₂ p₃ b} {B : Set b} (P : Preorder p₁ p₂ p₃) → (B → Preorder.Carrier P) → Preorder _ _ _ preorder P f = record { isPreorder = isPreorder f (Preorder.isPreorder P) } setoid : ∀ {s₁ s₂ b} {B : Set b} (S : Setoid s₁ s₂) → (B → Setoid.Carrier S) → Setoid _ _ setoid S f = record { isEquivalence = isEquivalence f (Setoid.isEquivalence S) } decSetoid : ∀ {d₁ d₂ b} {B : Set b} (D : DecSetoid d₁ d₂) → (B → DecSetoid.Carrier D) → DecSetoid _ _ decSetoid D f = record { isDecEquivalence = isDecEquivalence f (DecSetoid.isDecEquivalence D) } poset : ∀ {p₁ p₂ p₃ b} {B : Set b} (P : Poset p₁ p₂ p₃) → (B → Poset.Carrier P) → Poset _ _ _ poset P f = record { isPartialOrder = isPartialOrder f (Poset.isPartialOrder P) } decPoset : ∀ {d₁ d₂ d₃ b} {B : Set b} (D : DecPoset d₁ d₂ d₃) → (B → DecPoset.Carrier D) → DecPoset _ _ _ decPoset D f = record { isDecPartialOrder = isDecPartialOrder f (DecPoset.isDecPartialOrder D) } strictPartialOrder : ∀ {s₁ s₂ s₃ b} {B : Set b} (S : StrictPartialOrder s₁ s₂ s₃) → (B → StrictPartialOrder.Carrier S) → StrictPartialOrder _ _ _ strictPartialOrder S f = record { isStrictPartialOrder = isStrictPartialOrder f (StrictPartialOrder.isStrictPartialOrder S) } totalOrder : ∀ {t₁ t₂ t₃ b} {B : Set b} (T : TotalOrder t₁ t₂ t₃) → (B → TotalOrder.Carrier T) → TotalOrder _ _ _ totalOrder T f = record { isTotalOrder = isTotalOrder f (TotalOrder.isTotalOrder T) } decTotalOrder : ∀ {d₁ d₂ d₃ b} {B : Set b} (D : DecTotalOrder d₁ d₂ d₃) → (B → DecTotalOrder.Carrier D) → DecTotalOrder _ _ _ decTotalOrder D f = record { isDecTotalOrder = isDecTotalOrder f (DecTotalOrder.isDecTotalOrder D) } strictTotalOrder : ∀ {s₁ s₂ s₃ b} {B : Set b} (S : StrictTotalOrder s₁ s₂ s₃) → (B → StrictTotalOrder.Carrier S) → StrictTotalOrder _ _ _ strictTotalOrder S f = record { isStrictTotalOrder = isStrictTotalOrder f (StrictTotalOrder.isStrictTotalOrder S) }
{ "alphanum_fraction": 0.5555858682, "avg_line_length": 35.9362745098, "ext": "agda", "hexsha": "67180c21da9c5e5cfec82e1a89414e041b411bfb", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_forks_repo_licenses": [ "Apache-2.0" ], "max_forks_repo_name": "qwe2/try-agda", "max_forks_repo_path": "agda-stdlib-0.9/src/Relation/Binary/On.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "Apache-2.0" ], "max_issues_repo_name": "qwe2/try-agda", "max_issues_repo_path": "agda-stdlib-0.9/src/Relation/Binary/On.agda", "max_line_length": 73, "max_stars_count": 1, "max_stars_repo_head_hexsha": "9d4c43b1609d3f085636376fdca73093481ab882", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "qwe2/try-agda", "max_stars_repo_path": "agda-stdlib-0.9/src/Relation/Binary/On.agda", "max_stars_repo_stars_event_max_datetime": "2016-10-20T15:52:05.000Z", "max_stars_repo_stars_event_min_datetime": "2016-10-20T15:52:05.000Z", "num_tokens": 2672, "size": 7331 }
module options where open import lib open import options-types public ---------------------------------------------------------------------------------- -- Run-rewriting rules ---------------------------------------------------------------------------------- data gratr2-nt : Set where _ws-plus-34 : gratr2-nt _ws : gratr2-nt _str-bool : gratr2-nt _start : gratr2-nt _squote : gratr2-nt _posinfo : gratr2-nt _paths : gratr2-nt _path-star-1 : gratr2-nt _path : gratr2-nt _ows-star-35 : gratr2-nt _ows : gratr2-nt _opts : gratr2-nt _opt : gratr2-nt _numpunct-bar-8 : gratr2-nt _numpunct-bar-7 : gratr2-nt _numpunct : gratr2-nt _numone-range-5 : gratr2-nt _numone : gratr2-nt _num-plus-6 : gratr2-nt _num : gratr2-nt _comment-star-30 : gratr2-nt _comment : gratr2-nt _aws-bar-33 : gratr2-nt _aws-bar-32 : gratr2-nt _aws-bar-31 : gratr2-nt _aws : gratr2-nt _anychar-bar-9 : gratr2-nt _anychar-bar-29 : gratr2-nt _anychar-bar-28 : gratr2-nt _anychar-bar-27 : gratr2-nt _anychar-bar-26 : gratr2-nt _anychar-bar-25 : gratr2-nt _anychar-bar-24 : gratr2-nt _anychar-bar-23 : gratr2-nt _anychar-bar-22 : gratr2-nt _anychar-bar-21 : gratr2-nt _anychar-bar-20 : gratr2-nt _anychar-bar-19 : gratr2-nt _anychar-bar-18 : gratr2-nt _anychar-bar-17 : gratr2-nt _anychar-bar-16 : gratr2-nt _anychar-bar-15 : gratr2-nt _anychar-bar-14 : gratr2-nt _anychar-bar-13 : gratr2-nt _anychar-bar-12 : gratr2-nt _anychar-bar-11 : gratr2-nt _anychar-bar-10 : gratr2-nt _anychar : gratr2-nt _alpha-range-3 : gratr2-nt _alpha-range-2 : gratr2-nt _alpha-bar-4 : gratr2-nt _alpha : gratr2-nt gratr2-nt-eq : gratr2-nt → gratr2-nt → 𝔹 gratr2-nt-eq _ws-plus-34 _ws-plus-34 = tt gratr2-nt-eq _ws _ws = tt gratr2-nt-eq _str-bool _str-bool = tt gratr2-nt-eq _start _start = tt gratr2-nt-eq _squote _squote = tt gratr2-nt-eq _posinfo _posinfo = tt gratr2-nt-eq _paths _paths = tt gratr2-nt-eq _path-star-1 _path-star-1 = tt gratr2-nt-eq _path _path = tt gratr2-nt-eq _ows-star-35 _ows-star-35 = tt gratr2-nt-eq _ows _ows = tt gratr2-nt-eq _opts _opts = tt gratr2-nt-eq _opt _opt = tt gratr2-nt-eq _numpunct-bar-8 _numpunct-bar-8 = tt gratr2-nt-eq _numpunct-bar-7 _numpunct-bar-7 = tt gratr2-nt-eq _numpunct _numpunct = tt gratr2-nt-eq _numone-range-5 _numone-range-5 = tt gratr2-nt-eq _numone _numone = tt gratr2-nt-eq _num-plus-6 _num-plus-6 = tt gratr2-nt-eq _num _num = tt gratr2-nt-eq _comment-star-30 _comment-star-30 = tt gratr2-nt-eq _comment _comment = tt gratr2-nt-eq _aws-bar-33 _aws-bar-33 = tt gratr2-nt-eq _aws-bar-32 _aws-bar-32 = tt gratr2-nt-eq _aws-bar-31 _aws-bar-31 = tt gratr2-nt-eq _aws _aws = tt gratr2-nt-eq _anychar-bar-9 _anychar-bar-9 = tt gratr2-nt-eq _anychar-bar-29 _anychar-bar-29 = tt gratr2-nt-eq _anychar-bar-28 _anychar-bar-28 = tt gratr2-nt-eq _anychar-bar-27 _anychar-bar-27 = tt gratr2-nt-eq _anychar-bar-26 _anychar-bar-26 = tt gratr2-nt-eq _anychar-bar-25 _anychar-bar-25 = tt gratr2-nt-eq _anychar-bar-24 _anychar-bar-24 = tt gratr2-nt-eq _anychar-bar-23 _anychar-bar-23 = tt gratr2-nt-eq _anychar-bar-22 _anychar-bar-22 = tt gratr2-nt-eq _anychar-bar-21 _anychar-bar-21 = tt gratr2-nt-eq _anychar-bar-20 _anychar-bar-20 = tt gratr2-nt-eq _anychar-bar-19 _anychar-bar-19 = tt gratr2-nt-eq _anychar-bar-18 _anychar-bar-18 = tt gratr2-nt-eq _anychar-bar-17 _anychar-bar-17 = tt gratr2-nt-eq _anychar-bar-16 _anychar-bar-16 = tt gratr2-nt-eq _anychar-bar-15 _anychar-bar-15 = tt gratr2-nt-eq _anychar-bar-14 _anychar-bar-14 = tt gratr2-nt-eq _anychar-bar-13 _anychar-bar-13 = tt gratr2-nt-eq _anychar-bar-12 _anychar-bar-12 = tt gratr2-nt-eq _anychar-bar-11 _anychar-bar-11 = tt gratr2-nt-eq _anychar-bar-10 _anychar-bar-10 = tt gratr2-nt-eq _anychar _anychar = tt gratr2-nt-eq _alpha-range-3 _alpha-range-3 = tt gratr2-nt-eq _alpha-range-2 _alpha-range-2 = tt gratr2-nt-eq _alpha-bar-4 _alpha-bar-4 = tt gratr2-nt-eq _alpha _alpha = tt gratr2-nt-eq _ _ = ff open import rtn gratr2-nt options-start : gratr2-nt → 𝕃 gratr2-rule options-start _ws-plus-34 = (just "P132" , nothing , just _ws-plus-34 , inj₁ _aws :: inj₁ _ws-plus-34 :: []) :: (just "P131" , nothing , just _ws-plus-34 , inj₁ _aws :: []) :: [] options-start _ws = (just "P133" , nothing , just _ws , inj₁ _ws-plus-34 :: []) :: [] options-start _str-bool = (just "StrBoolTrue" , nothing , just _str-bool , inj₂ 't' :: inj₂ 'r' :: inj₂ 'u' :: inj₂ 'e' :: []) :: (just "StrBoolFalse" , nothing , just _str-bool , inj₂ 'f' :: inj₂ 'a' :: inj₂ 'l' :: inj₂ 's' :: inj₂ 'e' :: []) :: [] options-start _start = (just "File" , nothing , just _start , inj₁ _opts :: inj₁ _ows :: []) :: [] options-start _squote = (just "P0" , nothing , just _squote , inj₂ '\"' :: []) :: [] options-start _posinfo = (just "Posinfo" , nothing , just _posinfo , []) :: [] options-start _paths = (just "PathsNil" , nothing , just _paths , []) :: (just "PathsCons" , nothing , just _paths , inj₁ _ws :: inj₁ _path :: inj₁ _paths :: []) :: [] options-start _path-star-1 = (just "P2" , nothing , just _path-star-1 , inj₁ _anychar :: inj₁ _path-star-1 :: []) :: (just "P1" , nothing , just _path-star-1 , []) :: [] options-start _path = (just "P3" , nothing , just _path , inj₁ _squote :: inj₁ _path-star-1 :: inj₁ _squote :: []) :: [] options-start _ows-star-35 = (just "P135" , nothing , just _ows-star-35 , inj₁ _aws :: inj₁ _ows-star-35 :: []) :: (just "P134" , nothing , just _ows-star-35 , []) :: [] options-start _ows = (just "P136" , nothing , just _ows , inj₁ _ows-star-35 :: []) :: [] options-start _opts = (just "OptsNil" , nothing , just _opts , []) :: (just "OptsCons" , nothing , just _opts , inj₁ _ows :: inj₁ _opt :: inj₁ _opts :: []) :: [] options-start _opt = (just "UseCedeFiles" , nothing , just _opt , inj₂ 'u' :: inj₂ 's' :: inj₂ 'e' :: inj₂ '-' :: inj₂ 'c' :: inj₂ 'e' :: inj₂ 'd' :: inj₂ 'e' :: inj₂ '-' :: inj₂ 'f' :: inj₂ 'i' :: inj₂ 'l' :: inj₂ 'e' :: inj₂ 's' :: inj₁ _ows :: inj₂ '=' :: inj₁ _ows :: inj₁ _str-bool :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: []) :: (just "ShowQualifiedVars" , nothing , just _opt , inj₂ 's' :: inj₂ 'h' :: inj₂ 'o' :: inj₂ 'w' :: inj₂ '-' :: inj₂ 'q' :: inj₂ 'u' :: inj₂ 'a' :: inj₂ 'l' :: inj₂ 'i' :: inj₂ 'f' :: inj₂ 'i' :: inj₂ 'e' :: inj₂ 'd' :: inj₂ '-' :: inj₂ 'v' :: inj₂ 'a' :: inj₂ 'r' :: inj₂ 's' :: inj₁ _ows :: inj₂ '=' :: inj₁ _ows :: inj₁ _str-bool :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: []) :: (just "MakeRktFiles" , nothing , just _opt , inj₂ 'm' :: inj₂ 'a' :: inj₂ 'k' :: inj₂ 'e' :: inj₂ '-' :: inj₂ 'r' :: inj₂ 'k' :: inj₂ 't' :: inj₂ '-' :: inj₂ 'f' :: inj₂ 'i' :: inj₂ 'l' :: inj₂ 'e' :: inj₂ 's' :: inj₁ _ows :: inj₂ '=' :: inj₁ _ows :: inj₁ _str-bool :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: []) :: (just "Lib" , nothing , just _opt , inj₂ 'i' :: inj₂ 'm' :: inj₂ 'p' :: inj₂ 'o' :: inj₂ 'r' :: inj₂ 't' :: inj₂ '-' :: inj₂ 'd' :: inj₂ 'i' :: inj₂ 'r' :: inj₂ 'e' :: inj₂ 'c' :: inj₂ 't' :: inj₂ 'o' :: inj₂ 'r' :: inj₂ 'i' :: inj₂ 'e' :: inj₂ 's' :: inj₁ _ows :: inj₂ '=' :: inj₁ _ows :: inj₁ _paths :: inj₁ _ows :: inj₂ '.' :: []) :: (just "GenerateLogs" , nothing , just _opt , inj₂ 'g' :: inj₂ 'e' :: inj₂ 'n' :: inj₂ 'e' :: inj₂ 'r' :: inj₂ 'a' :: inj₂ 't' :: inj₂ 'e' :: inj₂ '-' :: inj₂ 'l' :: inj₂ 'o' :: inj₂ 'g' :: inj₂ 's' :: inj₁ _ows :: inj₂ '=' :: inj₁ _ows :: inj₁ _str-bool :: inj₁ _ows :: inj₂ '.' :: inj₁ _ows :: []) :: [] options-start _numpunct-bar-8 = (just "P76" , nothing , just _numpunct-bar-8 , inj₁ _numpunct-bar-7 :: []) :: (just "P75" , nothing , just _numpunct-bar-8 , inj₁ _numone :: []) :: [] options-start _numpunct-bar-7 = (just "P74" , nothing , just _numpunct-bar-7 , inj₂ '-' :: []) :: (just "P73" , nothing , just _numpunct-bar-7 , inj₂ '\'' :: []) :: [] options-start _numpunct = (just "P77" , nothing , just _numpunct , inj₁ _numpunct-bar-8 :: []) :: [] options-start _numone-range-5 = (just "P68" , nothing , just _numone-range-5 , inj₂ '9' :: []) :: (just "P67" , nothing , just _numone-range-5 , inj₂ '8' :: []) :: (just "P66" , nothing , just _numone-range-5 , inj₂ '7' :: []) :: (just "P65" , nothing , just _numone-range-5 , inj₂ '6' :: []) :: (just "P64" , nothing , just _numone-range-5 , inj₂ '5' :: []) :: (just "P63" , nothing , just _numone-range-5 , inj₂ '4' :: []) :: (just "P62" , nothing , just _numone-range-5 , inj₂ '3' :: []) :: (just "P61" , nothing , just _numone-range-5 , inj₂ '2' :: []) :: (just "P60" , nothing , just _numone-range-5 , inj₂ '1' :: []) :: (just "P59" , nothing , just _numone-range-5 , inj₂ '0' :: []) :: [] options-start _numone = (just "P69" , nothing , just _numone , inj₁ _numone-range-5 :: []) :: [] options-start _num-plus-6 = (just "P71" , nothing , just _num-plus-6 , inj₁ _numone :: inj₁ _num-plus-6 :: []) :: (just "P70" , nothing , just _num-plus-6 , inj₁ _numone :: []) :: [] options-start _num = (just "P72" , nothing , just _num , inj₁ _num-plus-6 :: []) :: [] options-start _comment-star-30 = (just "P122" , nothing , just _comment-star-30 , inj₁ _anychar :: inj₁ _comment-star-30 :: []) :: (just "P121" , nothing , just _comment-star-30 , []) :: [] options-start _comment = (just "P123" , nothing , just _comment , inj₂ '%' :: inj₁ _comment-star-30 :: inj₂ '\n' :: []) :: [] options-start _aws-bar-33 = (just "P129" , nothing , just _aws-bar-33 , inj₁ _aws-bar-32 :: []) :: (just "P128" , nothing , just _aws-bar-33 , inj₂ '\n' :: []) :: [] options-start _aws-bar-32 = (just "P127" , nothing , just _aws-bar-32 , inj₁ _aws-bar-31 :: []) :: (just "P126" , nothing , just _aws-bar-32 , inj₂ '\t' :: []) :: [] options-start _aws-bar-31 = (just "P125" , nothing , just _aws-bar-31 , inj₁ _comment :: []) :: (just "P124" , nothing , just _aws-bar-31 , inj₂ ' ' :: []) :: [] options-start _aws = (just "P130" , nothing , just _aws , inj₁ _aws-bar-33 :: []) :: [] options-start _anychar-bar-9 = (just "P79" , nothing , just _anychar-bar-9 , inj₂ '_' :: []) :: (just "P78" , nothing , just _anychar-bar-9 , inj₂ '/' :: []) :: [] options-start _anychar-bar-29 = (just "P119" , nothing , just _anychar-bar-29 , inj₁ _anychar-bar-28 :: []) :: (just "P118" , nothing , just _anychar-bar-29 , inj₁ _alpha :: []) :: [] options-start _anychar-bar-28 = (just "P117" , nothing , just _anychar-bar-28 , inj₁ _anychar-bar-27 :: []) :: (just "P116" , nothing , just _anychar-bar-28 , inj₁ _numpunct :: []) :: [] options-start _anychar-bar-27 = (just "P115" , nothing , just _anychar-bar-27 , inj₁ _anychar-bar-26 :: []) :: (just "P114" , nothing , just _anychar-bar-27 , inj₂ '\t' :: []) :: [] options-start _anychar-bar-26 = (just "P113" , nothing , just _anychar-bar-26 , inj₁ _anychar-bar-25 :: []) :: (just "P112" , nothing , just _anychar-bar-26 , inj₂ ' ' :: []) :: [] options-start _anychar-bar-25 = (just "P111" , nothing , just _anychar-bar-25 , inj₁ _anychar-bar-24 :: []) :: (just "P110" , nothing , just _anychar-bar-25 , inj₂ '%' :: []) :: [] options-start _anychar-bar-24 = (just "P109" , nothing , just _anychar-bar-24 , inj₁ _anychar-bar-23 :: []) :: (just "P108" , nothing , just _anychar-bar-24 , inj₂ '(' :: []) :: [] options-start _anychar-bar-23 = (just "P107" , nothing , just _anychar-bar-23 , inj₁ _anychar-bar-22 :: []) :: (just "P106" , nothing , just _anychar-bar-23 , inj₂ ')' :: []) :: [] options-start _anychar-bar-22 = (just "P105" , nothing , just _anychar-bar-22 , inj₁ _anychar-bar-21 :: []) :: (just "P104" , nothing , just _anychar-bar-22 , inj₂ ':' :: []) :: [] options-start _anychar-bar-21 = (just "P103" , nothing , just _anychar-bar-21 , inj₁ _anychar-bar-20 :: []) :: (just "P102" , nothing , just _anychar-bar-21 , inj₂ '.' :: []) :: [] options-start _anychar-bar-20 = (just "P101" , nothing , just _anychar-bar-20 , inj₁ _anychar-bar-19 :: []) :: (just "P100" , nothing , just _anychar-bar-20 , inj₂ '[' :: []) :: [] options-start _anychar-bar-19 = (just "P99" , nothing , just _anychar-bar-19 , inj₁ _anychar-bar-18 :: []) :: (just "P98" , nothing , just _anychar-bar-19 , inj₂ ']' :: []) :: [] options-start _anychar-bar-18 = (just "P97" , nothing , just _anychar-bar-18 , inj₁ _anychar-bar-17 :: []) :: (just "P96" , nothing , just _anychar-bar-18 , inj₂ ',' :: []) :: [] options-start _anychar-bar-17 = (just "P95" , nothing , just _anychar-bar-17 , inj₁ _anychar-bar-16 :: []) :: (just "P94" , nothing , just _anychar-bar-17 , inj₂ '!' :: []) :: [] options-start _anychar-bar-16 = (just "P93" , nothing , just _anychar-bar-16 , inj₁ _anychar-bar-15 :: []) :: (just "P92" , nothing , just _anychar-bar-16 , inj₂ '{' :: []) :: [] options-start _anychar-bar-15 = (just "P91" , nothing , just _anychar-bar-15 , inj₁ _anychar-bar-14 :: []) :: (just "P90" , nothing , just _anychar-bar-15 , inj₂ '}' :: []) :: [] options-start _anychar-bar-14 = (just "P89" , nothing , just _anychar-bar-14 , inj₁ _anychar-bar-13 :: []) :: (just "P88" , nothing , just _anychar-bar-14 , inj₂ '-' :: []) :: [] options-start _anychar-bar-13 = (just "P87" , nothing , just _anychar-bar-13 , inj₁ _anychar-bar-12 :: []) :: (just "P86" , nothing , just _anychar-bar-13 , inj₂ '=' :: []) :: [] options-start _anychar-bar-12 = (just "P85" , nothing , just _anychar-bar-12 , inj₁ _anychar-bar-11 :: []) :: (just "P84" , nothing , just _anychar-bar-12 , inj₂ '+' :: []) :: [] options-start _anychar-bar-11 = (just "P83" , nothing , just _anychar-bar-11 , inj₁ _anychar-bar-10 :: []) :: (just "P82" , nothing , just _anychar-bar-11 , inj₂ '<' :: []) :: [] options-start _anychar-bar-10 = (just "P81" , nothing , just _anychar-bar-10 , inj₁ _anychar-bar-9 :: []) :: (just "P80" , nothing , just _anychar-bar-10 , inj₂ '>' :: []) :: [] options-start _anychar = (just "P120" , nothing , just _anychar , inj₁ _anychar-bar-29 :: []) :: [] options-start _alpha-range-3 = (just "P55" , nothing , just _alpha-range-3 , inj₂ 'Z' :: []) :: (just "P54" , nothing , just _alpha-range-3 , inj₂ 'Y' :: []) :: (just "P53" , nothing , just _alpha-range-3 , inj₂ 'X' :: []) :: (just "P52" , nothing , just _alpha-range-3 , inj₂ 'W' :: []) :: (just "P51" , nothing , just _alpha-range-3 , inj₂ 'V' :: []) :: (just "P50" , nothing , just _alpha-range-3 , inj₂ 'U' :: []) :: (just "P49" , nothing , just _alpha-range-3 , inj₂ 'T' :: []) :: (just "P48" , nothing , just _alpha-range-3 , inj₂ 'S' :: []) :: (just "P47" , nothing , just _alpha-range-3 , inj₂ 'R' :: []) :: (just "P46" , nothing , just _alpha-range-3 , inj₂ 'Q' :: []) :: (just "P45" , nothing , just _alpha-range-3 , inj₂ 'P' :: []) :: (just "P44" , nothing , just _alpha-range-3 , inj₂ 'O' :: []) :: (just "P43" , nothing , just _alpha-range-3 , inj₂ 'N' :: []) :: (just "P42" , nothing , just _alpha-range-3 , inj₂ 'M' :: []) :: (just "P41" , nothing , just _alpha-range-3 , inj₂ 'L' :: []) :: (just "P40" , nothing , just _alpha-range-3 , inj₂ 'K' :: []) :: (just "P39" , nothing , just _alpha-range-3 , inj₂ 'J' :: []) :: (just "P38" , nothing , just _alpha-range-3 , inj₂ 'I' :: []) :: (just "P37" , nothing , just _alpha-range-3 , inj₂ 'H' :: []) :: (just "P36" , nothing , just _alpha-range-3 , inj₂ 'G' :: []) :: (just "P35" , nothing , just _alpha-range-3 , inj₂ 'F' :: []) :: (just "P34" , nothing , just _alpha-range-3 , inj₂ 'E' :: []) :: (just "P33" , nothing , just _alpha-range-3 , inj₂ 'D' :: []) :: (just "P32" , nothing , just _alpha-range-3 , inj₂ 'C' :: []) :: (just "P31" , nothing , just _alpha-range-3 , inj₂ 'B' :: []) :: (just "P30" , nothing , just _alpha-range-3 , inj₂ 'A' :: []) :: [] options-start _alpha-range-2 = (just "P9" , nothing , just _alpha-range-2 , inj₂ 'f' :: []) :: (just "P8" , nothing , just _alpha-range-2 , inj₂ 'e' :: []) :: (just "P7" , nothing , just _alpha-range-2 , inj₂ 'd' :: []) :: (just "P6" , nothing , just _alpha-range-2 , inj₂ 'c' :: []) :: (just "P5" , nothing , just _alpha-range-2 , inj₂ 'b' :: []) :: (just "P4" , nothing , just _alpha-range-2 , inj₂ 'a' :: []) :: (just "P29" , nothing , just _alpha-range-2 , inj₂ 'z' :: []) :: (just "P28" , nothing , just _alpha-range-2 , inj₂ 'y' :: []) :: (just "P27" , nothing , just _alpha-range-2 , inj₂ 'x' :: []) :: (just "P26" , nothing , just _alpha-range-2 , inj₂ 'w' :: []) :: (just "P25" , nothing , just _alpha-range-2 , inj₂ 'v' :: []) :: (just "P24" , nothing , just _alpha-range-2 , inj₂ 'u' :: []) :: (just "P23" , nothing , just _alpha-range-2 , inj₂ 't' :: []) :: (just "P22" , nothing , just _alpha-range-2 , inj₂ 's' :: []) :: (just "P21" , nothing , just _alpha-range-2 , inj₂ 'r' :: []) :: (just "P20" , nothing , just _alpha-range-2 , inj₂ 'q' :: []) :: (just "P19" , nothing , just _alpha-range-2 , inj₂ 'p' :: []) :: (just "P18" , nothing , just _alpha-range-2 , inj₂ 'o' :: []) :: (just "P17" , nothing , just _alpha-range-2 , inj₂ 'n' :: []) :: (just "P16" , nothing , just _alpha-range-2 , inj₂ 'm' :: []) :: (just "P15" , nothing , just _alpha-range-2 , inj₂ 'l' :: []) :: (just "P14" , nothing , just _alpha-range-2 , inj₂ 'k' :: []) :: (just "P13" , nothing , just _alpha-range-2 , inj₂ 'j' :: []) :: (just "P12" , nothing , just _alpha-range-2 , inj₂ 'i' :: []) :: (just "P11" , nothing , just _alpha-range-2 , inj₂ 'h' :: []) :: (just "P10" , nothing , just _alpha-range-2 , inj₂ 'g' :: []) :: [] options-start _alpha-bar-4 = (just "P57" , nothing , just _alpha-bar-4 , inj₁ _alpha-range-3 :: []) :: (just "P56" , nothing , just _alpha-bar-4 , inj₁ _alpha-range-2 :: []) :: [] options-start _alpha = (just "P58" , nothing , just _alpha , inj₁ _alpha-bar-4 :: []) :: [] options-return : maybe gratr2-nt → 𝕃 gratr2-rule options-return _ = [] options-rtn : gratr2-rtn options-rtn = record { start = _start ; _eq_ = gratr2-nt-eq ; gratr2-start = options-start ; gratr2-return = options-return } open import run ptr open noderiv ------------------------------------------ -- Length-decreasing rules ------------------------------------------ len-dec-rewrite : Run → maybe (Run × ℕ) len-dec-rewrite {- File-} ((Id "File") :: (ParseTree (parsed-opts x0)) :: _::_(ParseTree parsed-ows) rest) = just (ParseTree (parsed-start (norm-start (File x0))) ::' rest , 3) len-dec-rewrite {- GenerateLogs-} ((Id "GenerateLogs") :: (InputChar 'g') :: (InputChar 'e') :: (InputChar 'n') :: (InputChar 'e') :: (InputChar 'r') :: (InputChar 'a') :: (InputChar 't') :: (InputChar 'e') :: (InputChar '-') :: (InputChar 'l') :: (InputChar 'o') :: (InputChar 'g') :: (InputChar 's') :: (ParseTree parsed-ows) :: (InputChar '=') :: (ParseTree parsed-ows) :: (ParseTree (parsed-str-bool x0)) :: (ParseTree parsed-ows) :: (InputChar '.') :: _::_(ParseTree parsed-ows) rest) = just (ParseTree (parsed-opt (norm-opt (GenerateLogs x0))) ::' rest , 21) len-dec-rewrite {- Lib-} ((Id "Lib") :: (InputChar 'i') :: (InputChar 'm') :: (InputChar 'p') :: (InputChar 'o') :: (InputChar 'r') :: (InputChar 't') :: (InputChar '-') :: (InputChar 'd') :: (InputChar 'i') :: (InputChar 'r') :: (InputChar 'e') :: (InputChar 'c') :: (InputChar 't') :: (InputChar 'o') :: (InputChar 'r') :: (InputChar 'i') :: (InputChar 'e') :: (InputChar 's') :: (ParseTree parsed-ows) :: (InputChar '=') :: (ParseTree parsed-ows) :: (ParseTree (parsed-paths x0)) :: (ParseTree parsed-ows) :: _::_(InputChar '.') rest) = just (ParseTree (parsed-opt (norm-opt (Lib x0))) ::' rest , 25) len-dec-rewrite {- MakeRktFiles-} ((Id "MakeRktFiles") :: (InputChar 'm') :: (InputChar 'a') :: (InputChar 'k') :: (InputChar 'e') :: (InputChar '-') :: (InputChar 'r') :: (InputChar 'k') :: (InputChar 't') :: (InputChar '-') :: (InputChar 'f') :: (InputChar 'i') :: (InputChar 'l') :: (InputChar 'e') :: (InputChar 's') :: (ParseTree parsed-ows) :: (InputChar '=') :: (ParseTree parsed-ows) :: (ParseTree (parsed-str-bool x0)) :: (ParseTree parsed-ows) :: (InputChar '.') :: _::_(ParseTree parsed-ows) rest) = just (ParseTree (parsed-opt (norm-opt (MakeRktFiles x0))) ::' rest , 22) len-dec-rewrite {- OptsCons-} ((Id "OptsCons") :: (ParseTree parsed-ows) :: (ParseTree (parsed-opt x0)) :: _::_(ParseTree (parsed-opts x1)) rest) = just (ParseTree (parsed-opts (norm-opts (OptsCons x0 x1))) ::' rest , 4) len-dec-rewrite {- P0-} ((Id "P0") :: _::_(InputChar '\"') rest) = just (ParseTree parsed-squote ::' rest , 2) len-dec-rewrite {- P10-} ((Id "P10") :: _::_(InputChar 'g') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'g'))) ::' rest , 2) len-dec-rewrite {- P100-} ((Id "P100") :: _::_(InputChar '[') rest) = just (ParseTree (parsed-anychar-bar-20 (string-append 0 (char-to-string '['))) ::' rest , 2) len-dec-rewrite {- P101-} ((Id "P101") :: _::_(ParseTree (parsed-anychar-bar-19 x0)) rest) = just (ParseTree (parsed-anychar-bar-20 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P102-} ((Id "P102") :: _::_(InputChar '.') rest) = just (ParseTree (parsed-anychar-bar-21 (string-append 0 (char-to-string '.'))) ::' rest , 2) len-dec-rewrite {- P103-} ((Id "P103") :: _::_(ParseTree (parsed-anychar-bar-20 x0)) rest) = just (ParseTree (parsed-anychar-bar-21 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P104-} ((Id "P104") :: _::_(InputChar ':') rest) = just (ParseTree (parsed-anychar-bar-22 (string-append 0 (char-to-string ':'))) ::' rest , 2) len-dec-rewrite {- P105-} ((Id "P105") :: _::_(ParseTree (parsed-anychar-bar-21 x0)) rest) = just (ParseTree (parsed-anychar-bar-22 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P106-} ((Id "P106") :: _::_(InputChar ')') rest) = just (ParseTree (parsed-anychar-bar-23 (string-append 0 (char-to-string ')'))) ::' rest , 2) len-dec-rewrite {- P107-} ((Id "P107") :: _::_(ParseTree (parsed-anychar-bar-22 x0)) rest) = just (ParseTree (parsed-anychar-bar-23 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P108-} ((Id "P108") :: _::_(InputChar '(') rest) = just (ParseTree (parsed-anychar-bar-24 (string-append 0 (char-to-string '('))) ::' rest , 2) len-dec-rewrite {- P109-} ((Id "P109") :: _::_(ParseTree (parsed-anychar-bar-23 x0)) rest) = just (ParseTree (parsed-anychar-bar-24 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P11-} ((Id "P11") :: _::_(InputChar 'h') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'h'))) ::' rest , 2) len-dec-rewrite {- P110-} ((Id "P110") :: _::_(InputChar '%') rest) = just (ParseTree (parsed-anychar-bar-25 (string-append 0 (char-to-string '%'))) ::' rest , 2) len-dec-rewrite {- P111-} ((Id "P111") :: _::_(ParseTree (parsed-anychar-bar-24 x0)) rest) = just (ParseTree (parsed-anychar-bar-25 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P112-} ((Id "P112") :: _::_(InputChar ' ') rest) = just (ParseTree (parsed-anychar-bar-26 (string-append 0 (char-to-string ' '))) ::' rest , 2) len-dec-rewrite {- P113-} ((Id "P113") :: _::_(ParseTree (parsed-anychar-bar-25 x0)) rest) = just (ParseTree (parsed-anychar-bar-26 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P114-} ((Id "P114") :: _::_(InputChar '\t') rest) = just (ParseTree (parsed-anychar-bar-27 (string-append 0 (char-to-string '\t'))) ::' rest , 2) len-dec-rewrite {- P115-} ((Id "P115") :: _::_(ParseTree (parsed-anychar-bar-26 x0)) rest) = just (ParseTree (parsed-anychar-bar-27 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P116-} ((Id "P116") :: _::_(ParseTree (parsed-numpunct x0)) rest) = just (ParseTree (parsed-anychar-bar-28 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P117-} ((Id "P117") :: _::_(ParseTree (parsed-anychar-bar-27 x0)) rest) = just (ParseTree (parsed-anychar-bar-28 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P118-} ((Id "P118") :: _::_(ParseTree (parsed-alpha x0)) rest) = just (ParseTree (parsed-anychar-bar-29 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P119-} ((Id "P119") :: _::_(ParseTree (parsed-anychar-bar-28 x0)) rest) = just (ParseTree (parsed-anychar-bar-29 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P12-} ((Id "P12") :: _::_(InputChar 'i') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'i'))) ::' rest , 2) len-dec-rewrite {- P120-} ((Id "P120") :: _::_(ParseTree (parsed-anychar-bar-29 x0)) rest) = just (ParseTree (parsed-anychar (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P122-} ((Id "P122") :: (ParseTree (parsed-anychar x0)) :: _::_(ParseTree parsed-comment-star-30) rest) = just (ParseTree parsed-comment-star-30 ::' rest , 3) len-dec-rewrite {- P123-} ((Id "P123") :: (InputChar '%') :: (ParseTree parsed-comment-star-30) :: _::_(InputChar '\n') rest) = just (ParseTree parsed-comment ::' rest , 4) len-dec-rewrite {- P124-} ((Id "P124") :: _::_(InputChar ' ') rest) = just (ParseTree parsed-aws-bar-31 ::' rest , 2) len-dec-rewrite {- P125-} ((Id "P125") :: _::_(ParseTree parsed-comment) rest) = just (ParseTree parsed-aws-bar-31 ::' rest , 2) len-dec-rewrite {- P126-} ((Id "P126") :: _::_(InputChar '\t') rest) = just (ParseTree parsed-aws-bar-32 ::' rest , 2) len-dec-rewrite {- P127-} ((Id "P127") :: _::_(ParseTree parsed-aws-bar-31) rest) = just (ParseTree parsed-aws-bar-32 ::' rest , 2) len-dec-rewrite {- P128-} ((Id "P128") :: _::_(InputChar '\n') rest) = just (ParseTree parsed-aws-bar-33 ::' rest , 2) len-dec-rewrite {- P129-} ((Id "P129") :: _::_(ParseTree parsed-aws-bar-32) rest) = just (ParseTree parsed-aws-bar-33 ::' rest , 2) len-dec-rewrite {- P13-} ((Id "P13") :: _::_(InputChar 'j') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'j'))) ::' rest , 2) len-dec-rewrite {- P130-} ((Id "P130") :: _::_(ParseTree parsed-aws-bar-33) rest) = just (ParseTree parsed-aws ::' rest , 2) len-dec-rewrite {- P131-} ((Id "P131") :: _::_(ParseTree parsed-aws) rest) = just (ParseTree parsed-ws-plus-34 ::' rest , 2) len-dec-rewrite {- P132-} ((Id "P132") :: (ParseTree parsed-aws) :: _::_(ParseTree parsed-ws-plus-34) rest) = just (ParseTree parsed-ws-plus-34 ::' rest , 3) len-dec-rewrite {- P133-} ((Id "P133") :: _::_(ParseTree parsed-ws-plus-34) rest) = just (ParseTree parsed-ws ::' rest , 2) len-dec-rewrite {- P135-} ((Id "P135") :: (ParseTree parsed-aws) :: _::_(ParseTree parsed-ows-star-35) rest) = just (ParseTree parsed-ows-star-35 ::' rest , 3) len-dec-rewrite {- P136-} ((Id "P136") :: _::_(ParseTree parsed-ows-star-35) rest) = just (ParseTree parsed-ows ::' rest , 2) len-dec-rewrite {- P14-} ((Id "P14") :: _::_(InputChar 'k') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'k'))) ::' rest , 2) len-dec-rewrite {- P15-} ((Id "P15") :: _::_(InputChar 'l') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'l'))) ::' rest , 2) len-dec-rewrite {- P16-} ((Id "P16") :: _::_(InputChar 'm') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'm'))) ::' rest , 2) len-dec-rewrite {- P17-} ((Id "P17") :: _::_(InputChar 'n') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'n'))) ::' rest , 2) len-dec-rewrite {- P18-} ((Id "P18") :: _::_(InputChar 'o') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'o'))) ::' rest , 2) len-dec-rewrite {- P19-} ((Id "P19") :: _::_(InputChar 'p') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'p'))) ::' rest , 2) len-dec-rewrite {- P2-} ((Id "P2") :: (ParseTree (parsed-anychar x0)) :: _::_(ParseTree (parsed-path-star-1 x1)) rest) = just (ParseTree (parsed-path-star-1 (string-append 1 x0 x1)) ::' rest , 3) len-dec-rewrite {- P20-} ((Id "P20") :: _::_(InputChar 'q') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'q'))) ::' rest , 2) len-dec-rewrite {- P21-} ((Id "P21") :: _::_(InputChar 'r') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'r'))) ::' rest , 2) len-dec-rewrite {- P22-} ((Id "P22") :: _::_(InputChar 's') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 's'))) ::' rest , 2) len-dec-rewrite {- P23-} ((Id "P23") :: _::_(InputChar 't') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 't'))) ::' rest , 2) len-dec-rewrite {- P24-} ((Id "P24") :: _::_(InputChar 'u') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'u'))) ::' rest , 2) len-dec-rewrite {- P25-} ((Id "P25") :: _::_(InputChar 'v') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'v'))) ::' rest , 2) len-dec-rewrite {- P26-} ((Id "P26") :: _::_(InputChar 'w') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'w'))) ::' rest , 2) len-dec-rewrite {- P27-} ((Id "P27") :: _::_(InputChar 'x') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'x'))) ::' rest , 2) len-dec-rewrite {- P28-} ((Id "P28") :: _::_(InputChar 'y') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'y'))) ::' rest , 2) len-dec-rewrite {- P29-} ((Id "P29") :: _::_(InputChar 'z') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'z'))) ::' rest , 2) len-dec-rewrite {- P3-} ((Id "P3") :: (ParseTree parsed-squote) :: (ParseTree (parsed-path-star-1 x0)) :: _::_(ParseTree parsed-squote) rest) = just (ParseTree (parsed-path (string-append 0 x0)) ::' rest , 4) len-dec-rewrite {- P30-} ((Id "P30") :: _::_(InputChar 'A') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'A'))) ::' rest , 2) len-dec-rewrite {- P31-} ((Id "P31") :: _::_(InputChar 'B') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'B'))) ::' rest , 2) len-dec-rewrite {- P32-} ((Id "P32") :: _::_(InputChar 'C') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'C'))) ::' rest , 2) len-dec-rewrite {- P33-} ((Id "P33") :: _::_(InputChar 'D') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'D'))) ::' rest , 2) len-dec-rewrite {- P34-} ((Id "P34") :: _::_(InputChar 'E') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'E'))) ::' rest , 2) len-dec-rewrite {- P35-} ((Id "P35") :: _::_(InputChar 'F') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'F'))) ::' rest , 2) len-dec-rewrite {- P36-} ((Id "P36") :: _::_(InputChar 'G') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'G'))) ::' rest , 2) len-dec-rewrite {- P37-} ((Id "P37") :: _::_(InputChar 'H') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'H'))) ::' rest , 2) len-dec-rewrite {- P38-} ((Id "P38") :: _::_(InputChar 'I') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'I'))) ::' rest , 2) len-dec-rewrite {- P39-} ((Id "P39") :: _::_(InputChar 'J') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'J'))) ::' rest , 2) len-dec-rewrite {- P4-} ((Id "P4") :: _::_(InputChar 'a') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'a'))) ::' rest , 2) len-dec-rewrite {- P40-} ((Id "P40") :: _::_(InputChar 'K') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'K'))) ::' rest , 2) len-dec-rewrite {- P41-} ((Id "P41") :: _::_(InputChar 'L') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'L'))) ::' rest , 2) len-dec-rewrite {- P42-} ((Id "P42") :: _::_(InputChar 'M') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'M'))) ::' rest , 2) len-dec-rewrite {- P43-} ((Id "P43") :: _::_(InputChar 'N') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'N'))) ::' rest , 2) len-dec-rewrite {- P44-} ((Id "P44") :: _::_(InputChar 'O') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'O'))) ::' rest , 2) len-dec-rewrite {- P45-} ((Id "P45") :: _::_(InputChar 'P') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'P'))) ::' rest , 2) len-dec-rewrite {- P46-} ((Id "P46") :: _::_(InputChar 'Q') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'Q'))) ::' rest , 2) len-dec-rewrite {- P47-} ((Id "P47") :: _::_(InputChar 'R') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'R'))) ::' rest , 2) len-dec-rewrite {- P48-} ((Id "P48") :: _::_(InputChar 'S') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'S'))) ::' rest , 2) len-dec-rewrite {- P49-} ((Id "P49") :: _::_(InputChar 'T') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'T'))) ::' rest , 2) len-dec-rewrite {- P5-} ((Id "P5") :: _::_(InputChar 'b') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'b'))) ::' rest , 2) len-dec-rewrite {- P50-} ((Id "P50") :: _::_(InputChar 'U') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'U'))) ::' rest , 2) len-dec-rewrite {- P51-} ((Id "P51") :: _::_(InputChar 'V') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'V'))) ::' rest , 2) len-dec-rewrite {- P52-} ((Id "P52") :: _::_(InputChar 'W') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'W'))) ::' rest , 2) len-dec-rewrite {- P53-} ((Id "P53") :: _::_(InputChar 'X') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'X'))) ::' rest , 2) len-dec-rewrite {- P54-} ((Id "P54") :: _::_(InputChar 'Y') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'Y'))) ::' rest , 2) len-dec-rewrite {- P55-} ((Id "P55") :: _::_(InputChar 'Z') rest) = just (ParseTree (parsed-alpha-range-3 (string-append 0 (char-to-string 'Z'))) ::' rest , 2) len-dec-rewrite {- P56-} ((Id "P56") :: _::_(ParseTree (parsed-alpha-range-2 x0)) rest) = just (ParseTree (parsed-alpha-bar-4 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P57-} ((Id "P57") :: _::_(ParseTree (parsed-alpha-range-3 x0)) rest) = just (ParseTree (parsed-alpha-bar-4 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P58-} ((Id "P58") :: _::_(ParseTree (parsed-alpha-bar-4 x0)) rest) = just (ParseTree (parsed-alpha (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P59-} ((Id "P59") :: _::_(InputChar '0') rest) = just (ParseTree (parsed-numone-range-5 (string-append 0 (char-to-string '0'))) ::' rest , 2) len-dec-rewrite {- P6-} ((Id "P6") :: _::_(InputChar 'c') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'c'))) ::' rest , 2) len-dec-rewrite {- P60-} ((Id "P60") :: _::_(InputChar '1') rest) = just (ParseTree (parsed-numone-range-5 (string-append 0 (char-to-string '1'))) ::' rest , 2) len-dec-rewrite {- P61-} ((Id "P61") :: _::_(InputChar '2') rest) = just (ParseTree (parsed-numone-range-5 (string-append 0 (char-to-string '2'))) ::' rest , 2) len-dec-rewrite {- P62-} ((Id "P62") :: _::_(InputChar '3') rest) = just (ParseTree (parsed-numone-range-5 (string-append 0 (char-to-string '3'))) ::' rest , 2) len-dec-rewrite {- P63-} ((Id "P63") :: _::_(InputChar '4') rest) = just (ParseTree (parsed-numone-range-5 (string-append 0 (char-to-string '4'))) ::' rest , 2) len-dec-rewrite {- P64-} ((Id "P64") :: _::_(InputChar '5') rest) = just (ParseTree (parsed-numone-range-5 (string-append 0 (char-to-string '5'))) ::' rest , 2) len-dec-rewrite {- P65-} ((Id "P65") :: _::_(InputChar '6') rest) = just (ParseTree (parsed-numone-range-5 (string-append 0 (char-to-string '6'))) ::' rest , 2) len-dec-rewrite {- P66-} ((Id "P66") :: _::_(InputChar '7') rest) = just (ParseTree (parsed-numone-range-5 (string-append 0 (char-to-string '7'))) ::' rest , 2) len-dec-rewrite {- P67-} ((Id "P67") :: _::_(InputChar '8') rest) = just (ParseTree (parsed-numone-range-5 (string-append 0 (char-to-string '8'))) ::' rest , 2) len-dec-rewrite {- P68-} ((Id "P68") :: _::_(InputChar '9') rest) = just (ParseTree (parsed-numone-range-5 (string-append 0 (char-to-string '9'))) ::' rest , 2) len-dec-rewrite {- P69-} ((Id "P69") :: _::_(ParseTree (parsed-numone-range-5 x0)) rest) = just (ParseTree (parsed-numone (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P7-} ((Id "P7") :: _::_(InputChar 'd') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'd'))) ::' rest , 2) len-dec-rewrite {- P70-} ((Id "P70") :: _::_(ParseTree (parsed-numone x0)) rest) = just (ParseTree (parsed-num-plus-6 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P71-} ((Id "P71") :: (ParseTree (parsed-numone x0)) :: _::_(ParseTree (parsed-num-plus-6 x1)) rest) = just (ParseTree (parsed-num-plus-6 (string-append 1 x0 x1)) ::' rest , 3) len-dec-rewrite {- P72-} ((Id "P72") :: _::_(ParseTree (parsed-num-plus-6 x0)) rest) = just (ParseTree (parsed-num (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P73-} ((Id "P73") :: _::_(InputChar '\'') rest) = just (ParseTree (parsed-numpunct-bar-7 (string-append 0 (char-to-string '\''))) ::' rest , 2) len-dec-rewrite {- P74-} ((Id "P74") :: _::_(InputChar '-') rest) = just (ParseTree (parsed-numpunct-bar-7 (string-append 0 (char-to-string '-'))) ::' rest , 2) len-dec-rewrite {- P75-} ((Id "P75") :: _::_(ParseTree (parsed-numone x0)) rest) = just (ParseTree (parsed-numpunct-bar-8 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P76-} ((Id "P76") :: _::_(ParseTree (parsed-numpunct-bar-7 x0)) rest) = just (ParseTree (parsed-numpunct-bar-8 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P77-} ((Id "P77") :: _::_(ParseTree (parsed-numpunct-bar-8 x0)) rest) = just (ParseTree (parsed-numpunct (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P78-} ((Id "P78") :: _::_(InputChar '/') rest) = just (ParseTree (parsed-anychar-bar-9 (string-append 0 (char-to-string '/'))) ::' rest , 2) len-dec-rewrite {- P79-} ((Id "P79") :: _::_(InputChar '_') rest) = just (ParseTree (parsed-anychar-bar-9 (string-append 0 (char-to-string '_'))) ::' rest , 2) len-dec-rewrite {- P8-} ((Id "P8") :: _::_(InputChar 'e') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'e'))) ::' rest , 2) len-dec-rewrite {- P80-} ((Id "P80") :: _::_(InputChar '>') rest) = just (ParseTree (parsed-anychar-bar-10 (string-append 0 (char-to-string '>'))) ::' rest , 2) len-dec-rewrite {- P81-} ((Id "P81") :: _::_(ParseTree (parsed-anychar-bar-9 x0)) rest) = just (ParseTree (parsed-anychar-bar-10 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P82-} ((Id "P82") :: _::_(InputChar '<') rest) = just (ParseTree (parsed-anychar-bar-11 (string-append 0 (char-to-string '<'))) ::' rest , 2) len-dec-rewrite {- P83-} ((Id "P83") :: _::_(ParseTree (parsed-anychar-bar-10 x0)) rest) = just (ParseTree (parsed-anychar-bar-11 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P84-} ((Id "P84") :: _::_(InputChar '+') rest) = just (ParseTree (parsed-anychar-bar-12 (string-append 0 (char-to-string '+'))) ::' rest , 2) len-dec-rewrite {- P85-} ((Id "P85") :: _::_(ParseTree (parsed-anychar-bar-11 x0)) rest) = just (ParseTree (parsed-anychar-bar-12 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P86-} ((Id "P86") :: _::_(InputChar '=') rest) = just (ParseTree (parsed-anychar-bar-13 (string-append 0 (char-to-string '='))) ::' rest , 2) len-dec-rewrite {- P87-} ((Id "P87") :: _::_(ParseTree (parsed-anychar-bar-12 x0)) rest) = just (ParseTree (parsed-anychar-bar-13 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P88-} ((Id "P88") :: _::_(InputChar '-') rest) = just (ParseTree (parsed-anychar-bar-14 (string-append 0 (char-to-string '-'))) ::' rest , 2) len-dec-rewrite {- P89-} ((Id "P89") :: _::_(ParseTree (parsed-anychar-bar-13 x0)) rest) = just (ParseTree (parsed-anychar-bar-14 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P9-} ((Id "P9") :: _::_(InputChar 'f') rest) = just (ParseTree (parsed-alpha-range-2 (string-append 0 (char-to-string 'f'))) ::' rest , 2) len-dec-rewrite {- P90-} ((Id "P90") :: _::_(InputChar '}') rest) = just (ParseTree (parsed-anychar-bar-15 (string-append 0 (char-to-string '}'))) ::' rest , 2) len-dec-rewrite {- P91-} ((Id "P91") :: _::_(ParseTree (parsed-anychar-bar-14 x0)) rest) = just (ParseTree (parsed-anychar-bar-15 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P92-} ((Id "P92") :: _::_(InputChar '{') rest) = just (ParseTree (parsed-anychar-bar-16 (string-append 0 (char-to-string '{'))) ::' rest , 2) len-dec-rewrite {- P93-} ((Id "P93") :: _::_(ParseTree (parsed-anychar-bar-15 x0)) rest) = just (ParseTree (parsed-anychar-bar-16 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P94-} ((Id "P94") :: _::_(InputChar '!') rest) = just (ParseTree (parsed-anychar-bar-17 (string-append 0 (char-to-string '!'))) ::' rest , 2) len-dec-rewrite {- P95-} ((Id "P95") :: _::_(ParseTree (parsed-anychar-bar-16 x0)) rest) = just (ParseTree (parsed-anychar-bar-17 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P96-} ((Id "P96") :: _::_(InputChar ',') rest) = just (ParseTree (parsed-anychar-bar-18 (string-append 0 (char-to-string ','))) ::' rest , 2) len-dec-rewrite {- P97-} ((Id "P97") :: _::_(ParseTree (parsed-anychar-bar-17 x0)) rest) = just (ParseTree (parsed-anychar-bar-18 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- P98-} ((Id "P98") :: _::_(InputChar ']') rest) = just (ParseTree (parsed-anychar-bar-19 (string-append 0 (char-to-string ']'))) ::' rest , 2) len-dec-rewrite {- P99-} ((Id "P99") :: _::_(ParseTree (parsed-anychar-bar-18 x0)) rest) = just (ParseTree (parsed-anychar-bar-19 (string-append 0 x0)) ::' rest , 2) len-dec-rewrite {- PathsCons-} ((Id "PathsCons") :: (ParseTree parsed-ws) :: (ParseTree (parsed-path x0)) :: _::_(ParseTree (parsed-paths x1)) rest) = just (ParseTree (parsed-paths (norm-paths (PathsCons x0 x1))) ::' rest , 4) len-dec-rewrite {- ShowQualifiedVars-} ((Id "ShowQualifiedVars") :: (InputChar 's') :: (InputChar 'h') :: (InputChar 'o') :: (InputChar 'w') :: (InputChar '-') :: (InputChar 'q') :: (InputChar 'u') :: (InputChar 'a') :: (InputChar 'l') :: (InputChar 'i') :: (InputChar 'f') :: (InputChar 'i') :: (InputChar 'e') :: (InputChar 'd') :: (InputChar '-') :: (InputChar 'v') :: (InputChar 'a') :: (InputChar 'r') :: (InputChar 's') :: (ParseTree parsed-ows) :: (InputChar '=') :: (ParseTree parsed-ows) :: (ParseTree (parsed-str-bool x0)) :: (ParseTree parsed-ows) :: (InputChar '.') :: _::_(ParseTree parsed-ows) rest) = just (ParseTree (parsed-opt (norm-opt (ShowQualifiedVars x0))) ::' rest , 27) len-dec-rewrite {- StrBoolFalse-} ((Id "StrBoolFalse") :: (InputChar 'f') :: (InputChar 'a') :: (InputChar 'l') :: (InputChar 's') :: _::_(InputChar 'e') rest) = just (ParseTree (parsed-str-bool (norm-str-bool StrBoolFalse)) ::' rest , 6) len-dec-rewrite {- StrBoolTrue-} ((Id "StrBoolTrue") :: (InputChar 't') :: (InputChar 'r') :: (InputChar 'u') :: _::_(InputChar 'e') rest) = just (ParseTree (parsed-str-bool (norm-str-bool StrBoolTrue)) ::' rest , 5) len-dec-rewrite {- UseCedeFiles-} ((Id "UseCedeFiles") :: (InputChar 'u') :: (InputChar 's') :: (InputChar 'e') :: (InputChar '-') :: (InputChar 'c') :: (InputChar 'e') :: (InputChar 'd') :: (InputChar 'e') :: (InputChar '-') :: (InputChar 'f') :: (InputChar 'i') :: (InputChar 'l') :: (InputChar 'e') :: (InputChar 's') :: (ParseTree parsed-ows) :: (InputChar '=') :: (ParseTree parsed-ows) :: (ParseTree (parsed-str-bool x0)) :: (ParseTree parsed-ows) :: (InputChar '.') :: _::_(ParseTree parsed-ows) rest) = just (ParseTree (parsed-opt (norm-opt (UseCedeFiles x0))) ::' rest , 22) len-dec-rewrite {- OptsNil-} (_::_(Id "OptsNil") rest) = just (ParseTree (parsed-opts (norm-opts OptsNil)) ::' rest , 1) len-dec-rewrite {- P1-} (_::_(Id "P1") rest) = just (ParseTree (parsed-path-star-1 empty-string) ::' rest , 1) len-dec-rewrite {- P121-} (_::_(Id "P121") rest) = just (ParseTree parsed-comment-star-30 ::' rest , 1) len-dec-rewrite {- P134-} (_::_(Id "P134") rest) = just (ParseTree parsed-ows-star-35 ::' rest , 1) len-dec-rewrite {- PathsNil-} (_::_(Id "PathsNil") rest) = just (ParseTree (parsed-paths (norm-paths PathsNil)) ::' rest , 1) len-dec-rewrite {- Posinfo-} (_::_(Posinfo n) rest) = just (ParseTree (parsed-posinfo (ℕ-to-string n)) ::' rest , 1) len-dec-rewrite x = nothing rrs : rewriteRules rrs = record { len-dec-rewrite = len-dec-rewrite }
{ "alphanum_fraction": 0.6091395898, "avg_line_length": 127.0086455331, "ext": "agda", "hexsha": "f4c1f69d8496ede6c0c2fe747792d01b65ca6126", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "xoltar/cedille", "max_forks_repo_path": "src/options.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "xoltar/cedille", "max_issues_repo_path": "src/options.agda", "max_line_length": 1723, "max_stars_count": null, "max_stars_repo_head_hexsha": "acf691e37210607d028f4b19f98ec26c4353bfb5", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "xoltar/cedille", "max_stars_repo_path": "src/options.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 16033, "size": 44072 }
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2020, 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} open import LibraBFT.Prelude open import LibraBFT.Lemmas open import LibraBFT.Base.Types open import LibraBFT.Abstract.Types.EpochConfig open WithAbsVote -- This module defines RecordChains and related types and utility definitions module LibraBFT.Abstract.RecordChain (UID : Set) (_≟UID_ : (u₀ u₁ : UID) → Dec (u₀ ≡ u₁)) (NodeId : Set) (𝓔 : EpochConfig UID NodeId) (𝓥 : VoteEvidence UID NodeId 𝓔) where open import LibraBFT.Abstract.Records UID _≟UID_ NodeId 𝓔 𝓥 open import LibraBFT.Abstract.Records.Extends UID _≟UID_ NodeId 𝓔 𝓥 open import LibraBFT.Abstract.Types UID NodeId open EpochConfig 𝓔 -- One way of looking at a 'RecordChain r' is as a path from the epoch's -- initial record (I) to r. For generality, we express this in two steps. data RecordChainFrom (o : Record) : Record → Set where empty : RecordChainFrom o o step : ∀ {r r'} → (rc : RecordChainFrom o r) → r ← r' → RecordChainFrom o r' RecordChain : Record → Set RecordChain = RecordChainFrom I prevBlock : ∀{q} → RecordChain (Q q) → Block prevBlock (step {r = B b} _ (B←Q _ _)) = b prevQCorI : ∀{b} → RecordChain (B b) → Record prevQCorI (step _ (I←B _ _)) = I prevQCorI (step {r = Q q} _ (Q←B _ _)) = Q q -- Returns the unique identifier of the parent tagged to be either -- the initial block or a B or Q. parentUID : ∀{b} → RecordChain (B b) → TypedUID parentUID (step {r = I} _ _) = id-I parentUID (step {r = Q q} _ _) = id-B∨Q (qCertBlockId q) -- Defition of 'previous_round' as in Section 5.5 (see Abstract.Properties). currRound : ∀{r} → RecordChain r → Round currRound empty = 0 currRound (step {r = r} _ _) = round r -- TODO-1: it would be cleaner to define prevRound only for RecordChains ending in a Block. prevRound : ∀{r} → RecordChain r → Round prevRound empty = 0 prevRound (step rc (I←B x vr)) = 0 prevRound (step rc (Q←B x vr)) = currRound rc prevRound (step rc (B←Q x vr)) = prevRound rc -- Extensional definition of prevRound; useful to 'rewrite' on. prevRound-ss : ∀{b₁ q b}(rc : RecordChain (B b₁)) → (ext₁ : B b₁ ← Q q) → (ext₀ : Q q ← B b) → prevRound (step (step rc ext₁) ext₀) ≡ bRound b₁ prevRound-ss rc (B←Q _ _) (Q←B _ _) = refl ---------------------- -- RecordChain Equality and Irrelevance -- -- Distributing a record relation pointwise -- over record chains. Let rc₀ and rc₁ be as illustrated -- below; a value of type ≈RC-pw, named prf is shown -- in between them. -- -- rc₀ : B₀ ← C₀ ← B₁ ← C₁ ← ⋯ ← Bₖ ← Cₖ -- -- prf ≈ ≈ ≈ ≈ ≈ ≈ -- -- rc₁ : 𝓑₀ ← 𝓒₀ ← 𝓑₁ ← 𝓒₁ ← ⋯ ← 𝓑ₖ ← 𝓒ₖ -- -- data ≈RC-pw {ℓ}(_≈_ : Rel Record ℓ) : ∀{o₀ o₁ r₀ r₁} → RecordChainFrom o₀ r₀ → RecordChainFrom o₁ r₁ → Set ℓ where eq-empty : ∀{o₀ o₁} → o₀ ≈ o₁ → ≈RC-pw _≈_ (empty {o = o₀}) (empty {o = o₁}) eq-step : ∀{o₀ o₁ r₀ r₁ s₀ s₁} → (rc₀ : RecordChainFrom o₀ s₀) → (rc₁ : RecordChainFrom o₁ s₁) → r₀ ≈ r₁ → (ext₀ : s₀ ← r₀) → (ext₁ : s₁ ← r₁) → ≈RC-pw _≈_ rc₀ rc₁ → ≈RC-pw _≈_ (step rc₀ ext₀) (step rc₁ ext₁) -- RecordChain equivalence is then defined in terms of -- record equivalence (i.e., we don't care about the set of -- votes for the QCs in the chain); borrowing the illustration -- above, we now have: -- -- rc₀ : B₀ ← C₀ ← B₁ ← C₁ ← ⋯ ← Bₖ ← Cₖ -- -- prf ≡ ≈QC ≡ ≈QC ≡ ≈QC -- -- rc₁ : 𝓑₀ ← 𝓒₀ ← 𝓑₁ ← 𝓒₁ ← ⋯ ← 𝓑ₖ ← 𝓒ₖ -- -- It is easy to see that if rc₀ ≈RC rc₁, then they contain -- the same blocks (propositionally!) but potentially -- different /sets of votes/ certifying said blocks. _≈RC_ : ∀{o₀ o₁ r₀ r₁} → RecordChainFrom o₀ r₀ → RecordChainFrom o₁ r₁ → Set _≈RC_ = ≈RC-pw _≈Rec_ ≈RC-head : ∀{o₀ o₁ r₀ r₁}{rc₀ : RecordChainFrom o₀ r₀}{rc₁ : RecordChainFrom o₁ r₁} → rc₀ ≈RC rc₁ → o₀ ≈Rec o₁ ≈RC-head (eq-empty x) = x ≈RC-head (eq-step _ _ _ _ _ x) = ≈RC-head x -- Heterogeneous irrelevance of _≈RC_ happens only modulo -- propositional non-injectivity of block ids. ≈RC-refl : ∀{r₀ r₁}(rc₀ : RecordChain r₀)(rc₁ : RecordChain r₁) → r₀ ≈Rec r₁ → NonInjective _≡_ bId ⊎ (rc₀ ≈RC rc₁) ≈RC-refl empty empty hyp = inj₂ (eq-empty hyp) ≈RC-refl (step r0 x) (step r1 x₁) hyp = (←-≈Rec x x₁ hyp ⊎⟫= ≈RC-refl r0 r1) ⊎⟫= (inj₂ ∘ eq-step r0 r1 hyp x x₁) ≈RC-refl empty (step r1 (I←B x x₁)) () ≈RC-refl empty (step r1 (Q←B x x₁)) () ≈RC-refl empty (step r1 (B←Q x x₁)) () ≈RC-refl (step r0 (I←B x x₁)) empty () ≈RC-refl (step r0 (Q←B x x₁)) empty () ≈RC-refl (step r0 (B←Q x x₁)) empty () ≈RC-sym : ∀{o₀ o₁ r₀ r₁}{rc₀ : RecordChainFrom o₀ r₀}{rc₁ : RecordChainFrom o₁ r₁} → rc₀ ≈RC rc₁ → rc₁ ≈RC rc₀ ≈RC-sym (eq-empty x) = eq-empty (≈Rec-sym x) ≈RC-sym (eq-step rc₀ rc₁ x ext₀ ext₁ hyp) = eq-step rc₁ rc₀ (≈Rec-sym x) ext₁ ext₀ (≈RC-sym hyp) ≈RC-trans : ∀ {r₀ r₁ r₂} → {rc₀ : RecordChain r₀}{rc₁ : RecordChain r₁}{rc₂ : RecordChain r₂} → rc₀ ≈RC rc₁ → rc₁ ≈RC rc₂ → rc₀ ≈RC rc₂ ≈RC-trans (eq-empty x) q = q ≈RC-trans (eq-step rc₀ rc₁ x ext₀ ext₁ p) (eq-step .rc₁ rc₂ x₁ .ext₁ ext₂ q) = eq-step rc₀ rc₂ (≈Rec-trans x x₁) ext₀ ext₂ (≈RC-trans p q) -- Heterogeneous irrelevance proves that two record chains that end at the same record -- have the same blocks and equivalent QCs. RecordChain-irrelevant : ∀{r}(rc₀ : RecordChain r)(rc₁ : RecordChain r) → NonInjective _≡_ bId ⊎ rc₀ ≈RC rc₁ RecordChain-irrelevant rc0 rc1 = ≈RC-refl rc0 rc1 ≈Rec-refl ------------------------------------------------- -- Sub RecordChains -- A value of type '⊆RC-pw _≈_ rc1 rc2' establishes that rc1 is -- a suffix of rc2 modulo _≈_. data ⊆RC-pw {ℓ}(_≈_ : Rel Record ℓ) : ∀{o₀ o₁ r₀ r₁} → RecordChainFrom o₀ r₀ → RecordChainFrom o₁ r₁ → Set ℓ where sub-empty : ∀{o₀ o₁ s₁}{r₁ : RecordChainFrom o₁ s₁} → o₀ ≈ s₁ → ⊆RC-pw _≈_ (empty {o = o₀}) r₁ sub-step : ∀{o₀ o₁ r₀ r₁ s₀ s₁} → (rc₀ : RecordChainFrom o₀ s₀) → (rc₁ : RecordChainFrom o₁ s₁) → r₀ ≈ r₁ → (ext₀ : s₀ ← r₀) → (ext₁ : s₁ ← r₁) → ⊆RC-pw _≈_ rc₀ rc₁ → ⊆RC-pw _≈_ (step rc₀ ext₀) (step rc₁ ext₁) _⊆RC_ : ∀{o₀ o₁ r₀ r₁} → RecordChainFrom o₀ r₀ → RecordChainFrom o₁ r₁ → Set _⊆RC_ = ⊆RC-pw _≈Rec_ -- The ⊆RC relation is used to establish irrelevance of suffixes RecordChainFrom-irrelevant : ∀{o₀ o₁ r₀ r₁}(rc₀ : RecordChainFrom o₀ r₀)(rc₁ : RecordChainFrom o₁ r₁) → r₀ ≈Rec r₁ → NonInjective _≡_ bId ⊎ (rc₀ ⊆RC rc₁ ⊎ rc₁ ⊆RC rc₀) RecordChainFrom-irrelevant empty empty hyp = inj₂ (inj₁ (sub-empty hyp)) RecordChainFrom-irrelevant empty (step rc1 x) hyp = inj₂ (inj₁ (sub-empty hyp)) RecordChainFrom-irrelevant (step rc0 x) empty hyp = inj₂ (inj₂ (sub-empty (≈Rec-sym hyp))) RecordChainFrom-irrelevant (step rc0 x) (step rc1 x₁) hyp = (←-≈Rec x x₁ hyp ⊎⟫= RecordChainFrom-irrelevant rc0 rc1) ⊎⟫= (inj₂ ∘ either (inj₁ ∘ sub-step rc0 rc1 hyp x x₁) (inj₂ ∘ sub-step rc1 rc0 (≈Rec-sym hyp) x₁ x)) -- If a chain from the initial record is a suffix from a second chain, -- then the second chain is also from the initial record. RecordChain-glb : ∀{o' r r'}{rc : RecordChain r}{rcf : RecordChainFrom o' r'} → rc ⊆RC rcf → rc ≈RC rcf RecordChain-glb {rcf = step _ ()} (sub-empty eq-I) RecordChain-glb {rcf = empty} (sub-empty eq-I) = eq-empty eq-I RecordChain-glb (sub-step rc₀ rc₁ x ext₀ ext₁ sub) = eq-step rc₀ rc₁ x ext₀ ext₁ (RecordChain-glb sub) ------------------------------------------------- -- Id congruences over RecordChain equivalences parentUID-≈ : ∀{b₀ b₁}(rc₀ : RecordChain (B b₀))(rc₁ : RecordChain (B b₁)) → rc₀ ≈RC rc₁ → parentUID rc₀ ≡ parentUID rc₁ parentUID-≈ _ _ (eq-step _ _ (eq-B refl) _ _ (eq-empty x)) = refl parentUID-≈ _ _ (eq-step _ _ (eq-B refl) _ _ (eq-step _ _ (eq-Q refl) _ _ _)) = refl -------------------------- -- RecordChain elements data _∈RC-simple_ {o : Record}(r₀ : Record) : ∀{r₁} → RecordChainFrom o r₁ → Set where here : ∀{rc : RecordChainFrom o r₀} → r₀ ∈RC-simple rc there : ∀{r₁ r₂}{rc : RecordChainFrom o r₁}(p : r₁ ← r₂) → r₀ ∈RC-simple rc → r₀ ∈RC-simple (step rc p) -- States that a given record belongs in a record chain. data _∈RC_ {o : Record}(r₀ : Record) : ∀{r₁} → RecordChainFrom o r₁ → Set where here : ∀{rc : RecordChainFrom o r₀} → r₀ ∈RC rc there : ∀{r₁ r₂}{rc : RecordChainFrom o r₁}(p : r₁ ← r₂) → r₀ ∈RC rc → r₀ ∈RC (step rc p) -- This is an important rule. It is the equivalent of a -- /congruence/ on record chains and enables us to prove -- the 𝕂-chain-∈RC property. transp : ∀{r}{rc₀ : RecordChainFrom o r}{rc₁ : RecordChainFrom o r} → r₀ ∈RC rc₀ → rc₀ ≈RC rc₁ → r₀ ∈RC rc₁ ∈RC-empty-I : ∀{r} → r ∈RC (empty {o = I}) → r ≡ I ∈RC-empty-I here = refl ∈RC-empty-I (transp old (eq-empty x)) = ∈RC-empty-I old b∉RCempty : ∀ {b} → B b ∈RC empty → ⊥ b∉RCempty xx with ∈RC-empty-I xx ...| () transp-B∈RC : ∀{r r' b}{rc : RecordChain r}{rc' : RecordChain r'} → rc ≈RC rc' → B b ∈RC rc → B b ∈RC rc' transp-B∈RC rc≈rc' (transp b∈rc x) = transp-B∈RC (≈RC-trans x rc≈rc') b∈rc transp-B∈RC (eq-step rc₀ rc₁ (eq-B refl) ext₀ ext₁ rc≈rc') here = here transp-B∈RC (eq-step rc₀ rc₁ x .p ext₁ rc≈rc') (there p b∈rc) = there ext₁ (transp-B∈RC rc≈rc' b∈rc) -- A k-chain (paper Section 5.2; see Abstract.Properties) is a sequence of -- blocks and quorum certificates for said blocks: -- -- B₀ ← C₀ ← B₁ ← C₁ ← ⋯ ← Bₖ ← Cₖ -- -- such that for each Bᵢ some predicate R is satisfies for Bᵢ and Bᵢ₊₁. -- The first parameter R enables predicate definitions to avoid the need -- to find a predecessor for B₀ (see Contig definition below). -- -- The 𝕂-chain datatype captures exactly that structure. -- data 𝕂-chain (R : ℕ → Record → Record → Set) : (k : ℕ){o r : Record} → RecordChainFrom o r → Set where 0-chain : ∀{o r}{rc : RecordChainFrom o r} → 𝕂-chain R 0 rc s-chain : ∀{k o r}{rc : RecordChainFrom o r}{b : Block}{q : QC} → (r←b : r ← B b) → (prf : R k r (B b)) → (b←q : B b ← Q q) → 𝕂-chain R k rc → 𝕂-chain R (suc k) (step (step rc r←b) b←q) -- Simple 𝕂-chains do not impose any restricton on its records. Simple : ℕ → Record → Record → Set Simple _ _ _ = Unit -- Contiguous 𝕂-chains are those in which all adjacent pairs of Records have contiguous rounds. Contig : ℕ → Record → Record → Set Contig 0 _ _ = Unit Contig (suc _) r r' = round r' ≡ suc (round r) -- The 'Contig' relation is substitutive in a rather restrictive setting, -- but this is enough for our purposes. Contig-subst : ∀{k r r' b}{rc : RecordChain r}{rc' : RecordChain r'} → rc ≈RC rc' → r ← (B b) → Contig k r (B b) → Contig k r' (B b) Contig-subst {zero} _ _ _ = unit Contig-subst {suc k} (eq-empty x) _ cr = cr Contig-subst {suc k} (eq-step .(step rc₀ ext₂) .(step rc₁ ext₃) (eq-Q x) (B←Q refl refl) (B←Q refl refl) (eq-step rc₀ rc₁ (eq-B refl) ext₂ ext₃ rc≈rc')) (Q←B h0 h1) cr = cr -- Consequently, contiguous 𝕂-chains are substitutive w.r.t. _≈RC_ transp-𝕂-chain : ∀{k r r'}{rc : RecordChain r}{rc' : RecordChain r'} → rc ≈RC rc' → 𝕂-chain Contig k rc → 𝕂-chain Contig k rc' transp-𝕂-chain rc≈rc' 0-chain = 0-chain transp-𝕂-chain (eq-step .(step rc₀ r←b) .(step rc₁ r←b') (eq-Q refl) _ ext₁ (eq-step rc₀ rc₁ (eq-B refl) .r←b r←b' rc≈rc')) (s-chain r←b prf (B←Q _ _) kc) = s-chain r←b' (Contig-subst rc≈rc' r←b prf) ext₁ (transp-𝕂-chain rc≈rc' kc) -- TODO-2: Consider duplicating the above for the ⊆RC relation. -- I believe we can generalize all of this via the same function, but -- it's nontrivial to change the whole module. -- -- Arguably, the right way to deal with all of this would be to -- design the bare record chain type as the most expressive possible: -- -- data RC : ℕ → Record → Record -- -- Then, a value r of type 'RC 12 I (B b)' represents a record chain with -- 12 steps from I to (B b). K-chains become trivial to express: -- -- K-chain k = RC (2*k) ... Contig-subst-⊆ : ∀{k o o' r r' b}{rc : RecordChainFrom o r}{rc' : RecordChainFrom o' r'} → (kc : 𝕂-chain Contig k rc) → rc ⊆RC rc' → r ← (B b) → Contig k r (B b) → Contig k r' (B b) Contig-subst-⊆ 0-chain _ ext hyp = unit Contig-subst-⊆ (s-chain r←b prf _ kc) (sub-step _ _ (eq-Q x) (B←Q refl refl) (B←Q refl refl) (sub-step rc₀ rc₁ (eq-B refl) .r←b ext₂ sub)) ext hyp = hyp transp-𝕂-chain-⊆ : ∀{k o o' r r'}{rc : RecordChainFrom o r}{rc' : RecordChainFrom o' r'} → rc ⊆RC rc' → 𝕂-chain Contig k rc → 𝕂-chain Contig k rc' transp-𝕂-chain-⊆ rc⊆rc' 0-chain = 0-chain transp-𝕂-chain-⊆ (sub-step .(step rc₀ r←b) .(step rc₁ r←b') (eq-Q refl) _ ext₁ (sub-step rc₀ rc₁ (eq-B refl) .r←b r←b' rc⊆rc')) (s-chain r←b prf (B←Q _ _) kc) = s-chain r←b' (Contig-subst-⊆ kc rc⊆rc' r←b prf) ext₁ (transp-𝕂-chain-⊆ rc⊆rc' kc) 𝕂-chain-contig : (k : ℕ){o r : Record} → RecordChainFrom o r → Set 𝕂-chain-contig = 𝕂-chain Contig 𝕂-chain-to-Simple : ∀{R k r}{rc : RecordChain r} → 𝕂-chain R k rc → 𝕂-chain Simple k rc 𝕂-chain-to-Simple 0-chain = 0-chain 𝕂-chain-to-Simple (s-chain r←b prf b←q kc) = s-chain r←b unit b←q (𝕂-chain-to-Simple kc) -- Every record chain that ends in a QC is a 𝕂-chain to-kchain : ∀{q}(rc : RecordChain (Q q)) → ∃[ k ] (𝕂-chain Simple k rc) to-kchain (step (step {B b} rc ()) x@(B←Q _ _)) to-kchain (step (step {I} rc x₁) x@(B←Q _ _)) = 1 , s-chain x₁ unit x 0-chain to-kchain (step (step {Q q} rc x₁) x@(B←Q _ _)) with to-kchain rc ...| k , kc = suc k , s-chain x₁ unit x kc kchainForget : ∀{P k r}{rc : RecordChain r}(c : 𝕂-chain P k rc) → RecordChain r kchainForget {rc = rc} _ = rc -- Returns the round of the block heading the k-chain. kchainHeadRound : ∀{k r P}{rc : RecordChain r} → 𝕂-chain P k rc → Round kchainHeadRound (0-chain {r = r}) = round r kchainHeadRound (s-chain r←b _ b←q kk) = kchainHeadRound kk kchainBlock : ∀{k o r P}{rc : RecordChainFrom o r} → Fin k → 𝕂-chain P k rc → Block kchainBlock zero (s-chain {b = b} _ _ _ _) = b kchainBlock (suc x) (s-chain r←b _ b←q kk) = kchainBlock x kk kchainBlock-toSimple-≡ : ∀{k r P}{rc : RecordChain r}(x : Fin k)(c : 𝕂-chain P k rc) → kchainBlock x (𝕂-chain-to-Simple c) ≡ kchainBlock x c kchainBlock-toSimple-≡ zero (s-chain _ _ _ _) = refl kchainBlock-toSimple-≡ (suc x) (s-chain _ _ _ kk) = kchainBlock-toSimple-≡ x kk _b⟦_⟧ : ∀{k o r P}{rc : RecordChainFrom o r} → 𝕂-chain P k rc → Fin k → Block chain b⟦ ix ⟧ = kchainBlock ix chain kchainBlock-≈RC : ∀{k r r'}{rc : RecordChain r}{rc' : RecordChain r'} → (c3 : 𝕂-chain Contig k rc)(ix : Fin k) → (rc≈rc' : rc ≈RC rc') → c3 b⟦ ix ⟧ ≡ transp-𝕂-chain rc≈rc' c3 b⟦ ix ⟧ kchainBlock-≈RC 0-chain () _ kchainBlock-≈RC (s-chain r←b prf (B←Q _ _) kc) ix (eq-step .(step rc₀ r←b) .(step rc₁ r←b') (eq-Q refl) _ ext₁ (eq-step rc₀ rc₁ (eq-B refl) .r←b r←b' rc≈rc')) with ix ...| zero = refl ...| suc ix' = kchainBlock-≈RC kc ix' rc≈rc' kchainBlock-⊆RC : ∀{k o o' r r'}{rc : RecordChainFrom o r}{rc' : RecordChainFrom o' r'} → (c3 : 𝕂-chain Contig k rc)(ix : Fin k) → (rc⊆rc' : rc ⊆RC rc') → c3 b⟦ ix ⟧ ≡ transp-𝕂-chain-⊆ rc⊆rc' c3 b⟦ ix ⟧ kchainBlock-⊆RC 0-chain () _ kchainBlock-⊆RC (s-chain r←b prf (B←Q _ _) kc) ix (sub-step .(step rc₀ r←b) .(step rc₁ r←b') (eq-Q refl) _ ext₁ (sub-step rc₀ rc₁ (eq-B refl) .r←b r←b' rc≈rc')) with ix ...| zero = refl ...| suc ix' = kchainBlock-⊆RC kc ix' rc≈rc' kchainQC : ∀{k r P}{rc : RecordChain r} → Fin k → 𝕂-chain P k rc → QC kchainQC zero (s-chain {q = q} _ _ _ _) = q kchainQC (suc x) (s-chain r←b _ b←q kk) = kchainQC x kk kchain-to-RecordChain-at-b⟦⟧ : ∀{P k r}{rc : RecordChain r}(c : 𝕂-chain P k rc)(ix : Fin k) → RecordChain (B (c b⟦ ix ⟧)) kchain-to-RecordChain-at-b⟦⟧ 0-chain () kchain-to-RecordChain-at-b⟦⟧ (s-chain {rc = rc} r←b x b←q c) zero = (step rc r←b) kchain-to-RecordChain-at-b⟦⟧ (s-chain r←b x b←q c) (suc zz) = kchain-to-RecordChain-at-b⟦⟧ c zz kchainBlockRoundZero-lemma : ∀{k q P}{rc : RecordChain (Q q)}(c : 𝕂-chain P (suc k) rc) → getRound (kchainBlock zero c) ≡ getRound q kchainBlockRoundZero-lemma (s-chain r←b prf (B←Q r h) c) = sym r kchainBlockRound≤ : ∀{k r P}{rc : RecordChain r}(x y : Fin k)(kc : 𝕂-chain P k rc) → x ≤Fin y → getRound (kchainBlock y kc) ≤ getRound (kchainBlock x kc) kchainBlockRound≤ zero zero (s-chain r←b prf b←q kc) hyp = ≤-refl kchainBlockRound≤ zero (suc y) (s-chain (Q←B r r←b) prf b←q (s-chain r←b₁ prf₁ (B←Q refl b←q₁) kc)) hyp = ≤-trans (kchainBlockRound≤ zero y (s-chain r←b₁ prf₁ (B←Q refl b←q₁) kc) z≤n) (<⇒≤ r) kchainBlockRound≤ (suc x) (suc y) (s-chain r←b prf b←q kc) (s≤s hyp) = kchainBlockRound≤ x y kc hyp kchain-round-≤-lemma' : ∀{k q}{rc : RecordChain (Q q)}(c3 : 𝕂-chain Contig k rc)(ix : Fin k) → getRound (c3 b⟦ ix ⟧) ≤ getRound q kchain-round-≤-lemma' (s-chain r←b x (B←Q refl b←q) c3) zero = ≤-refl kchain-round-≤-lemma' (s-chain (I←B prf imp) unit (B←Q refl _) 0-chain) (suc ()) kchain-round-≤-lemma' (s-chain (Q←B prf imp) x (B←Q refl _) c2) (suc ix) = ≤-trans (kchain-round-≤-lemma' c2 ix) (<⇒≤ prf) rc-←-maxRound : ∀{r r'}(rc : RecordChain r') → r ∈RC rc → round r ≤ round r' rc-←-maxRound rc here = ≤-refl rc-←-maxRound rc (transp n x) = rc-←-maxRound _ n rc-←-maxRound .(step _ p) (there p n) = ≤-trans (rc-←-maxRound _ n) (←-round-≤ p) kchainBlock-correct : ∀{P k q b}{rc : RecordChain (B b)}{b←q : B b ← Q q} → (kc : 𝕂-chain P k (step rc b←q)) → (x : Fin k) → (B (kc b⟦ x ⟧)) ∈RC rc kchainBlock-correct (s-chain r←b prf b←q kc) zero = here kchainBlock-correct (s-chain r←b prf b←q (s-chain r←b₁ prf₁ b←q₁ kc)) (suc x) = there r←b (there b←q₁ (kchainBlock-correct (s-chain r←b₁ prf₁ b←q₁ kc) x)) -- This is an extended form of RecordChain-irrelevance. -- Let rc be: -- -- B₀ ← C₀ ← B₁ ← C₁ ← ⋯ ← Bₙ ← Cₙ -- -- The (c : 𝕂-chain P k rc) is a predicate on the shape -- of rc, establishing that it must be of the following shape: -- (where consecutive blocks satisfy P) -- -- B₀ ← C₀ ← B₁ ← C₁ ← ⋯ ← Bₙ₋ₖ ← Cₙ₋ₖ ⋯ ← Bₙ₋₁ ← Cₙ₋₁ ← Bₙ ← Cₙ -- /\ /\ / -- ⋯ P ₋⌟ ⌞₋₋₋₋ P ₋₋₋₋⌟ ⌞₋₋₋₋ P ₋₋₋⌟ -- -- This property states that any other RecordChain that contains one -- block b of the kchain above, it also contains the prefix of the -- kchain leading to b. -- 𝕂-chain-∈RC : ∀{r k P}{rc : RecordChain r} → (c : 𝕂-chain P k rc) → (x y : Fin k) → x ≤Fin y → {b : Block}(prf : kchainBlock x c ≡ b) → (rc₁ : RecordChain (B b)) → NonInjective _≡_ bId ⊎ (B (kchainBlock y c) ∈RC rc₁) 𝕂-chain-∈RC (s-chain r←b prf b←q c) zero y z≤n refl rc1 with RecordChain-irrelevant (step (kchainForget c) r←b) rc1 ...| inj₁ hb = inj₁ hb ...| inj₂ res = inj₂ (transp (kchainBlock-correct (s-chain r←b prf b←q c) y) res) 𝕂-chain-∈RC (s-chain r←b prf b←q c) (suc x) (suc y) (s≤s x≤y) hyp rc1 = 𝕂-chain-∈RC c x y x≤y hyp rc1 ----------------- -- Commit Rule -- -- A block (and everything preceeding it) is said to match the commit rule -- when the block is the head of a contiguious 3-chain. Here we define an auxiliary -- datatype to make definitions more readable. data CommitRuleFrom {o r : Record}(rc : RecordChainFrom o r)(b : Block) : Set where commit-rule : (c3 : 𝕂-chain Contig 3 rc) → b ≡ c3 b⟦ suc (suc zero) ⟧ → CommitRuleFrom rc b CommitRule : ∀{r} → RecordChain r → Block → Set CommitRule = CommitRuleFrom transp-CR : ∀{b q}{rc rc' : RecordChain (Q q)} → rc ≈RC rc' → CommitRule rc b → CommitRule rc' b transp-CR rc≈rc' (commit-rule c3 x) = commit-rule (transp-𝕂-chain rc≈rc' c3) (trans x (kchainBlock-≈RC c3 (suc (suc zero)) rc≈rc')) crf⇒cr : ∀ {o q b} → (rcf : RecordChainFrom o (Q q)) → (rc : RecordChain (Q q)) → CommitRuleFrom rcf b → NonInjective-≡ bId ⊎ CommitRule {Q q} rc b crf⇒cr rcf rc (commit-rule c3 prf) with RecordChainFrom-irrelevant rcf rc ≈Rec-refl ...| inj₁ hb = inj₁ hb ...| inj₂ (inj₁ rcf⊆rc) = inj₂ (commit-rule (transp-𝕂-chain-⊆ rcf⊆rc c3) (trans prf (kchainBlock-⊆RC c3 (suc (suc zero)) rcf⊆rc))) ...| inj₂ (inj₂ rc⊆rcf) with ≈RC-sym (RecordChain-glb rc⊆rcf) ...| rcf≈rc with ≈RC-head rcf≈rc ...| eq-I = inj₂ (transp-CR rcf≈rc (commit-rule c3 prf)) vote≡⇒QPrevId≡ : {q q' : QC} {v v' : Vote} → v ∈ qcVotes q → v' ∈ qcVotes q' → v ≡ v' → qCertBlockId q ≡ qCertBlockId q' vote≡⇒QPrevId≡ {q} {q'} v∈q v'∈q' refl with witness v∈q (qVotes-C2 q) | witness v'∈q' (qVotes-C2 q') ... | refl | refl = refl vote≡⇒QRound≡ : {q q' : QC} {v v' : Vote} → v ∈ qcVotes q → v' ∈ qcVotes q' → v ≡ v' → getRound q ≡ getRound q' vote≡⇒QRound≡ {q} {q'} v∈q v'∈q' refl with witness v∈q (qVotes-C3 q) | witness v'∈q' (qVotes-C3 q') ... | refl | refl = refl ¬bRound≡0 : ∀{b} → RecordChain (B b) → ¬ (getRound b ≡ 0) ¬bRound≡0 (step s (I←B () h)) refl ¬bRound≡0 (step s (Q←B () h)) refl
{ "alphanum_fraction": 0.5731336612, "avg_line_length": 42.6908396947, "ext": "agda", "hexsha": "676b8c72b1aeb0ab2feef21d40752912af3e9bf0", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "71aa2168e4875ffdeece9ba7472ee3cee5fa9084", "max_forks_repo_licenses": [ "UPL-1.0" ], "max_forks_repo_name": "cwjnkins/bft-consensus-agda", "max_forks_repo_path": "LibraBFT/Abstract/RecordChain.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "71aa2168e4875ffdeece9ba7472ee3cee5fa9084", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "UPL-1.0" ], "max_issues_repo_name": "cwjnkins/bft-consensus-agda", "max_issues_repo_path": "LibraBFT/Abstract/RecordChain.agda", "max_line_length": 111, "max_stars_count": null, "max_stars_repo_head_hexsha": "71aa2168e4875ffdeece9ba7472ee3cee5fa9084", "max_stars_repo_licenses": [ "UPL-1.0" ], "max_stars_repo_name": "cwjnkins/bft-consensus-agda", "max_stars_repo_path": "LibraBFT/Abstract/RecordChain.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 8583, "size": 22370 }
{-# OPTIONS --without-K --rewriting #-} open import HoTT -- an attempt to speed up [QuotGroup (im-nprop ...)] -- which removes most intermediate constructions module groups.Cokernel {i j} {G : Group i} {H : Group j} (φ : G →ᴳ H) (H-ab : is-abelian H) where -- G ---φ--→ᴳ H private module G = Group G module H = AbGroup (H , H-ab) module φ = GroupHom φ coker-rel : Rel H.El (lmax i j) coker-rel h₁ h₂ = Trunc -1 (hfiber φ.f (H.diff h₁ h₂)) private coker-El : Type (lmax i j) coker-El = SetQuot coker-rel coker-struct : GroupStructure coker-El coker-struct = record {M} where module M where ident : coker-El ident = q[ H.ident ] inv : coker-El → coker-El inv = SetQuot-rec SetQuot-level inv' inv-rel where inv' : H.El → coker-El inv' h = q[ H.inv h ] abstract inv-rel : ∀ {h₁ h₂} → coker-rel h₁ h₂ → inv' h₁ == inv' h₂ inv-rel {h₁} {h₂} = Trunc-rec (SetQuot-level _ _) λ{(g , φg=h₁h₂⁻¹) → quot-rel [ G.inv g , φ.pres-inv g ∙ ap H.inv φg=h₁h₂⁻¹ ∙ H.inv-diff h₁ h₂ ∙ H.comm h₂ (H.inv h₁) ∙ ap (H.comp (H.inv h₁)) (! (H.inv-inv h₂)) ]} comp : coker-El → coker-El → coker-El comp = SetQuot-rec level comp' comp-rel where abstract level : is-set (coker-El → coker-El) level = →-is-set SetQuot-level comp' : H.El → coker-El → coker-El comp' h₁ = SetQuot-rec SetQuot-level comp'' comp'-rel where comp'' : H.El → coker-El comp'' h₂ = q[ H.comp h₁ h₂ ] abstract comp'-rel : ∀ {h₂ h₂'} → coker-rel h₂ h₂' → comp'' h₂ == comp'' h₂' comp'-rel {h₂} {h₂'} = Trunc-rec (SetQuot-level _ _) λ{(g , φg=h₂h₂'⁻¹) → quot-rel [ g , ! ( ap (H.comp (H.comp h₁ h₂)) (H.inv-comp h₁ h₂') ∙ H.assoc h₁ h₂ (H.comp (H.inv h₂') (H.inv h₁)) ∙ ap (H.comp h₁) (! $ H.assoc h₂ (H.inv h₂') (H.inv h₁)) ∙ H.comm h₁ (H.comp (H.comp h₂ (H.inv h₂')) (H.inv h₁)) ∙ H.assoc (H.comp h₂ (H.inv h₂')) (H.inv h₁) h₁ ∙ ap2 H.comp (! φg=h₂h₂'⁻¹) (H.inv-l h₁) ∙ H.unit-r (φ.f g) )]} abstract comp-rel : ∀ {h₁ h₁'} → coker-rel h₁ h₁' → comp' h₁ == comp' h₁' comp-rel {h₁} {h₁'} = Trunc-rec (level _ _) λ{(g , φg=h₁h₁'⁻¹) → λ= $ SetQuot-elim (λ _ → =-preserves-set SetQuot-level) (λ h₂ → quot-rel [ g , ! ( ap (H.comp (H.comp h₁ h₂)) (H.inv-comp h₁' h₂) ∙ H.assoc h₁ h₂ (H.comp (H.inv h₂) (H.inv h₁')) ∙ ap (H.comp h₁) ( ! (H.assoc h₂ (H.inv h₂) (H.inv h₁')) ∙ ap (λ h → H.comp h (H.inv h₁')) (H.inv-r h₂) ∙ H.unit-l (H.inv h₁')) ∙ ! φg=h₁h₁'⁻¹ )]) (λ _ → prop-has-all-paths-↓ (SetQuot-level _ _))} abstract unit-l : ∀ cok → comp ident cok == cok unit-l = SetQuot-elim (λ _ → =-preserves-set SetQuot-level) (λ h → ap q[_] $ H.unit-l h) (λ _ → prop-has-all-paths-↓ (SetQuot-level _ _)) assoc : ∀ cok₁ cok₂ cok₃ → comp (comp cok₁ cok₂) cok₃ == comp cok₁ (comp cok₂ cok₃) assoc = SetQuot-elim (λ _ → Π-is-set λ _ → Π-is-set λ _ → =-preserves-set SetQuot-level) (λ h₁ → SetQuot-elim (λ _ → Π-is-set λ _ → =-preserves-set SetQuot-level) (λ h₂ → SetQuot-elim (λ _ → =-preserves-set SetQuot-level) (λ h₃ → ap q[_] $ H.assoc h₁ h₂ h₃) (λ _ → prop-has-all-paths-↓ (SetQuot-level _ _))) (λ _ → prop-has-all-paths-↓ (Π-is-prop λ _ → SetQuot-level _ _))) (λ _ → prop-has-all-paths-↓ (Π-is-prop λ _ → Π-is-prop λ _ → SetQuot-level _ _)) inv-l : ∀ cok → comp (inv cok) cok == ident inv-l = SetQuot-elim (λ _ → =-preserves-set SetQuot-level) (λ h → ap q[_] $ H.inv-l h) (λ _ → prop-has-all-paths-↓ (SetQuot-level _ _)) Coker : Group (lmax i j) Coker = group _ SetQuot-level coker-struct module Coker = Group Coker {- correctness -} Coker-β : Coker ≃ᴳ QuotGroup (im-npropᴳ φ H-ab) Coker-β = ≃-to-≃ᴳ (ide _) to-pres-comp where abstract to-pres-comp : preserves-comp Coker.comp (QuotGroup.comp (im-npropᴳ φ H-ab)) (idf _) to-pres-comp = SetQuot-elim (λ _ → Π-is-set λ _ → =-preserves-set SetQuot-level) (λ _ → SetQuot-elim (λ _ → =-preserves-set SetQuot-level) (λ _ → idp) (λ _ → prop-has-all-paths-↓ (SetQuot-level _ _))) (λ _ → prop-has-all-paths-↓ (Π-is-prop λ _ → SetQuot-level _ _))
{ "alphanum_fraction": 0.4844707805, "avg_line_length": 38.5354330709, "ext": "agda", "hexsha": "91cef999f7fecf9c72bbb0fdb923365495b63d96", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2018-12-26T21:31:57.000Z", "max_forks_repo_forks_event_min_datetime": "2018-12-26T21:31:57.000Z", "max_forks_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "mikeshulman/HoTT-Agda", "max_forks_repo_path": "theorems/groups/Cokernel.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "mikeshulman/HoTT-Agda", "max_issues_repo_path": "theorems/groups/Cokernel.agda", "max_line_length": 91, "max_stars_count": null, "max_stars_repo_head_hexsha": "e7d663b63d89f380ab772ecb8d51c38c26952dbb", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "mikeshulman/HoTT-Agda", "max_stars_repo_path": "theorems/groups/Cokernel.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1725, "size": 4894 }
{-# OPTIONS --safe --warning=error --without-K #-} open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) open import LogicalFormulae open import Sets.EquivalenceRelations open import Setoids.Setoids module Setoids.Intersection.Definition {a b : _} {A : Set a} (S : Setoid {a} {b} A) where open Setoid S open Equivalence eq open import Setoids.Subset S intersectionPredicate : {c d : _} {pred1 : A → Set c} {pred2 : A → Set d} (s1 : subset pred1) (s2 : subset pred2) → A → Set (c ⊔ d) intersectionPredicate {pred1 = pred1} {pred2} s1 s2 a = pred1 a && pred2 a intersection : {c d : _} {pred1 : A → Set c} {pred2 : A → Set d} (s1 : subset pred1) (s2 : subset pred2) → subset (intersectionPredicate s1 s2) intersection s1 s2 {x1} {x2} x1=x2 (inS1 ,, inS2) = s1 x1=x2 inS1 ,, s2 x1=x2 inS2
{ "alphanum_fraction": 0.6796482412, "avg_line_length": 41.8947368421, "ext": "agda", "hexsha": "2417d3e5fcc6b611837d0ce68706e88f7e453c2d", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_path": "Setoids/Intersection/Definition.agda", "max_issues_count": 14, "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_path": "Setoids/Intersection/Definition.agda", "max_line_length": 143, "max_stars_count": 4, "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_path": "Setoids/Intersection/Definition.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "num_tokens": 285, "size": 796 }
{-# OPTIONS --cubical --safe #-} module Control.Monad.State where open import Prelude record StatePair {s a} (S : Type s) (A : Type a) : Type (a ℓ⊔ s) where constructor state-pair field value : A state : S open StatePair public State : ∀ {s a} → Type s → Type a → Type (s ℓ⊔ a) State S A = S → StatePair S A private variable s : Level S : Type s pure : A → State S A pure = state-pair _<*>_ : State S (A → B) → State S A → State S B (fs <*> xs) s = let state-pair f s′ = fs s state-pair x s″ = xs s′ in state-pair (f x) s″ _>>=_ : State S A → (A → State S B) → State S B (xs >>= f) s = let state-pair x s′ = xs s in f x s′ get : State S S value (get s) = s state (get s) = s modify : (S → S) → State S ⊤ value (modify f s) = tt state (modify f s) = f s put : S → State S ⊤ value (put s _) = tt state (put s _) = s
{ "alphanum_fraction": 0.5670945158, "avg_line_length": 19.0444444444, "ext": "agda", "hexsha": "c1e092b45e96e28859c30ccc4b043f9e164ca00c", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-11T12:30:21.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-11T12:30:21.000Z", "max_forks_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "oisdk/agda-playground", "max_forks_repo_path": "Control/Monad/State.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "oisdk/agda-playground", "max_issues_repo_path": "Control/Monad/State.agda", "max_line_length": 70, "max_stars_count": 6, "max_stars_repo_head_hexsha": "97a3aab1282b2337c5f43e2cfa3fa969a94c11b7", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "oisdk/agda-playground", "max_stars_repo_path": "Control/Monad/State.agda", "max_stars_repo_stars_event_max_datetime": "2021-11-16T08:11:34.000Z", "max_stars_repo_stars_event_min_datetime": "2020-09-11T17:45:41.000Z", "num_tokens": 323, "size": 857 }
open import Oscar.Prelude open import Oscar.Class open import Oscar.Class.Unit module Oscar.Class.SimilarityM where module SimilarityM {𝔞} {𝔄 : Ø 𝔞} {𝔟} {𝔅 : Ø 𝔟} {𝔣} {𝔉 : Ø 𝔣} {𝔞̇ 𝔟̇} (_∼₁_ : 𝔄 → 𝔄 → Ø 𝔞̇) (_∼₂_ : 𝔅 → 𝔅 → Ø 𝔟̇) (let _∼₂_ = _∼₂_; infix 4 _∼₂_) (_◃_ : 𝔉 → 𝔄 → 𝔅) (let _◃_ = _◃_; infix 16 _◃_) x y = ℭLASS (_◃_ , _∼₁_ , _∼₂_ , x , y) (∀ f → x ∼₁ y → f ◃ x ∼₂ f ◃ y) module _ {𝔞} {𝔄 : Ø 𝔞} {𝔟} {𝔅 : Ø 𝔟} {𝔣} {𝔉 : Ø 𝔣} {𝔞̇ 𝔟̇} {∼₁ : 𝔄 → 𝔄 → Ø 𝔞̇} {∼₂ : 𝔅 → 𝔅 → Ø 𝔟̇} {◃ : 𝔉 → 𝔄 → 𝔅} {x y} where similarityM = SimilarityM.method ∼₁ ∼₂ ◃ x y instance SimilarityM--Unit : ⦃ _ : SimilarityM.class ∼₁ ∼₂ ◃ x y ⦄ → Unit.class (SimilarityM.type ∼₁ ∼₂ ◃ x y) SimilarityM--Unit .⋆ = similarityM
{ "alphanum_fraction": 0.5026525199, "avg_line_length": 23.5625, "ext": "agda", "hexsha": "79428464c74c18e4ca0c3d1c9745abd46a7a9833", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": [ "RSA-MD" ], "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_path": "archive/agda-3/src/Oscar/Class/SimilarityM.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_licenses": [ "RSA-MD" ], "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_path": "archive/agda-3/src/Oscar/Class/SimilarityM.agda", "max_line_length": 112, "max_stars_count": null, "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": [ "RSA-MD" ], "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_path": "archive/agda-3/src/Oscar/Class/SimilarityM.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 451, "size": 754 }
{- Definition of a homogeneous pointed type, and proofs that pi, product, path, and discrete types are homogeneous Portions of this file adapted from Nicolai Kraus' code here: https://bitbucket.org/nicolaikraus/agda/src/e30d70c72c6af8e62b72eefabcc57623dd921f04/trunc-inverse.lagda -} {-# OPTIONS --safe #-} module Cubical.Foundations.Pointed.Homogeneous where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Univalence open import Cubical.Foundations.Path open import Cubical.Data.Sigma open import Cubical.Data.Empty as ⊥ open import Cubical.Relation.Nullary open import Cubical.Foundations.GroupoidLaws open import Cubical.Foundations.Pointed.Base open import Cubical.Foundations.Pointed.Properties open import Cubical.Structures.Pointed isHomogeneous : ∀ {ℓ} → Pointed ℓ → Type (ℓ-suc ℓ) isHomogeneous {ℓ} (A , x) = ∀ y → Path (Pointed ℓ) (A , x) (A , y) -- Pointed functions into a homogeneous type are equal as soon as they are equal -- as unpointed functions →∙Homogeneous≡ : ∀ {ℓ ℓ'} {A∙ : Pointed ℓ} {B∙ : Pointed ℓ'} {f∙ g∙ : A∙ →∙ B∙} (h : isHomogeneous B∙) → f∙ .fst ≡ g∙ .fst → f∙ ≡ g∙ →∙Homogeneous≡ {A∙ = A∙@(_ , a₀)} {B∙@(B , _)} {f∙@(_ , f₀)} {g∙@(_ , g₀)} h p = subst (λ Q∙ → PathP (λ i → A∙ →∙ Q∙ i) f∙ g∙) (sym (flipSquare fix)) badPath where badPath : PathP (λ i → A∙ →∙ (B , (sym f₀ ∙∙ funExt⁻ p a₀ ∙∙ g₀) i)) f∙ g∙ badPath i .fst = p i badPath i .snd j = doubleCompPath-filler (sym f₀) (funExt⁻ p a₀) g₀ j i fix : PathP (λ i → B∙ ≡ (B , (sym f₀ ∙∙ funExt⁻ p a₀ ∙∙ g₀) i)) refl refl fix i = hcomp (λ j → λ { (i = i0) → lCancel (h (pt B∙)) j ; (i = i1) → lCancel (h (pt B∙)) j }) (sym (h (pt B∙)) ∙ h ((sym f₀ ∙∙ funExt⁻ p a₀ ∙∙ g₀) i)) →∙Homogeneous≡Path : ∀ {ℓ ℓ'} {A∙ : Pointed ℓ} {B∙ : Pointed ℓ'} {f∙ g∙ : A∙ →∙ B∙} (h : isHomogeneous B∙) → (p q : f∙ ≡ g∙) → cong fst p ≡ cong fst q → p ≡ q →∙Homogeneous≡Path {A∙ = A∙@(A , a₀)} {B∙@(B , b)} {f∙@(f , f₀)} {g∙@(g , g₀)} h p q r = transport (λ k → PathP (λ i → PathP (λ j → (A , a₀) →∙ newPath-refl p q r i j (~ k)) (f , f₀) (g , g₀)) p q) (badPath p q r) where newPath : (p q : f∙ ≡ g∙) (r : cong fst p ≡ cong fst q) → Square (refl {x = b}) refl refl refl newPath p q r i j = hcomp (λ k → λ {(i = i0) → cong snd p j k ; (i = i1) → cong snd q j k ; (j = i0) → f₀ k ; (j = i1) → g₀ k}) (r i j a₀) newPath-refl : (p q : f∙ ≡ g∙) (r : cong fst p ≡ cong fst q) → PathP (λ i → (PathP (λ j → B∙ ≡ (B , newPath p q r i j))) refl refl) refl refl newPath-refl p q r i j k = hcomp (λ w → λ { (i = i0) → lCancel (h b) w k ; (i = i1) → lCancel (h b) w k ; (j = i0) → lCancel (h b) w k ; (j = i1) → lCancel (h b) w k ; (k = i0) → lCancel (h b) w k ; (k = i1) → B , newPath p q r i j}) ((sym (h b) ∙ h (newPath p q r i j)) k) badPath : (p q : f∙ ≡ g∙) (r : cong fst p ≡ cong fst q) → PathP (λ i → PathP (λ j → A∙ →∙ (B , newPath p q r i j)) (f , f₀) (g , g₀)) p q fst (badPath p q r i j) = r i j snd (badPath p q s i j) k = hcomp (λ r → λ { (i = i0) → snd (p j) (r ∧ k) ; (i = i1) → snd (q j) (r ∧ k) ; (j = i0) → f₀ (k ∧ r) ; (j = i1) → g₀ (k ∧ r) ; (k = i0) → s i j a₀}) (s i j a₀) isHomogeneousPi : ∀ {ℓ ℓ'} {A : Type ℓ} {B∙ : A → Pointed ℓ'} → (∀ a → isHomogeneous (B∙ a)) → isHomogeneous (Πᵘ∙ A B∙) isHomogeneousPi h f i .fst = ∀ a → typ (h a (f a) i) isHomogeneousPi h f i .snd a = pt (h a (f a) i) isHomogeneousΠ∙ : ∀ {ℓ ℓ'} (A : Pointed ℓ) (B : typ A → Type ℓ') → (b₀ : B (pt A)) → ((a : typ A) (x : B a) → isHomogeneous (B a , x)) → (f : Π∙ A B b₀) → isHomogeneous (Π∙ A B b₀ , f) fst (isHomogeneousΠ∙ A B b₀ h f g i) = Σ[ r ∈ ((a : typ A) → fst ((h a (fst f a) (fst g a)) i)) ] r (pt A) ≡ hcomp (λ k → λ {(i = i0) → snd f k ; (i = i1) → snd g k}) (snd (h (pt A) (fst f (pt A)) (fst g (pt A)) i)) snd (isHomogeneousΠ∙ A B b₀ h f g i) = (λ a → snd (h a (fst f a) (fst g a) i)) , λ j → hcomp (λ k → λ { (i = i0) → snd f (k ∧ j) ; (i = i1) → snd g (k ∧ j) ; (j = i0) → snd (h (pt A) (fst f (pt A)) (fst g (pt A)) i)}) (snd (h (pt A) (fst f (pt A)) (fst g (pt A)) i)) isHomogeneous→∙ : ∀ {ℓ ℓ'} {A∙ : Pointed ℓ} {B∙ : Pointed ℓ'} → isHomogeneous B∙ → isHomogeneous (A∙ →∙ B∙ ∙) isHomogeneous→∙ {A∙ = A∙} {B∙} h f∙ = ΣPathP ( (λ i → Π∙ A∙ (λ a → T a i) (t₀ i)) , PathPIsoPath _ _ _ .Iso.inv (→∙Homogeneous≡ h (PathPIsoPath (λ i → (a : typ A∙) → T a i) (λ _ → pt B∙) _ .Iso.fun (λ i a → pt (h (f∙ .fst a) i)))) ) where T : ∀ a → typ B∙ ≡ typ B∙ T a i = typ (h (f∙ .fst a) i) t₀ : PathP (λ i → T (pt A∙) i) (pt B∙) (pt B∙) t₀ = cong pt (h (f∙ .fst (pt A∙))) ▷ f∙ .snd isHomogeneousProd : ∀ {ℓ ℓ'} {A∙ : Pointed ℓ} {B∙ : Pointed ℓ'} → isHomogeneous A∙ → isHomogeneous B∙ → isHomogeneous (A∙ ×∙ B∙) isHomogeneousProd hA hB (a , b) i .fst = typ (hA a i) × typ (hB b i) isHomogeneousProd hA hB (a , b) i .snd .fst = pt (hA a i) isHomogeneousProd hA hB (a , b) i .snd .snd = pt (hB b i) isHomogeneousPath : ∀ {ℓ} (A : Type ℓ) {x y : A} (p : x ≡ y) → isHomogeneous ((x ≡ y) , p) isHomogeneousPath A {x} {y} p q = pointed-sip ((x ≡ y) , p) ((x ≡ y) , q) (eqv , compPathr-cancel p q) where eqv : (x ≡ y) ≃ (x ≡ y) eqv = compPathlEquiv (q ∙ sym p) module HomogeneousDiscrete {ℓ} {A∙ : Pointed ℓ} (dA : Discrete (typ A∙)) (y : typ A∙) where -- switches pt A∙ with y switch : typ A∙ → typ A∙ switch x with dA x (pt A∙) ... | yes _ = y ... | no _ with dA x y ... | yes _ = pt A∙ ... | no _ = x switch-ptA∙ : switch (pt A∙) ≡ y switch-ptA∙ with dA (pt A∙) (pt A∙) ... | yes _ = refl ... | no ¬p = ⊥.rec (¬p refl) switch-idp : ∀ x → switch (switch x) ≡ x switch-idp x with dA x (pt A∙) switch-idp x | yes p with dA y (pt A∙) switch-idp x | yes p | yes q = q ∙ sym p switch-idp x | yes p | no _ with dA y y switch-idp x | yes p | no _ | yes _ = sym p switch-idp x | yes p | no _ | no ¬p = ⊥.rec (¬p refl) switch-idp x | no ¬p with dA x y switch-idp x | no ¬p | yes p with dA y (pt A∙) switch-idp x | no ¬p | yes p | yes q = ⊥.rec (¬p (p ∙ q)) switch-idp x | no ¬p | yes p | no _ with dA (pt A∙) (pt A∙) switch-idp x | no ¬p | yes p | no _ | yes _ = sym p switch-idp x | no ¬p | yes p | no _ | no ¬q = ⊥.rec (¬q refl) switch-idp x | no ¬p | no ¬q with dA x (pt A∙) switch-idp x | no ¬p | no ¬q | yes p = ⊥.rec (¬p p) switch-idp x | no ¬p | no ¬q | no _ with dA x y switch-idp x | no ¬p | no ¬q | no _ | yes q = ⊥.rec (¬q q) switch-idp x | no ¬p | no ¬q | no _ | no _ = refl switch-eqv : typ A∙ ≃ typ A∙ switch-eqv = isoToEquiv (iso switch switch switch-idp switch-idp) isHomogeneousDiscrete : ∀ {ℓ} {A∙ : Pointed ℓ} (dA : Discrete (typ A∙)) → isHomogeneous A∙ isHomogeneousDiscrete {ℓ} {A∙} dA y = pointed-sip (typ A∙ , pt A∙) (typ A∙ , y) (switch-eqv , switch-ptA∙) where open HomogeneousDiscrete {ℓ} {A∙} dA y
{ "alphanum_fraction": 0.4903090623, "avg_line_length": 41.2756756757, "ext": "agda", "hexsha": "c2661ad449e415a672cce6f696b1df6ec6fefa5b", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_path": "Cubical/Foundations/Pointed/Homogeneous.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_path": "Cubical/Foundations/Pointed/Homogeneous.agda", "max_line_length": 111, "max_stars_count": 1, "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_path": "Cubical/Foundations/Pointed/Homogeneous.agda", "max_stars_repo_stars_event_max_datetime": "2021-10-31T17:32:49.000Z", "max_stars_repo_stars_event_min_datetime": "2021-10-31T17:32:49.000Z", "num_tokens": 3256, "size": 7636 }
module tests.PrintBool where open import Prelude.IO open import Prelude.Bool open import Prelude.Char open import Prelude.List open import Prelude.Unit open import Prelude.String isNewline : Char -> Bool isNewline '\n' = true isNewline _ = false sequence : {A : Set} -> List (IO A) -> IO (List A) sequence [] = return [] sequence (x :: xs) = r <- x , rs <- sequence xs , return (r :: rs) mapM : {A B : Set} -> (A -> IO B) -> List A -> IO (List B) mapM f xs = sequence (map f xs) printList : List Char -> IO Unit printList xs = mapM printChar xs ,, printChar '\n' main : IO Unit main = printChar 'a' ,, printList ('a' :: 'b' :: 'c' :: []) ,, putStrLn "printBool" ,, printBool (isNewline '\n') ,, printBool (isNewline 'a') ,, return unit
{ "alphanum_fraction": 0.606870229, "avg_line_length": 20.6842105263, "ext": "agda", "hexsha": "48274ed56cd801a2b335f2e5d82b93d3ab0a999b", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "larrytheliquid/agda", "max_forks_repo_path": "test/epic/tests/PrintBool.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "larrytheliquid/agda", "max_issues_repo_path": "test/epic/tests/PrintBool.agda", "max_line_length": 58, "max_stars_count": null, "max_stars_repo_head_hexsha": "477c8c37f948e6038b773409358fd8f38395f827", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "larrytheliquid/agda", "max_stars_repo_path": "test/epic/tests/PrintBool.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 237, "size": 786 }
{-# OPTIONS --prop --type-in-type #-} open import Agda.Primitive data Squash (A : Setω) : Prop where squash : A → Squash A
{ "alphanum_fraction": 0.6456692913, "avg_line_length": 18.1428571429, "ext": "agda", "hexsha": "5b30cba5a9e528f9122b75d85964c2e092954876", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Succeed/Issue3438.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Succeed/Issue3438.agda", "max_line_length": 37, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Succeed/Issue3438.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 38, "size": 127 }
------------------------------------------------------------------------------ -- Testing the translation of higher-order functions ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --universal-quantified-functions #-} {-# OPTIONS --without-K #-} -- We can use the Agda pragma @--universal-quantified-functions@ to -- translate higher-order functions. The canonical examples are the -- conversion rules for the λ-abstraction and the fixed-point -- operator. module NonFOLHigherOrderFunctions where infixl 6 _∙_ infix 4 _≡_ postulate D : Set _≡_ : D → D → Set lam : (D → D) → D _∙_ : D → D → D fix : (D → D) → D postulate beta : (f : D → D) → (a : D) → (lam f) ∙ a ≡ f a {-# ATP axiom beta #-} postulate fix-f : (f : D → D) → fix f ≡ f (fix f) {-# ATP axiom fix-f #-} -- We need to have at least one conjecture to generate a TPTP file. postulate refl : ∀ d → d ≡ d {-# ATP prove refl #-}
{ "alphanum_fraction": 0.5107577175, "avg_line_length": 29.6944444444, "ext": "agda", "hexsha": "4349c3ba90dbc52d321f6398bb18f79887b7fe6d", "lang": "Agda", "max_forks_count": 4, "max_forks_repo_forks_event_max_datetime": "2016-08-03T03:54:55.000Z", "max_forks_repo_forks_event_min_datetime": "2016-05-10T23:06:19.000Z", "max_forks_repo_head_hexsha": "a66c5ddca2ab470539fd68c42c4fbd45f720d682", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "asr/apia", "max_forks_repo_path": "issues/universal-quantified-functions-option/NonFOLHigherOrderFunctions.agda", "max_issues_count": 121, "max_issues_repo_head_hexsha": "a66c5ddca2ab470539fd68c42c4fbd45f720d682", "max_issues_repo_issues_event_max_datetime": "2018-04-22T06:01:44.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-25T13:22:12.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "asr/apia", "max_issues_repo_path": "issues/universal-quantified-functions-option/NonFOLHigherOrderFunctions.agda", "max_line_length": 78, "max_stars_count": 10, "max_stars_repo_head_hexsha": "a66c5ddca2ab470539fd68c42c4fbd45f720d682", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/apia", "max_stars_repo_path": "issues/universal-quantified-functions-option/NonFOLHigherOrderFunctions.agda", "max_stars_repo_stars_event_max_datetime": "2019-12-03T13:44:25.000Z", "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:54:16.000Z", "num_tokens": 274, "size": 1069 }
module IO where open import Base postulate IO : Set -> Set getLine : IO String putStrLn : String -> IO Unit mapM₋ : {A : Set} -> (A -> IO Unit) -> List A -> IO Unit bindIO : {A B : Set} -> IO A -> (A -> IO B) -> IO B returnIO : {A : Set} -> A -> IO A {-# COMPILED putStrLn putStrLn #-} {-# COMPILED mapM₋ (\_ -> mapM_ :: (a -> IO ()) -> [a] -> IO ()) #-} -- we need to throw away the type argument to mapM_ -- and resolve the overloading explicitly (since Alonzo -- output is sprinkled with unsafeCoerce#). {-# COMPILED bindIO (\_ _ -> (>>=) :: IO a -> (a -> IO b) -> IO b) #-} {-# COMPILED returnIO (\_ -> return :: a -> IO a) #-} {-# COMPILED getLine getLine #-}
{ "alphanum_fraction": 0.544935806, "avg_line_length": 31.8636363636, "ext": "agda", "hexsha": "0e68a9807136c62d136197088e1604bbb5f28d89", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "masondesu/agda", "max_forks_repo_path": "examples/outdated-and-incorrect/fileIO/IO.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "masondesu/agda", "max_issues_repo_path": "examples/outdated-and-incorrect/fileIO/IO.agda", "max_line_length": 70, "max_stars_count": 1, "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_path": "examples/outdated-and-incorrect/fileIO/IO.agda", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "num_tokens": 233, "size": 701 }
module Oscar.Data.Fin.ThickAndThin where open import Oscar.Data.Fin open import Oscar.Class.ThickAndThin import Data.Fin as F import Data.Fin.Properties as F instance ThickAndThinFin : ThickAndThin Fin ThickAndThin.thin ThickAndThinFin = F.thin ThickAndThin.thick ThickAndThinFin = F.thick ThickAndThin.thin-injective ThickAndThinFin z = F.thin-injective {z = z} ThickAndThin.thick∘thin=id ThickAndThinFin = F.thick-thin ThickAndThin.check ThickAndThinFin = F.check ThickAndThin.thin-check-id ThickAndThinFin = F.thin-check-id
{ "alphanum_fraction": 0.8210922787, "avg_line_length": 31.2352941176, "ext": "agda", "hexsha": "7a92f54ec36ca993d16fd715a10fb21edc0054a7", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": [ "RSA-MD" ], "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_path": "archive/agda-2/Oscar/Data/Fin/ThickAndThin.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_licenses": [ "RSA-MD" ], "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_path": "archive/agda-2/Oscar/Data/Fin/ThickAndThin.agda", "max_line_length": 72, "max_stars_count": null, "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": [ "RSA-MD" ], "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_path": "archive/agda-2/Oscar/Data/Fin/ThickAndThin.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 161, "size": 531 }
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} open import LibraBFT.Base.Types open import LibraBFT.ImplShared.Base.Types open import LibraBFT.ImplShared.Consensus.Types open import LibraBFT.Impl.OBM.Logging.Logging open import Optics.All open import Util.Prelude module LibraBFT.Impl.Consensus.ConsensusTypes.VoteData where verify : VoteData → Either ErrLog Unit verify self = do lcheck (self ^∙ vdParent ∙ biEpoch == self ^∙ vdProposed ∙ biEpoch) ("parent and proposed epochs do not match" ∷ []) lcheck (⌊ self ^∙ vdParent ∙ biRound <? self ^∙ vdProposed ∙ biRound ⌋) ("proposed round is less than parent round" ∷ []) -- lcheck (self^.vdParent.biTimestamp <= self^.vdProposed.biTimestamp) -- ["proposed happened before parent"] lcheck (⌊ (self ^∙ vdParent ∙ biVersion) ≤?-Version (self ^∙ vdProposed ∙ biVersion) ⌋) ("proposed version is less than parent version" ∷ []) -- , lsVersion (self^.vdProposed.biVersion), lsVersion (self^.vdParent.biVersion)] new : BlockInfo → BlockInfo → VoteData new = VoteData∙new
{ "alphanum_fraction": 0.7164296998, "avg_line_length": 40.8387096774, "ext": "agda", "hexsha": "3f58bc5160499308af94a0ff68921f543cf44262", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef", "max_forks_repo_licenses": [ "UPL-1.0" ], "max_forks_repo_name": "LaudateCorpus1/bft-consensus-agda", "max_forks_repo_path": "src/LibraBFT/Impl/Consensus/ConsensusTypes/VoteData.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "UPL-1.0" ], "max_issues_repo_name": "LaudateCorpus1/bft-consensus-agda", "max_issues_repo_path": "src/LibraBFT/Impl/Consensus/ConsensusTypes/VoteData.agda", "max_line_length": 111, "max_stars_count": null, "max_stars_repo_head_hexsha": "a4674fc473f2457fd3fe5123af48253cfb2404ef", "max_stars_repo_licenses": [ "UPL-1.0" ], "max_stars_repo_name": "LaudateCorpus1/bft-consensus-agda", "max_stars_repo_path": "src/LibraBFT/Impl/Consensus/ConsensusTypes/VoteData.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 367, "size": 1266 }
module Dummy where -- Run this in Acme: go build && ./acme-agda -v data ℕ : Set where zero : ℕ succ : ℕ -> ℕ _+_ : ℕ → ℕ → ℕ m + n = {!!} _*_ : ℕ → ℕ → ℕ m * n = {!m !}
{ "alphanum_fraction": 0.4772727273, "avg_line_length": 13.5384615385, "ext": "agda", "hexsha": "8e7e362e2bd5735d1cb179c186c861db166c8790", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "c8127b880353c3c6577d5194ef67f288a27bfe49", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "neosimsim/acme-agda", "max_forks_repo_path": "Dummy.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "c8127b880353c3c6577d5194ef67f288a27bfe49", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "neosimsim/acme-agda", "max_issues_repo_path": "Dummy.agda", "max_line_length": 47, "max_stars_count": null, "max_stars_repo_head_hexsha": "c8127b880353c3c6577d5194ef67f288a27bfe49", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "neosimsim/acme-agda", "max_stars_repo_path": "Dummy.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 72, "size": 176 }
{-# OPTIONS --cubical --safe #-} module Label where open import Cubical.Core.Everything open import Cubical.Foundations.Prelude using (isProp; transport) open import Cubical.Data.Nat using (ℕ; zero; suc; isSetℕ) open import Cubical.Data.Nat.Order using (_<_; _≤_; ≤-refl; <-weaken; ≤<-trans; m≤n-isProp; <-asym) open import Cubical.Data.Maybe using (Maybe; nothing; just) open import Cubical.Data.Empty using () renaming (rec to ⊥-elim) Label : Set Label = ℕ data Record (A : Set) : Label -> Set where nil : forall {l} -> Record A l cons : forall {l} -> Record A l -> (l' : Label) -> A -> .(l < l') -> Record A l' data _∈_ {A : Set} (l₁ : Label) {l : Label} : Record A l -> Set where here : forall {l'} {r : Record A l'} {x lt} -> l₁ ≡ l -> l₁ ∈ cons r l x lt there : forall {l'} {r : Record A l'} {x lt} -> l₁ ∈ r -> l₁ ∈ cons r l x lt find : forall {A} {l} -> (l₁ : Label) -> (r : Record A l) -> l₁ ∈ r -> A find l₁ (cons _ _ x _) (here e) = x find l₁ (cons r _ _ _) (there l₁∈r) = find l₁ r l₁∈r ∈-implies-≤ : forall {A} {l l'} {r : Record A l'} -> l ∈ r -> l ≤ l' ∈-implies-≤ {l = l} (here e) = transport (λ i -> l ≤ e i) ≤-refl ∈-implies-≤ (there {lt = lt} l∈r) = <-weaken (≤<-trans (∈-implies-≤ l∈r) lt) l∈r-isProp : forall {A} l {l'} (r : Record A l') -> isProp (l ∈ r) l∈r-isProp l {l'} (cons _ _ _ _) (here {lt = a} e1) (here {lt = b} e2) = λ i -> here {lt = m≤n-isProp a b i} (isSetℕ l l' e1 e2 i) l∈r-isProp l (cons {l = l₁} r _ _ _) (here {lt = k} e) (there y) = ⊥-elim (<-asym k (transport (λ i -> e i ≤ l₁) (∈-implies-≤ y))) l∈r-isProp l (cons {l = l₁} r _ _ _) (there {lt = k} x) (here e) = ⊥-elim (<-asym k (transport (λ i -> e i ≤ l₁) (∈-implies-≤ x))) l∈r-isProp l (cons r _ _ _) (there {lt = k1} x) (there {lt = k2} y) = let a = l∈r-isProp l r x y in λ i → there {lt = m≤n-isProp k1 k2 i} (a i)
{ "alphanum_fraction": 0.5628415301, "avg_line_length": 50.8333333333, "ext": "agda", "hexsha": "43a0924a6494fafb41bfbea1c1a6c8905ccff775", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2022-01-24T10:47:09.000Z", "max_forks_repo_forks_event_min_datetime": "2022-01-24T10:47:09.000Z", "max_forks_repo_head_hexsha": "fca08c53394f72c63d1bd7260fabfd70f73040b3", "max_forks_repo_licenses": [ "Apache-2.0" ], "max_forks_repo_name": "elpinal/subtyping-agda", "max_forks_repo_path": "Label.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "fca08c53394f72c63d1bd7260fabfd70f73040b3", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "Apache-2.0" ], "max_issues_repo_name": "elpinal/subtyping-agda", "max_issues_repo_path": "Label.agda", "max_line_length": 143, "max_stars_count": 10, "max_stars_repo_head_hexsha": "fca08c53394f72c63d1bd7260fabfd70f73040b3", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "elpinal/subtyping-agda", "max_stars_repo_path": "Label.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-17T17:17:26.000Z", "max_stars_repo_stars_event_min_datetime": "2022-01-16T07:11:04.000Z", "num_tokens": 774, "size": 1830 }
{-# OPTIONS --cubical --no-import-sorts --safe #-} {- This file defines sucPred : ∀ (i : Int) → sucInt (predInt i) ≡ i predSuc : ∀ (i : Int) → predInt (sucInt i) ≡ i discreteInt : discrete Int isSetInt : isSet Int addition of Int is defined _+_ : Int → Int → Int as well as its commutativity and associativity +-comm : ∀ (m n : Int) → m + n ≡ n + m +-assoc : ∀ (m n o : Int) → m + (n + o) ≡ (m + n) + o An alternate definition of _+_ is defined via ua, namely _+'_, which helps us to easily prove isEquivAddInt : (m : Int) → isEquiv (λ n → n + m) -} module Cubical.Data.Int.Properties where open import Cubical.Core.Everything open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.Transport open import Cubical.Foundations.HLevels open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Univalence open import Cubical.Data.Empty open import Cubical.Data.Nat hiding (+-assoc ; +-comm) renaming (_·_ to _·ℕ_; _+_ to _+ℕ_) open import Cubical.Data.Bool open import Cubical.Data.Sum open import Cubical.Data.Int.Base open import Cubical.Relation.Nullary open import Cubical.Relation.Nullary.DecidableEq abs : Int → ℕ abs (pos n) = n abs (negsuc n) = suc n sgn : Int → Bool sgn (pos n) = true sgn (negsuc n) = false sucPred : ∀ i → sucInt (predInt i) ≡ i sucPred (pos zero) = refl sucPred (pos (suc n)) = refl sucPred (negsuc n) = refl predSuc : ∀ i → predInt (sucInt i) ≡ i predSuc (pos n) = refl predSuc (negsuc zero) = refl predSuc (negsuc (suc n)) = refl -- TODO: define multiplication injPos : ∀ {a b : ℕ} → pos a ≡ pos b → a ≡ b injPos {a} h = subst T h refl where T : Int → Type₀ T (pos x) = a ≡ x T (negsuc _) = ⊥ injNegsuc : ∀ {a b : ℕ} → negsuc a ≡ negsuc b → a ≡ b injNegsuc {a} h = subst T h refl where T : Int → Type₀ T (pos _) = ⊥ T (negsuc x) = a ≡ x posNotnegsuc : ∀ (a b : ℕ) → ¬ (pos a ≡ negsuc b) posNotnegsuc a b h = subst T h 0 where T : Int → Type₀ T (pos _) = ℕ T (negsuc _) = ⊥ negsucNotpos : ∀ (a b : ℕ) → ¬ (negsuc a ≡ pos b) negsucNotpos a b h = subst T h 0 where T : Int → Type₀ T (pos _) = ⊥ T (negsuc _) = ℕ discreteInt : Discrete Int discreteInt (pos n) (pos m) with discreteℕ n m ... | yes p = yes (cong pos p) ... | no p = no (λ x → p (injPos x)) discreteInt (pos n) (negsuc m) = no (posNotnegsuc n m) discreteInt (negsuc n) (pos m) = no (negsucNotpos n m) discreteInt (negsuc n) (negsuc m) with discreteℕ n m ... | yes p = yes (cong negsuc p) ... | no p = no (λ x → p (injNegsuc x)) isSetInt : isSet Int isSetInt = Discrete→isSet discreteInt isEven : Int → Bool isEven (pos zero) = true isEven (pos (suc zero)) = false isEven (pos (suc (suc n))) = isEven (pos n) isEven (negsuc zero) = false isEven (negsuc (suc n)) = isEven (pos n) _ℕ-_ : ℕ → ℕ → Int a ℕ- 0 = pos a 0 ℕ- suc b = negsuc b suc a ℕ- suc b = a ℕ- b _+pos_ : Int → ℕ → Int z +pos 0 = z z +pos (suc n) = sucInt (z +pos n) _+negsuc_ : Int → ℕ → Int z +negsuc 0 = predInt z z +negsuc (suc n) = predInt (z +negsuc n) _+_ : Int → Int → Int m + pos n = m +pos n m + negsuc n = m +negsuc n -_ : Int → Int - pos zero = pos zero - pos (suc n) = negsuc n - negsuc n = pos (suc n) _-_ : Int → Int → Int m - n = m + (- n) -pos : ∀ n → - (pos n) ≡ neg n -pos zero = refl -pos (suc n) = refl -neg : ∀ n → - (neg n) ≡ pos n -neg zero = refl -neg (suc n) = refl -Involutive : ∀ z → - (- z) ≡ z -Involutive (pos n) = (- (- pos n)) ≡⟨ cong -_ (-pos n) ⟩ - (neg n) ≡⟨ -neg n ⟩ pos n ∎ -Involutive (negsuc n) = refl sucInt+pos : ∀ n m → sucInt (m +pos n) ≡ (sucInt m) +pos n sucInt+pos zero m = refl sucInt+pos (suc n) m = cong sucInt (sucInt+pos n m) predInt+negsuc : ∀ n m → predInt (m +negsuc n) ≡ (predInt m) +negsuc n predInt+negsuc zero m = refl predInt+negsuc (suc n) m = cong predInt (predInt+negsuc n m) sucInt+negsuc : ∀ n m → sucInt (m +negsuc n) ≡ (sucInt m) +negsuc n sucInt+negsuc zero m = (sucPred _) ∙ (sym (predSuc _)) sucInt+negsuc (suc n) m = _ ≡⟨ sucPred _ ⟩ m +negsuc n ≡[ i ]⟨ predSuc m (~ i) +negsuc n ⟩ (predInt (sucInt m)) +negsuc n ≡⟨ sym (predInt+negsuc n (sucInt m)) ⟩ predInt (sucInt m +negsuc n) ∎ predInt+pos : ∀ n m → predInt (m +pos n) ≡ (predInt m) +pos n predInt+pos zero m = refl predInt+pos (suc n) m = _ ≡⟨ predSuc _ ⟩ m +pos n ≡[ i ]⟨ sucPred m (~ i) + pos n ⟩ (sucInt (predInt m)) +pos n ≡⟨ sym (sucInt+pos n (predInt m))⟩ (predInt m) +pos (suc n) ∎ predInt-pos : ∀ n → predInt(- (pos n)) ≡ negsuc n predInt-pos zero = refl predInt-pos (suc n) = refl predInt+ : ∀ m n → predInt (m + n) ≡ (predInt m) + n predInt+ m (pos n) = predInt+pos n m predInt+ m (negsuc n) = predInt+negsuc n m +predInt : ∀ m n → predInt (m + n) ≡ m + (predInt n) +predInt m (pos zero) = refl +predInt m (pos (suc n)) = (predSuc (m + pos n)) ∙ (cong (_+_ m) (sym (predSuc (pos n)))) +predInt m (negsuc n) = refl sucInt+ : ∀ m n → sucInt (m + n) ≡ (sucInt m) + n sucInt+ m (pos n) = sucInt+pos n m sucInt+ m (negsuc n) = sucInt+negsuc n m +sucInt : ∀ m n → sucInt (m + n) ≡ m + (sucInt n) +sucInt m (pos n) = refl +sucInt m (negsuc zero) = sucPred _ +sucInt m (negsuc (suc n)) = (sucPred (m +negsuc n)) ∙ (cong (_+_ m) (sym (sucPred (negsuc n)))) pos0+ : ∀ z → z ≡ pos 0 + z pos0+ (pos zero) = refl pos0+ (pos (suc n)) = cong sucInt (pos0+ (pos n)) pos0+ (negsuc zero) = refl pos0+ (negsuc (suc n)) = cong predInt (pos0+ (negsuc n)) negsuc0+ : ∀ z → predInt z ≡ negsuc 0 + z negsuc0+ (pos zero) = refl negsuc0+ (pos (suc n)) = (sym (sucPred (pos n))) ∙ (cong sucInt (negsuc0+ _)) negsuc0+ (negsuc zero) = refl negsuc0+ (negsuc (suc n)) = cong predInt (negsuc0+ (negsuc n)) ind-comm : {A : Type₀} (_∙_ : A → A → A) (f : ℕ → A) (g : A → A) (p : ∀ {n} → f (suc n) ≡ g (f n)) (g∙ : ∀ a b → g (a ∙ b) ≡ g a ∙ b) (∙g : ∀ a b → g (a ∙ b) ≡ a ∙ g b) (base : ∀ z → z ∙ f 0 ≡ f 0 ∙ z) → ∀ z n → z ∙ f n ≡ f n ∙ z ind-comm _∙_ f g p g∙ ∙g base z 0 = base z ind-comm _∙_ f g p g∙ ∙g base z (suc n) = z ∙ f (suc n) ≡[ i ]⟨ z ∙ p {n} i ⟩ z ∙ g (f n) ≡⟨ sym ( ∙g z (f n)) ⟩ g (z ∙ f n) ≡⟨ cong g IH ⟩ g (f n ∙ z) ≡⟨ g∙ (f n) z ⟩ g (f n) ∙ z ≡[ i ]⟨ p {n} (~ i) ∙ z ⟩ f (suc n) ∙ z ∎ where IH = ind-comm _∙_ f g p g∙ ∙g base z n ind-assoc : {A : Type₀} (_·_ : A → A → A) (f : ℕ → A) (g : A → A) (p : ∀ a b → g (a · b) ≡ a · (g b)) (q : ∀ {c} → f (suc c) ≡ g (f c)) (base : ∀ m n → (m · n) · (f 0) ≡ m · (n · (f 0))) (m n : A) (o : ℕ) → m · (n · (f o)) ≡ (m · n) · (f o) ind-assoc _·_ f g p q base m n 0 = sym (base m n) ind-assoc _·_ f g p q base m n (suc o) = m · (n · (f (suc o))) ≡[ i ]⟨ m · (n · q {o} i) ⟩ m · (n · (g (f o))) ≡[ i ]⟨ m · (p n (f o) (~ i)) ⟩ m · (g (n · (f o))) ≡⟨ sym (p m (n · (f o)))⟩ g (m · (n · (f o))) ≡⟨ cong g IH ⟩ g ((m · n) · (f o)) ≡⟨ p (m · n) (f o) ⟩ (m · n) · (g (f o)) ≡[ i ]⟨ (m · n) · q {o} (~ i) ⟩ (m · n) · (f (suc o)) ∎ where IH = ind-assoc _·_ f g p q base m n o +-comm : ∀ m n → m + n ≡ n + m +-comm m (pos n) = ind-comm _+_ pos sucInt refl sucInt+ +sucInt pos0+ m n +-comm m (negsuc n) = ind-comm _+_ negsuc predInt refl predInt+ +predInt negsuc0+ m n +-assoc : ∀ m n o → m + (n + o) ≡ (m + n) + o +-assoc m n (pos o) = ind-assoc _+_ pos sucInt +sucInt refl (λ _ _ → refl) m n o +-assoc m n (negsuc o) = ind-assoc _+_ negsuc predInt +predInt refl +predInt m n o -- Compose sucPathInt with itself n times. Transporting along this -- will be addition, transporting with it backwards will be subtraction. -- Use this to define _+'_ for which is easier to prove -- isEquiv (λ n → n +' m) since _+'_ is defined by transport sucPathInt : Int ≡ Int sucPathInt = ua (sucInt , isoToIsEquiv (iso sucInt predInt sucPred predSuc)) addEq : ℕ → Int ≡ Int addEq zero = refl addEq (suc n) = (addEq n) ∙ sucPathInt predPathInt : Int ≡ Int predPathInt = ua (predInt , isoToIsEquiv (iso predInt sucInt predSuc sucPred)) subEq : ℕ → Int ≡ Int subEq zero = refl subEq (suc n) = (subEq n) ∙ predPathInt _+'_ : Int → Int → Int m +' pos n = transport (addEq n) m m +' negsuc n = transport (subEq (suc n)) m +'≡+ : _+'_ ≡ _+_ +'≡+ i m (pos zero) = m +'≡+ i m (pos (suc n)) = sucInt (+'≡+ i m (pos n)) +'≡+ i m (negsuc zero) = predInt m +'≡+ i m (negsuc (suc n)) = predInt (+'≡+ i m (negsuc n)) -- -- compPath (λ i → (+'≡+ i (predInt m) (negsuc n))) (sym (predInt+negsuc n m)) i isEquivAddInt' : (m : Int) → isEquiv (λ n → n +' m) isEquivAddInt' (pos n) = isEquivTransport (addEq n) isEquivAddInt' (negsuc n) = isEquivTransport (subEq (suc n)) isEquivAddInt : (m : Int) → isEquiv (λ n → n + m) isEquivAddInt = subst (λ add → (m : Int) → isEquiv (λ n → add n m)) +'≡+ isEquivAddInt' -- below is an alternate proof of isEquivAddInt for comparison -- We also have two useful lemma here. minusPlus : ∀ m n → (n - m) + m ≡ n minusPlus (pos zero) n = refl minusPlus (pos 1) = sucPred minusPlus (pos (suc (suc m))) n = sucInt ((n +negsuc (suc m)) +pos (suc m)) ≡⟨ sucInt+pos (suc m) _ ⟩ sucInt (n +negsuc (suc m)) +pos (suc m) ≡[ i ]⟨ sucPred (n +negsuc m) i +pos (suc m) ⟩ (n - pos (suc m)) +pos (suc m) ≡⟨ minusPlus (pos (suc m)) n ⟩ n ∎ minusPlus (negsuc zero) = predSuc minusPlus (negsuc (suc m)) n = predInt (sucInt (sucInt (n +pos m)) +negsuc m) ≡⟨ predInt+negsuc m _ ⟩ predInt (sucInt (sucInt (n +pos m))) +negsuc m ≡[ i ]⟨ predSuc (sucInt (n +pos m)) i +negsuc m ⟩ sucInt (n +pos m) +negsuc m ≡⟨ minusPlus (negsuc m) n ⟩ n ∎ plusMinus : ∀ m n → (n + m) - m ≡ n plusMinus (pos zero) n = refl plusMinus (pos (suc m)) = minusPlus (negsuc m) plusMinus (negsuc m) = minusPlus (pos (suc m)) private alternateProof : (m : Int) → isEquiv (λ n → n + m) alternateProof m = isoToIsEquiv (iso (λ n → n + m) (λ n → n - m) (minusPlus m) (plusMinus m)) -Cancel : ∀ z → z - z ≡ pos zero -Cancel z = z - z ≡⟨ cong (_- z) (pos0+ z) ⟩ (pos zero + z) - z ≡⟨ plusMinus z (pos zero) ⟩ pos zero ∎ pos+ : ∀ m n → pos (m +ℕ n) ≡ pos m + pos n pos+ zero zero = refl pos+ zero (suc n) = pos (zero +ℕ suc n) ≡⟨ +-comm (pos (suc n)) (pos zero) ⟩ pos zero + pos (suc n) ∎ pos+ (suc m) zero = pos (suc (m +ℕ zero)) ≡⟨ cong pos (cong suc (+-zero m)) ⟩ pos (suc m) + pos zero ∎ pos+ (suc m) (suc n) = pos (suc m +ℕ suc n) ≡⟨ cong pos (cong suc (+-suc m n)) ⟩ sucInt (pos (suc (m +ℕ n))) ≡⟨ cong sucInt (cong sucInt (pos+ m n)) ⟩ sucInt (sucInt (pos m + pos n)) ≡⟨ sucInt+ (pos m) (sucInt (pos n)) ⟩ pos (suc m) + pos (suc n) ∎ negsuc+ : ∀ m n → negsuc (m +ℕ n) ≡ negsuc m - pos n negsuc+ zero zero = refl negsuc+ zero (suc n) = negsuc (zero +ℕ suc n) ≡⟨ negsuc0+ (negsuc n) ⟩ negsuc zero + negsuc n ≡⟨ cong (negsuc zero +_) (-pos (suc n)) ⟩ negsuc zero - pos (suc n) ∎ negsuc+ (suc m) zero = negsuc (suc m +ℕ zero) ≡⟨ cong negsuc (cong suc (+-zero m)) ⟩ negsuc (suc m) - pos zero ∎ negsuc+ (suc m) (suc n) = negsuc (suc m +ℕ suc n) ≡⟨ cong negsuc (sym (+-suc m (suc n))) ⟩ negsuc (m +ℕ suc (suc n)) ≡⟨ negsuc+ m (suc (suc n)) ⟩ negsuc m - pos (suc (suc n)) ≡⟨ sym (+predInt (negsuc m) (negsuc n)) ⟩ predInt (negsuc m + negsuc n ) ≡⟨ predInt+ (negsuc m) (negsuc n) ⟩ negsuc (suc m) - pos (suc n) ∎ neg+ : ∀ m n → neg (m +ℕ n) ≡ neg m + neg n neg+ zero zero = refl neg+ zero (suc n) = neg (zero +ℕ suc n) ≡⟨ +-comm (neg (suc n)) (pos zero) ⟩ neg zero + neg (suc n) ∎ neg+ (suc m) zero = neg (suc (m +ℕ zero)) ≡⟨ cong neg (cong suc (+-zero m)) ⟩ neg (suc m) + neg zero ∎ neg+ (suc m) (suc n) = neg (suc m +ℕ suc n) ≡⟨ negsuc+ m (suc n) ⟩ neg (suc m) + neg (suc n) ∎ ℕ-AntiComm : ∀ m n → m ℕ- n ≡ - (n ℕ- m) ℕ-AntiComm zero zero = refl ℕ-AntiComm zero (suc n) = refl ℕ-AntiComm (suc m) zero = refl ℕ-AntiComm (suc m) (suc n) = suc m ℕ- suc n ≡⟨ ℕ-AntiComm m n ⟩ - (suc n ℕ- suc m) ∎ pos- : ∀ m n → m ℕ- n ≡ pos m - pos n pos- zero zero = refl pos- zero (suc n) = zero ℕ- suc n ≡⟨ +-comm (negsuc n) (pos zero) ⟩ pos zero - pos (suc n) ∎ pos- (suc m) zero = refl pos- (suc m) (suc n) = suc m ℕ- suc n ≡⟨ pos- m n ⟩ pos m - pos n ≡⟨ sym (sucPred (pos m - pos n)) ⟩ sucInt (predInt (pos m - pos n)) ≡⟨ cong sucInt (+predInt (pos m) (- pos n)) ⟩ sucInt (pos m + predInt (- (pos n))) ≡⟨ cong sucInt (cong (pos m +_) (predInt-pos n)) ⟩ sucInt (pos m + negsuc n) ≡⟨ sucInt+negsuc n (pos m) ⟩ pos (suc m) - pos (suc n) ∎ -AntiComm : ∀ m n → m - n ≡ - (n - m) -AntiComm (pos n) (pos m) = pos n - pos m ≡⟨ sym (pos- n m) ⟩ n ℕ- m ≡⟨ ℕ-AntiComm n m ⟩ - (m ℕ- n) ≡⟨ cong -_ (pos- m n) ⟩ - (pos m - pos n) ∎ -AntiComm (pos n) (negsuc m) = pos n - negsuc m ≡⟨ +-comm (pos n) (pos (suc m)) ⟩ pos (suc m) + pos n ≡⟨ sym (pos+ (suc m) n) ⟩ pos (suc m +ℕ n) ≡⟨ sym (-neg (suc m +ℕ n)) ⟩ - neg (suc m +ℕ n) ≡⟨ cong -_ (neg+ (suc m) n) ⟩ - (neg (suc m) + neg n) ≡⟨ cong -_ (cong (negsuc m +_) (sym (-pos n))) ⟩ - (negsuc m - pos n) ∎ -AntiComm (negsuc n) (pos m) = negsuc n - pos m ≡⟨ sym (negsuc+ n m) ⟩ negsuc (n +ℕ m) ≡⟨ cong -_ (pos+ (suc n) m) ⟩ - (pos (suc n) + pos m) ≡⟨ cong -_ (+-comm (pos (suc n)) (pos m)) ⟩ - (pos m - negsuc n) ∎ -AntiComm (negsuc n) (negsuc m) = negsuc n - negsuc m ≡⟨ +-comm (negsuc n) (pos (suc m)) ⟩ pos (suc m) + negsuc n ≡⟨ sym (pos- (suc m) (suc n)) ⟩ suc m ℕ- suc n ≡⟨ ℕ-AntiComm (suc m) (suc n) ⟩ - (suc n ℕ- suc m) ≡⟨ cong -_ (pos- (suc n) (suc m)) ⟩ - (pos (suc n) - pos (suc m)) ≡⟨ cong -_ (+-comm (pos (suc n)) (negsuc m)) ⟩ - (negsuc m - negsuc n) ∎ -Dist+ : ∀ m n → - (m + n) ≡ (- m) + (- n) -Dist+ (pos n) (pos m) = - (pos n + pos m) ≡⟨ cong -_ (sym (pos+ n m)) ⟩ - pos (n +ℕ m) ≡⟨ -pos (n +ℕ m) ⟩ neg (n +ℕ m) ≡⟨ neg+ n m ⟩ neg n + neg m ≡⟨ cong (neg n +_) (sym (-pos m)) ⟩ neg n + (- pos m) ≡⟨ cong (_+ (- pos m)) (sym (-pos n)) ⟩ (- pos n) + (- pos m) ∎ -Dist+ (pos n) (negsuc m) = - (pos n + negsuc m) ≡⟨ sym (-AntiComm (pos (suc m)) (pos n)) ⟩ pos (suc m) - pos n ≡⟨ +-comm (pos (suc m)) (- pos n) ⟩ (- pos n) + (- negsuc m) ∎ -Dist+ (negsuc n) (pos m) = - (negsuc n + pos m) ≡⟨ cong -_ (+-comm (negsuc n) (pos m)) ⟩ - (pos m + negsuc n) ≡⟨ sym (-AntiComm (- negsuc n) (pos m)) ⟩ (- negsuc n) + (- pos m) ∎ -Dist+ (negsuc n) (negsuc m) = - (negsuc n + negsuc m) ≡⟨ cong -_ (sym (neg+ (suc n) (suc m))) ⟩ - neg (suc n +ℕ suc m) ≡⟨ pos+ (suc n) (suc m) ⟩ (- negsuc n) + (- negsuc m) ∎ _·_ : Int → Int → Int pos zero · m = pos zero pos (suc n) · m = m + (pos n · m) negsuc zero · m = (- m) negsuc (suc n) · m = (- m) + ((negsuc n) · m)
{ "alphanum_fraction": 0.5168195719, "avg_line_length": 35.4124423963, "ext": "agda", "hexsha": "0be7e6cfb78741b7de7514bd85e04290384751ac", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "5de11df25b79ee49d5c084fbbe6dfc66e4147a2e", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Edlyr/cubical", "max_forks_repo_path": "Cubical/Data/Int/Properties.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "5de11df25b79ee49d5c084fbbe6dfc66e4147a2e", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Edlyr/cubical", "max_issues_repo_path": "Cubical/Data/Int/Properties.agda", "max_line_length": 98, "max_stars_count": null, "max_stars_repo_head_hexsha": "5de11df25b79ee49d5c084fbbe6dfc66e4147a2e", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Edlyr/cubical", "max_stars_repo_path": "Cubical/Data/Int/Properties.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 6858, "size": 15369 }
module *-distrib-+ where import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; cong; sym) open Eq.≡-Reasoning using (begin_; _≡⟨⟩_; step-≡; _∎) open import Data.Nat using (ℕ; zero; suc; _+_; _*_) open import Induction′ using (+-assoc; +-comm; +-suc) -- 積が和に対して分配的であることの証明 *-distrib-+ : ∀ (m n p : ℕ) → (m + n) * p ≡ m * p + n * p *-distrib-+ zero n p = begin (zero + n) * p ≡⟨⟩ n * p ≡⟨⟩ zero * p + n * p ∎ *-distrib-+ (suc m) n p = begin ((suc m) + n) * p ≡⟨ cong (_* p) (+-comm (suc m) n) ⟩ (n + (suc m)) * p ≡⟨ cong (_* p) (+-suc n m) ⟩ (suc (n + m)) * p ≡⟨⟩ p + ((n + m) * p) ≡⟨ cong (p +_) (*-distrib-+ n m p) ⟩ p + (n * p + m * p) ≡⟨ cong (p +_) (+-comm (n * p) (m * p)) ⟩ p + (m * p + n * p) ≡⟨ sym (+-assoc p (m * p) (n * p)) ⟩ (p + (m * p)) + n * p ≡⟨⟩ (suc m) * p + n * p ∎
{ "alphanum_fraction": 0.4416475973, "avg_line_length": 23, "ext": "agda", "hexsha": "09924533ac50219ac9d913f42c78ca7fea0f5358", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_forks_repo_licenses": [ "Apache-2.0" ], "max_forks_repo_name": "akiomik/plfa-solutions", "max_forks_repo_path": "part1/induction/*-distrib-+.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "Apache-2.0" ], "max_issues_repo_name": "akiomik/plfa-solutions", "max_issues_repo_path": "part1/induction/*-distrib-+.agda", "max_line_length": 57, "max_stars_count": 1, "max_stars_repo_head_hexsha": "df7722b88a9b3dfde320a690b78c4c1ef8c7c547", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "akiomik/plfa-solutions", "max_stars_repo_path": "part1/induction/*-distrib-+.agda", "max_stars_repo_stars_event_max_datetime": "2020-07-07T09:42:22.000Z", "max_stars_repo_stars_event_min_datetime": "2020-07-07T09:42:22.000Z", "num_tokens": 450, "size": 874 }
{-# OPTIONS --cubical --safe #-} module Data.List.Kleene.Relation.Unary where open import Data.List.Kleene open import Prelude open import Data.Fin open import Relation.Nullary private variable p : Level ◇⁺ : ∀ {A : Type a} (P : A → Type p) → A ⁺ → Type _ ◇⁺ P xs = ∃[ i ] P (xs !⁺ i) ◇⋆ : ∀ {A : Type a} (P : A → Type p) → A ⋆ → Type _ ◇⋆ P xs = ∃[ i ] P (xs !⋆ i) module Exists {a} {A : Type a} {p} (P : A → Type p) where push : ∀ {x xs} → ◇⋆ P xs → ◇⁺ P (x & xs) push (n , x∈xs) = (fs n , x∈xs) pull : ∀ {x xs} → ¬ P x → ◇⁺ P (x & xs) → ◇⋆ P xs pull ¬Px (f0 , p∈xs) = ⊥-elim (¬Px p∈xs) pull ¬Px (fs n , p∈xs) = (n , p∈xs) ◻⁺ : {A : Type a} (P : A → Type p) → A ⁺ → Type _ ◻⁺ P xs = ∀ i → P (xs !⁺ i) ◻⋆ : {A : Type a} (P : A → Type p) → A ⋆ → Type _ ◻⋆ P xs = ∀ i → P (xs !⋆ i) module Forall {a} {A : Type a} {p} (P : A → Type p) where push⁺ : ∀ {x xs} → P x → ◻⋆ P xs → ◻⁺ P (x & xs) push⁺ px pxs f0 = px push⁺ px pxs (fs n) = pxs n
{ "alphanum_fraction": 0.4711340206, "avg_line_length": 25.5263157895, "ext": "agda", "hexsha": "c3af01091cf6384d9c19c5ddcc54d9f0b9d8887a", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-01-05T14:05:30.000Z", "max_forks_repo_forks_event_min_datetime": "2021-01-05T14:05:30.000Z", "max_forks_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "oisdk/combinatorics-paper", "max_forks_repo_path": "agda/Data/List/Kleene/Relation/Unary.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "oisdk/combinatorics-paper", "max_issues_repo_path": "agda/Data/List/Kleene/Relation/Unary.agda", "max_line_length": 57, "max_stars_count": 4, "max_stars_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "oisdk/combinatorics-paper", "max_stars_repo_path": "agda/Data/List/Kleene/Relation/Unary.agda", "max_stars_repo_stars_event_max_datetime": "2021-01-05T15:32:14.000Z", "max_stars_repo_stars_event_min_datetime": "2021-01-05T14:07:44.000Z", "num_tokens": 482, "size": 970 }
------------------------------------------------------------------------------ -- Totality properties respect to OrdList (flatten-OrdList-helper) ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Program.SortList.Properties.Totality.OrdList.FlattenI where open import FOTC.Base open import FOTC.Data.Nat.Type open import FOTC.Program.SortList.SortList ------------------------------------------------------------------------------ -- See the combined proof. postulate flatten-OrdList-helper : ∀ {t₁ i t₂} → Tree t₁ → N i → Tree t₂ → OrdTree (node t₁ i t₂) → ≤-Lists (flatten t₁) (flatten t₂)
{ "alphanum_fraction": 0.4427745665, "avg_line_length": 39.3181818182, "ext": "agda", "hexsha": "416d37ce5076d1c196186a6352222e34b9220f82", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "asr/fotc", "max_forks_repo_path": "src/fot/FOTC/Program/SortList/Properties/Totality/OrdList/FlattenI.agda", "max_issues_count": 2, "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "asr/fotc", "max_issues_repo_path": "src/fot/FOTC/Program/SortList/Properties/Totality/OrdList/FlattenI.agda", "max_line_length": 78, "max_stars_count": 11, "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/fotc", "max_stars_repo_path": "src/fot/FOTC/Program/SortList/Properties/Totality/OrdList/FlattenI.agda", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "num_tokens": 163, "size": 865 }
{-# OPTIONS --universe-polymorphism #-} module Categories.Functor.Product where open import Categories.Category open import Categories.Functor using (Functor) import Categories.Object.Product as Product import Categories.Object.BinaryProducts as BinaryProducts -- Ugh, we should start bundling things (categories with binary products, in this case) up consistently _[_][_×-] : ∀ {o ℓ e} → (C : Category o ℓ e) → BinaryProducts.BinaryProducts C → Category.Obj C → Functor C C C [ P ][ O ×-] = record { F₀ = λ x → Product.A×B (product {O} {x}) ; F₁ = λ f → ⟨ π₁ , f ∘ π₂ ⟩ ; identity = λ {x} → identity′ {x} ; homomorphism = λ {x} {y} {z} {f} {g} → homomorphism′ {x} {y} {z} {f} {g} ; F-resp-≡ = λ f≡g → ⟨⟩-cong₂ refl (∘-resp-≡ˡ f≡g) } where open Category C open Equiv open Product C open BinaryProducts.BinaryProducts P .identity′ : {A : Obj} → ⟨ π₁ , id ∘ π₂ ⟩ ≡ id identity′ = begin ⟨ π₁ , id ∘ π₂ ⟩ ≈⟨ ⟨⟩-cong₂ refl identityˡ ⟩ ⟨ π₁ , π₂ ⟩ ≈⟨ η ⟩ id ∎ where open HomReasoning .homomorphism′ : {X Y Z : Obj} {f : X ⇒ Y} {g : Y ⇒ Z} → ⟨ π₁ , (g ∘ f) ∘ π₂ ⟩ ≡ ⟨ π₁ , g ∘ π₂ ⟩ ∘ ⟨ π₁ , f ∘ π₂ ⟩ homomorphism′ {f = f} {g} = begin ⟨ π₁ , (g ∘ f) ∘ π₂ ⟩ ↓⟨ ⟨⟩-cong₂ refl assoc ⟩ ⟨ π₁ , g ∘ (f ∘ π₂) ⟩ ↑⟨ ⟨⟩-cong₂ refl (∘-resp-≡ʳ commute₂) ⟩ ⟨ π₁ , g ∘ (π₂ ∘ ⟨ π₁ , f ∘ π₂ ⟩) ⟩ ↑⟨ ⟨⟩-cong₂ commute₁ assoc ⟩ ⟨ π₁ ∘ ⟨ π₁ , f ∘ π₂ ⟩ , (g ∘ π₂) ∘ ⟨ π₁ , f ∘ π₂ ⟩ ⟩ ↑⟨ ⟨⟩∘ ⟩ ⟨ π₁ , g ∘ π₂ ⟩ ∘ ⟨ π₁ , f ∘ π₂ ⟩ ∎ where open HomReasoning _[_][-×_] : ∀ {o ℓ e} → (C : Category o ℓ e) → BinaryProducts.BinaryProducts C → Category.Obj C → Functor C C C [ P ][-× O ] = record { F₀ = λ x → Product.A×B (product {x} {O}) ; F₁ = λ f → ⟨ f ∘ π₁ , π₂ ⟩ ; identity = λ {x} → identity′ {x} ; homomorphism = λ {x} {y} {z} {f} {g} → homomorphism′ {x} {y} {z} {f} {g} ; F-resp-≡ = λ f≡g → ⟨⟩-cong₂ (∘-resp-≡ˡ f≡g) refl } where open Category C open Equiv open Product C open BinaryProducts.BinaryProducts P .identity′ : {A : Obj} → ⟨ id ∘ π₁ , π₂ ⟩ ≡ id identity′ = begin ⟨ id ∘ π₁ , π₂ ⟩ ≈⟨ ⟨⟩-cong₂ identityˡ refl ⟩ ⟨ π₁ , π₂ ⟩ ≈⟨ η ⟩ id ∎ where open HomReasoning .homomorphism′ : {X Y Z : Obj} {f : X ⇒ Y} {g : Y ⇒ Z} → ⟨ (g ∘ f) ∘ π₁ , π₂ ⟩ ≡ ⟨ g ∘ π₁ , π₂ ⟩ ∘ ⟨ f ∘ π₁ , π₂ ⟩ homomorphism′ {f = f} {g} = begin ⟨ (g ∘ f) ∘ π₁ , π₂ ⟩ ↓⟨ ⟨⟩-cong₂ assoc refl ⟩ ⟨ g ∘ (f ∘ π₁) , π₂ ⟩ ↑⟨ ⟨⟩-cong₂ (∘-resp-≡ʳ commute₁) refl ⟩ ⟨ g ∘ (π₁ ∘ ⟨ f ∘ π₁ , π₂ ⟩) , π₂ ⟩ ↑⟨ ⟨⟩-cong₂ assoc commute₂ ⟩ ⟨ (g ∘ π₁) ∘ ⟨ f ∘ π₁ , π₂ ⟩ , π₂ ∘ ⟨ f ∘ π₁ , π₂ ⟩ ⟩ ↑⟨ ⟨⟩∘ ⟩ ⟨ g ∘ π₁ , π₂ ⟩ ∘ ⟨ f ∘ π₁ , π₂ ⟩ ∎ where open HomReasoning
{ "alphanum_fraction": 0.4909156977, "avg_line_length": 30.9213483146, "ext": "agda", "hexsha": "303d8ae18477d9b9f49912bf83212655d9b3fc02", "lang": "Agda", "max_forks_count": 23, "max_forks_repo_forks_event_max_datetime": "2021-11-11T13:50:56.000Z", "max_forks_repo_forks_event_min_datetime": "2015-02-05T13:03:09.000Z", "max_forks_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "p-pavel/categories", "max_forks_repo_path": "Categories/Functor/Product.agda", "max_issues_count": 19, "max_issues_repo_head_hexsha": "e41aef56324a9f1f8cf3cd30b2db2f73e01066f2", "max_issues_repo_issues_event_max_datetime": "2019-08-09T16:31:40.000Z", "max_issues_repo_issues_event_min_datetime": "2015-05-23T06:47:10.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "p-pavel/categories", "max_issues_repo_path": "Categories/Functor/Product.agda", "max_line_length": 117, "max_stars_count": 98, "max_stars_repo_head_hexsha": "36f4181d751e2ecb54db219911d8c69afe8ba892", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "copumpkin/categories", "max_stars_repo_path": "Categories/Functor/Product.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-08T05:20:36.000Z", "max_stars_repo_stars_event_min_datetime": "2015-04-15T14:57:33.000Z", "num_tokens": 1293, "size": 2752 }
module Sodium where open import Category.Functor open import Category.Applicative open import Category.Monad open import Data.Unit open import Data.Bool open import Data.Maybe open import Data.Product open import IO.Primitive postulate -- Core. Reactive : Set → Set sync : ∀ {A} → Reactive A → IO A Event : Set → Set Behaviour : Set → Set listen : ∀ {A} → Event A → (A → IO ⊤) → Reactive (IO ⊤) filterJust : ∀ {A} → Event (Maybe A) → Event A hold : ∀ {A} → A → Event A → Reactive (Behaviour A) updates value : ∀ {A} → Behaviour A → Event A snapshot : ∀ {A B C} → (A → B → C) → Event A → Behaviour B → Event C -- Derived. gate : ∀ {A} → Event A → Behaviour Bool → Event A filterE : ∀ {A} → (A → Bool) → Event A → Event A collectE : ∀ {A B} {S : Set} → (A → S → (B × S)) → S → Event A → Reactive (Event B) collect : ∀ {A B} {S : Set} → (A → S → (B × S)) → S → Behaviour A → Reactive (Behaviour B) accum : ∀ {A} → A → Event (A → A) → Reactive (Behaviour A) -- IO. executeSyncIO executeAsyncIO : ∀ {A} → Event (IO A) → Event A -- Instances. reactiveMonad : RawMonad Reactive behaviourApplicative : RawApplicative Behaviour eventFunctor : RawFunctor Event
{ "alphanum_fraction": 0.5748642358, "avg_line_length": 25.2745098039, "ext": "agda", "hexsha": "1f817979faebb352349bbca81f3b0037f0ac8c78", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "f767dbfbd82ce667b7cea667c4da76fe97f761eb", "max_forks_repo_licenses": [ "0BSD" ], "max_forks_repo_name": "stevana/haarss", "max_forks_repo_path": "prototype/command-response/Sodium.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "f767dbfbd82ce667b7cea667c4da76fe97f761eb", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "0BSD" ], "max_issues_repo_name": "stevana/haarss", "max_issues_repo_path": "prototype/command-response/Sodium.agda", "max_line_length": 75, "max_stars_count": 1, "max_stars_repo_head_hexsha": "f767dbfbd82ce667b7cea667c4da76fe97f761eb", "max_stars_repo_licenses": [ "0BSD" ], "max_stars_repo_name": "stevana/haarss", "max_stars_repo_path": "prototype/command-response/Sodium.agda", "max_stars_repo_stars_event_max_datetime": "2015-07-30T11:43:26.000Z", "max_stars_repo_stars_event_min_datetime": "2015-07-30T11:43:26.000Z", "num_tokens": 402, "size": 1289 }
postulate F : (Set → Set) → Set syntax F (λ x → y) = [ x ] y X : Set X = [ ? ] x
{ "alphanum_fraction": 0.4352941176, "avg_line_length": 10.625, "ext": "agda", "hexsha": "cc0f80477fd99bb9a6005aa38e7a293f017e0a4e", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "masondesu/agda", "max_forks_repo_path": "test/fail/Issue1129.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "masondesu/agda", "max_issues_repo_path": "test/fail/Issue1129.agda", "max_line_length": 28, "max_stars_count": 1, "max_stars_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "masondesu/agda", "max_stars_repo_path": "test/fail/Issue1129.agda", "max_stars_repo_stars_event_max_datetime": "2018-10-10T17:08:44.000Z", "max_stars_repo_stars_event_min_datetime": "2018-10-10T17:08:44.000Z", "num_tokens": 39, "size": 85 }
{-# OPTIONS --safe #-} module SafeFlagPostulate where data Empty : Set where postulate inhabitant : Empty
{ "alphanum_fraction": 0.7339449541, "avg_line_length": 13.625, "ext": "agda", "hexsha": "6bd00012805515f6b3a5e4bb899c4aa86133794e", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Fail/SafeFlagPostulate.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Fail/SafeFlagPostulate.agda", "max_line_length": 30, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Fail/SafeFlagPostulate.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 25, "size": 109 }
{-# OPTIONS --cubical --safe --guardedness #-} module Cubical.Codata.Stream.Properties where open import Cubical.Core.Everything open import Cubical.Data.Nat open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Univalence open import Cubical.Codata.Stream.Base open Stream mapS : ∀ {A B} → (A → B) → Stream A → Stream B head (mapS f xs) = f (head xs) tail (mapS f xs) = mapS f (tail xs) even : ∀ {A} → Stream A → Stream A head (even a) = head a tail (even a) = even (tail (tail a)) odd : ∀ {A} → Stream A → Stream A head (odd a) = head (tail a) tail (odd a) = odd (tail (tail a)) merge : ∀ {A} → Stream A → Stream A → Stream A head (merge a _) = head a head (tail (merge _ b)) = head b tail (tail (merge a b)) = merge (tail a) (tail b) mapS-id : ∀ {A} {xs : Stream A} → mapS (λ x → x) xs ≡ xs head (mapS-id {xs = xs} i) = head xs tail (mapS-id {xs = xs} i) = mapS-id {xs = tail xs} i Stream-η : ∀ {A} {xs : Stream A} → xs ≡ (head xs , tail xs) head (Stream-η {A} {xs} i) = head xs tail (Stream-η {A} {xs} i) = tail xs elimS : ∀ {A} (P : Stream A → Type₀) (c : ∀ x xs → P (x , xs)) (xs : Stream A) → P xs elimS P c xs = transp (λ i → P (Stream-η {xs = xs} (~ i))) i0 (c (head xs) (tail xs)) odd≡even∘tail : ∀ {A} → (a : Stream A) → odd a ≡ even (tail a) head (odd≡even∘tail a i) = head (tail a) tail (odd≡even∘tail a i) = odd≡even∘tail (tail (tail a)) i mergeEvenOdd≡id : ∀ {A} → (a : Stream A) → merge (even a) (odd a) ≡ a head (mergeEvenOdd≡id a i) = head a head (tail (mergeEvenOdd≡id a i)) = head (tail a) tail (tail (mergeEvenOdd≡id a i)) = mergeEvenOdd≡id (tail (tail a)) i module Equality≅Bisimulation where -- Bisimulation record _≈_ {A : Type₀} (x y : Stream A) : Type₀ where coinductive field ≈head : head x ≡ head y ≈tail : tail x ≈ tail y open _≈_ bisim : {A : Type₀} → {x y : Stream A} → x ≈ y → x ≡ y head (bisim x≈y i) = ≈head x≈y i tail (bisim x≈y i) = bisim (≈tail x≈y) i misib : {A : Type₀} → {x y : Stream A} → x ≡ y → x ≈ y ≈head (misib p) = λ i → head (p i) ≈tail (misib p) = misib (λ i → tail (p i)) iso1 : {A : Type₀} → {x y : Stream A} → (p : x ≡ y) → bisim (misib p) ≡ p head (iso1 p i j) = head (p j) tail (iso1 p i j) = iso1 (λ i → tail (p i)) i j iso2 : {A : Type₀} → {x y : Stream A} → (p : x ≈ y) → misib (bisim p) ≡ p ≈head (iso2 p i) = ≈head p ≈tail (iso2 p i) = iso2 (≈tail p) i path≃bisim : {A : Type₀} → {x y : Stream A} → (x ≡ y) ≃ (x ≈ y) path≃bisim = isoToEquiv (iso misib bisim iso2 iso1) path≡bisim : {A : Type₀} → {x y : Stream A} → (x ≡ y) ≡ (x ≈ y) path≡bisim = ua path≃bisim -- misib can be implemented by transport as well. refl≈ : {A : Type₀} {x : Stream A} → x ≈ x ≈head refl≈ = refl ≈tail refl≈ = refl≈ cast : ∀ {A : Type₀} {x y : Stream A} (p : x ≡ y) → x ≈ y cast {x = x} p = transport (λ i → x ≈ p i) refl≈ misib-refl : ∀ {A : Type₀} {x : Stream A} → misib {x = x} refl ≡ refl≈ ≈head (misib-refl i) = refl ≈tail (misib-refl i) = misib-refl i misibTransp : ∀ {A : Type₀} {x y : Stream A} (p : x ≡ y) → cast p ≡ misib p misibTransp p = J (λ _ p → cast p ≡ misib p) ((transportRefl refl≈) ∙ (sym misib-refl)) p module Stream≅Nat→ {A : Type₀} where lookup : {A : Type₀} → Stream A → ℕ → A lookup xs zero = head xs lookup xs (suc n) = lookup (tail xs) n tabulate : {A : Type₀} → (ℕ → A) → Stream A head (tabulate f) = f zero tail (tabulate f) = tabulate (λ n → f (suc n)) lookup∘tabulate : (λ (x : _ → A) → lookup (tabulate x)) ≡ (λ x → x) lookup∘tabulate i f zero = f zero lookup∘tabulate i f (suc n) = lookup∘tabulate i (λ n → f (suc n)) n tabulate∘lookup : (λ (x : Stream A) → tabulate (lookup x)) ≡ (λ x → x) head (tabulate∘lookup i xs) = head xs tail (tabulate∘lookup i xs) = tabulate∘lookup i (tail xs) Stream≡Nat→ : Stream A ≡ (ℕ → A) Stream≡Nat→ = isoToPath (iso lookup tabulate (λ f i → lookup∘tabulate i f) (λ xs i → tabulate∘lookup i xs))
{ "alphanum_fraction": 0.5784023669, "avg_line_length": 33.2459016393, "ext": "agda", "hexsha": "086435ac748a6cf27a5899ad8cab96f6ec649bbb", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "limemloh/cubical", "max_forks_repo_path": "Cubical/Codata/Stream/Properties.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "limemloh/cubical", "max_issues_repo_path": "Cubical/Codata/Stream/Properties.agda", "max_line_length": 109, "max_stars_count": null, "max_stars_repo_head_hexsha": "df4ef7edffd1c1deb3d4ff342c7178e9901c44f1", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "limemloh/cubical", "max_stars_repo_path": "Cubical/Codata/Stream/Properties.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1684, "size": 4056 }
#-}
{ "alphanum_fraction": 0, "avg_line_length": 2, "ext": "agda", "hexsha": "b20d0c2b5780d474750b96a2682013098c696eb2", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_path": "test/interaction/Token-highlighting-with-parse-error.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "shlevy/agda", "max_issues_repo_path": "test/interaction/Token-highlighting-with-parse-error.agda", "max_line_length": 3, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "shlevy/agda", "max_stars_repo_path": "test/interaction/Token-highlighting-with-parse-error.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 3, "size": 4 }
module Monoids where open import Library record Monoid {a} : Set (lsuc a) where field S : Set a ε : S _•_ : S → S → S lid : ∀{m} → ε • m ≅ m rid : ∀{m} → m • ε ≅ m ass : ∀{m n o} → (m • n) • o ≅ m • (n • o) infix 10 _•_ Nat+Mon : Monoid Nat+Mon = record { S = ℕ; ε = zero; _•_ = _+_; lid = refl; rid = ≡-to-≅ $ +-right-identity _; ass = λ{m} → ≡-to-≅ $ +-assoc m _ _}
{ "alphanum_fraction": 0.4266365688, "avg_line_length": 18.4583333333, "ext": "agda", "hexsha": "5787ae7ce08ba043b2f52b427e10f11763e3581f", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2019-11-04T21:33:13.000Z", "max_forks_repo_forks_event_min_datetime": "2019-11-04T21:33:13.000Z", "max_forks_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "jmchapman/Relative-Monads", "max_forks_repo_path": "Monoids.agda", "max_issues_count": 3, "max_issues_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_issues_repo_issues_event_max_datetime": "2019-05-29T09:50:26.000Z", "max_issues_repo_issues_event_min_datetime": "2019-01-13T13:12:33.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "jmchapman/Relative-Monads", "max_issues_repo_path": "Monoids.agda", "max_line_length": 50, "max_stars_count": 21, "max_stars_repo_head_hexsha": "74707d3538bf494f4bd30263d2f5515a84733865", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "jmchapman/Relative-Monads", "max_stars_repo_path": "Monoids.agda", "max_stars_repo_stars_event_max_datetime": "2021-02-13T18:02:18.000Z", "max_stars_repo_stars_event_min_datetime": "2015-07-30T01:25:12.000Z", "num_tokens": 194, "size": 443 }
{-# OPTIONS --without-K --safe #-} module Categories.Category.Species where -- The Category of Species, as the Functor category from Core (FinSetoids) to Setoids. -- Setoids used here because that's what fits best in this setting. -- The constructions of the theory of Species are in Species.Construction open import Level open import Categories.Category.Core using (Category) open import Categories.Category.Construction.Functors open import Categories.Category.Construction.Core using (Core) open import Categories.Category.Instance.FinSetoids using (FinSetoids) open import Categories.Category.Instance.Setoids using (Setoids) private variable o ℓ o′ ℓ′ : Level -- note how Species, as a category, raises levels. Species : (o ℓ o′ ℓ′ : Level) → Category (suc (o ⊔ ℓ ⊔ o′ ⊔ ℓ′)) (suc (o ⊔ ℓ) ⊔ (o′ ⊔ ℓ′)) (suc (o ⊔ ℓ) ⊔ o′ ⊔ ℓ′) Species o ℓ o′ ℓ′ = Functors (Core (FinSetoids o ℓ)) (Setoids o′ ℓ′)
{ "alphanum_fraction": 0.7255762898, "avg_line_length": 39.6086956522, "ext": "agda", "hexsha": "d5a5b9b937762e76ec66c6987fc11b5723dafcbc", "lang": "Agda", "max_forks_count": 64, "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:00:59.000Z", "max_forks_repo_forks_event_min_datetime": "2019-06-02T16:58:15.000Z", "max_forks_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Code-distancing/agda-categories", "max_forks_repo_path": "src/Categories/Category/Species.agda", "max_issues_count": 236, "max_issues_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_issues_repo_issues_event_max_datetime": "2022-03-28T14:31:43.000Z", "max_issues_repo_issues_event_min_datetime": "2019-06-01T14:53:54.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Code-distancing/agda-categories", "max_issues_repo_path": "src/Categories/Category/Species.agda", "max_line_length": 114, "max_stars_count": 279, "max_stars_repo_head_hexsha": "d9e4f578b126313058d105c61707d8c8ae987fa8", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Trebor-Huang/agda-categories", "max_stars_repo_path": "src/Categories/Category/Species.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-22T00:40:14.000Z", "max_stars_repo_stars_event_min_datetime": "2019-06-01T14:36:40.000Z", "num_tokens": 262, "size": 911 }
module Issue451 where infix 10 _==_ data _==_ {A : Set} (x : A) : (y : A) -> Set where refl : x == x postulate Nat : Set data G : Nat -> Nat -> Set where I : (place : Nat) -> G place place s : (n m : Nat) -> G n m mul : (l m n : Nat) -> G m n -> G l m -> G l n mul a b .b (I .b) x = x mul a .a b x (I .a) = x mul a b c (s .b .c) (s .a .b) = s a c postulate a b c : Nat f : G a b bad : mul a a b (s a b) (I a) == s a b bad = refl
{ "alphanum_fraction": 0.463362069, "avg_line_length": 17.8461538462, "ext": "agda", "hexsha": "489c49fd0562b178ad7fe3a42723ff0bff4f3912", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Succeed/Issue451.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Succeed/Issue451.agda", "max_line_length": 50, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Succeed/Issue451.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 203, "size": 464 }
module guarded-recursion where import guarded-recursion.prelude import guarded-recursion.model import guarded-recursion.model.Agda import guarded-recursion.embedding import guarded-recursion.compute import guarded-recursion.clocks
{ "alphanum_fraction": 0.8744588745, "avg_line_length": 28.875, "ext": "agda", "hexsha": "16d5a7c161d5994b20c273e29ade2695fea347f5", "lang": "Agda", "max_forks_count": 2, "max_forks_repo_forks_event_max_datetime": "2021-11-16T16:21:54.000Z", "max_forks_repo_forks_event_min_datetime": "2015-08-19T12:37:53.000Z", "max_forks_repo_head_hexsha": "9fba7d89d8b27e9bb08c27df802608b5fff769e0", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "np/guarded-recursion", "max_forks_repo_path": "guarded-recursion.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "9fba7d89d8b27e9bb08c27df802608b5fff769e0", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "np/guarded-recursion", "max_issues_repo_path": "guarded-recursion.agda", "max_line_length": 35, "max_stars_count": 1, "max_stars_repo_head_hexsha": "9fba7d89d8b27e9bb08c27df802608b5fff769e0", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "np/guarded-recursion", "max_stars_repo_path": "guarded-recursion.agda", "max_stars_repo_stars_event_max_datetime": "2016-12-06T23:04:56.000Z", "max_stars_repo_stars_event_min_datetime": "2016-12-06T23:04:56.000Z", "num_tokens": 46, "size": 231 }
open import Oscar.Prelude open import Oscar.Class.Successor₀ open import Oscar.Class.Successor₁ open import Oscar.Class.Injectivity open import Oscar.Class.Thickandthin open import Oscar.Class.Congruity open import Oscar.Class.Fmap open import Oscar.Data.¶ open import Oscar.Data.Fin open import Oscar.Data.Proposequality open import Oscar.Data.Maybe import Oscar.Property.Monad.Maybe import Oscar.Class.Congruity.Proposequality module Oscar.Property.Thickandthin.FinFinProposequalityMaybeProposequality where instance 𝓢uccessor₀¶ : 𝓢uccessor₀ ¶ 𝓢uccessor₀¶ .𝓢uccessor₀.successor₀ = ↑_ [𝓢uccessor₁]Fin : [𝓢uccessor₁] Fin [𝓢uccessor₁]Fin = ∁ 𝓢uccessor₁Fin : 𝓢uccessor₁ Fin 𝓢uccessor₁Fin .𝓢uccessor₁.successor₁ = ↑_ [𝓘njectivity₁]Fin : ∀ {m} → [𝓘njectivity₁] (λ (_ : Fin m) → Fin (⇑₀ m)) Proposequality Proposequality [𝓘njectivity₁]Fin = ∁ 𝓘njectivity₁Fin : ∀ {m} → 𝓘njectivity₁ (λ (_ : Fin m) → Fin (⇑₀ m)) Proposequality Proposequality 𝓘njectivity₁Fin .𝓘njectivity₁.injectivity₁ ∅ = ∅ [𝓣hick]Fin,Fin : [𝓣hick] Fin Fin [𝓣hick]Fin,Fin = ∁ 𝓣hickFin,Fin : 𝓣hick Fin Fin 𝓣hickFin,Fin .𝓣hick.thick {∅} () ∅ 𝓣hickFin,Fin .𝓣hick.thick {↑ _} _ ∅ = ∅ 𝓣hickFin,Fin .𝓣hick.thick ∅ (↑ y) = y 𝓣hickFin,Fin .𝓣hick.thick (↑ x) (↑ y) = ↑ thick x y [𝓣hin]Fin,Fin : [𝓣hin] Fin Fin [𝓣hin]Fin,Fin = ∁ 𝓣hinFin,Fin : 𝓣hin Fin Fin 𝓣hinFin,Fin .𝓣hin.thin ∅ = ↑_ 𝓣hinFin,Fin .𝓣hin.thin (↑ x) ∅ = ∅ 𝓣hinFin,Fin .𝓣hin.thin (↑ x) (↑ y) = ↑ (thin x y) [𝓘njectivity₂,₁]ThinFinFin : ∀ {m} → [𝓘njectivity₂,₁] (𝔱hin Fin Fin m) Proposequality Proposequality [𝓘njectivity₂,₁]ThinFinFin = ∁ 𝓘njectivity₂,₁ThinFinFin : ∀ {m} → 𝓘njectivity₂,₁ (𝔱hin Fin Fin m) Proposequality Proposequality 𝓘njectivity₂,₁ThinFinFin .𝓘njectivity₂,₁.injectivity₂,₁ ∅ ∅ = ∅ 𝓘njectivity₂,₁ThinFinFin .𝓘njectivity₂,₁.injectivity₂,₁ (↑ _) {∅} {∅} _ = ∅ 𝓘njectivity₂,₁ThinFinFin .𝓘njectivity₂,₁.injectivity₂,₁ (↑ _) {∅} {↑ _} () 𝓘njectivity₂,₁ThinFinFin .𝓘njectivity₂,₁.injectivity₂,₁ (↑ _) {↑ _} {∅} () 𝓘njectivity₂,₁ThinFinFin .𝓘njectivity₂,₁.injectivity₂,₁ (↑ x) {↑ _} {↑ _} = congruity ↑_ ∘ injectivity₂,₁ x ∘ injectivity₁[ Proposequality ] [𝓒heck]FinFinMaybe : [𝓒heck] Fin Fin Maybe [𝓒heck]FinFinMaybe = ∁ 𝓒heckFinFinMaybe : 𝓒heck Fin Fin Maybe 𝓒heckFinFinMaybe .𝓒heck.check ∅ ∅ = ∅ 𝓒heckFinFinMaybe .𝓒heck.check ∅ (↑ y) = ↑ y 𝓒heckFinFinMaybe .𝓒heck.check {∅} (↑ ()) _ 𝓒heckFinFinMaybe .𝓒heck.check {↑ _} (↑ x) ∅ = ↑ ∅ 𝓒heckFinFinMaybe .𝓒heck.check {↑ _} (↑ x) (↑ y) = fmap′ ¶⟨<_⟩.↑_ $ check x y [𝓣hick/thin=1]FinFin : [𝓣hick/thin=1] Fin Fin Proposequality [𝓣hick/thin=1]FinFin = ∁ 𝓣hick/thin=1FinFin : 𝓣hick/thin=1 Fin Fin Proposequality 𝓣hick/thin=1FinFin .𝓣hick/thin=1.thick/thin=1 x ∅ = ∅ 𝓣hick/thin=1FinFin .𝓣hick/thin=1.thick/thin=1 ∅ (↑ y) = ∅ 𝓣hick/thin=1FinFin .𝓣hick/thin=1.thick/thin=1 (↑ x) (↑ y) = congruity ↑_ (thick/thin=1 x y) [𝓒heck/thin=1FinFin] : [𝓒heck/thin=1] Fin Fin Maybe Proposequality [𝓒heck/thin=1FinFin] = ∁ 𝓒heck/thin=1FinFin : 𝓒heck/thin=1 Fin Fin Maybe Proposequality 𝓒heck/thin=1FinFin .𝓒heck/thin=1.check/thin=1 ∅ y = ∅ 𝓒heck/thin=1FinFin .𝓒heck/thin=1.check/thin=1 (↑ x) ∅ = ∅ 𝓒heck/thin=1FinFin .𝓒heck/thin=1.check/thin=1 (↑ x) (↑ y) rewrite check/thin=1 {_≈_ = Proposequality⟦ Maybe _ ⟧} x y = ∅ IsThickandthinFinFin : IsThickandthin Fin Fin Proposequality Maybe Proposequality IsThickandthinFinFin = ∁ ThickandthinFinFin : Thickandthin _ _ _ _ _ _ ThickandthinFinFin = ∁ Fin Fin Proposequality Maybe Proposequality
{ "alphanum_fraction": 0.6966864911, "avg_line_length": 38.3804347826, "ext": "agda", "hexsha": "e42512a8de4a39bd7196ceb26f4d36e94225f8d0", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": [ "RSA-MD" ], "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_path": "archive/agda-3/src/Oscar/Property/Thickandthin/FinFinProposequalityMaybeProposequality.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_licenses": [ "RSA-MD" ], "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_path": "archive/agda-3/src/Oscar/Property/Thickandthin/FinFinProposequalityMaybeProposequality.agda", "max_line_length": 143, "max_stars_count": null, "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": [ "RSA-MD" ], "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_path": "archive/agda-3/src/Oscar/Property/Thickandthin/FinFinProposequalityMaybeProposequality.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1639, "size": 3531 }
module UniDB.Subst.Subs where open import UniDB.Subst.Core open import UniDB.Morph.Subs -------------------------------------------------------------------------------- module _ {T : STX} {{vrT : Vr T}} {{wkT : Wk T}} {{apTT : Ap T T}} where instance iCompSubs : Comp (Subs T) _⊙_ {{iCompSubs}} (refl) ξ₂ = ξ₂ _⊙_ {{iCompSubs}} (step ξ₁ t) ξ₂ = step (ξ₁ ⊙ ξ₂) (ap {T} ξ₂ t ) _⊙_ {{iCompSubs}} (skip ξ₁) refl = skip ξ₁ _⊙_ {{iCompSubs}} (skip ξ₁) (step ξ₂ t) = step (ξ₁ ⊙ ξ₂) t _⊙_ {{iCompSubs}} (skip ξ₁) (skip ξ₂) = skip (ξ₁ ⊙ ξ₂) --------------------------------------------------------------------------------
{ "alphanum_fraction": 0.4084919473, "avg_line_length": 34.15, "ext": "agda", "hexsha": "58028dbd789ddc0f6b24a01e10c5419c3bad3a56", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "7ae52205db44ad4f463882ba7e5082120fb76349", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "skeuchel/unidb-agda", "max_forks_repo_path": "UniDB/Subst/Subs.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "7ae52205db44ad4f463882ba7e5082120fb76349", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "skeuchel/unidb-agda", "max_issues_repo_path": "UniDB/Subst/Subs.agda", "max_line_length": 80, "max_stars_count": null, "max_stars_repo_head_hexsha": "7ae52205db44ad4f463882ba7e5082120fb76349", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "skeuchel/unidb-agda", "max_stars_repo_path": "UniDB/Subst/Subs.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 256, "size": 683 }
{-# OPTIONS --safe --warning=error --without-K #-} open import Numbers.ClassicalReals.RealField open import LogicalFormulae open import Setoids.Subset open import Setoids.Setoids open import Sets.EquivalenceRelations open import Rings.Orders.Total.Definition open import Rings.Orders.Partial.Definition open import Rings.Definition open import Fields.Fields open import Groups.Definition open import Numbers.Naturals.Semiring open import Numbers.Naturals.Order open import Numbers.Naturals.Order.Lemmas open import Setoids.Orders.Partial.Definition open import Setoids.Orders.Total.Definition module Numbers.ClassicalReals.Examples (ℝ : RealField) where open RealField ℝ open Setoid S open Equivalence eq open Ring R open Field F open SetoidPartialOrder pOrder open import Fields.Orders.LeastUpperBounds.Definition pOrder open import Rings.Orders.Total.Lemmas orderedRing open import Rings.Orders.Partial.Lemmas pOrderedRing open Group additiveGroup open PartiallyOrderedRing pOrderedRing open SetoidTotalOrder (TotallyOrderedRing.total orderedRing) open import Rings.InitialRing R open import Fields.Orders.Lemmas oField open import Rings.Lemmas R open import Groups.Lemmas additiveGroup open import Numbers.Intervals.Definition pOrderedRing open import Numbers.Intervals.Arithmetic pOrderedRing open import Fields.Lemmas F squarePositive : (a : A) → (((a ∼ 0R) → False) && (0R < (a * a))) || (a ∼ 0R) squarePositive a with totality 0R a squarePositive a | inl (inl x) = inl ((λ a=0 → irreflexive (<WellDefined reflexive a=0 x)) ,, orderRespectsMultiplication x x) squarePositive a | inl (inr x) = inl ((λ a=0 → irreflexive (<WellDefined a=0 reflexive x)) ,, <WellDefined reflexive twoNegativesTimes (orderRespectsMultiplication (<WellDefined invIdent reflexive (ringSwapNegatives' x)) (<WellDefined invIdent reflexive (ringSwapNegatives' x)))) squarePositive a | inr 0=a = inr (symmetric 0=a) fraction<1 : (n m : ℕ) → n <N m → (0<m : fromN m ∼ 0G → False) → ((fromN n) * underlying (allInvertible (fromN m) 0<m)) < 1R fraction<1 n m n<m 0<m with allInvertible (fromN m) 0<m ... | 1/m , prM = <WellDefined reflexive (transitive *Commutative prM) (ringCanMultiplyByPositive (inversePositiveIsPositive prM (fromNPreservesOrder (0<1 nontrivial) {0} {m} (zeroLeast n<m))) (fromNPreservesOrder (0<1 nontrivial) n<m)) 1/2 : A 1/2 = underlying (allInvertible (1R + 1R) (orderedImpliesCharNot2 nontrivial)) pr1/2 : (1/2 * (1R + 1R)) ∼ 1R pr1/2 with allInvertible (1R + 1R) (orderedImpliesCharNot2 nontrivial) ... | x , pr = pr pr1/2' : (1/2 + 1/2) ∼ 1R pr1/2' = transitive (symmetric (transitive *DistributesOver+ (+WellDefined (transitive *Commutative identIsIdent) (transitive *Commutative identIsIdent)))) pr1/2 1/2<1 : 1/2 < 1R 1/2<1 = <WellDefined (transitive (*WellDefined identRight (allInvertibleWellDefined (+WellDefined reflexive identRight))) identIsIdent) reflexive (fraction<1 1 2 (le 0 refl) λ p → charZero 1 (symmetric p)) 3/2<2 : (fromN 3 * 1/2) < (1R + 1R) 3/2<2 = <WellDefined (transitive (+WellDefined reflexive (transitive (symmetric pr1/2) (transitive *Commutative (*WellDefined (+WellDefined reflexive (symmetric identRight)) reflexive)))) (symmetric *DistributesOver+')) reflexive (orderRespectsAddition (<WellDefined (symmetric identIsIdent) reflexive 1/2<1) 1R) 2<9/4 : (1R + 1R) < ((fromN 3 * 1/2) * (fromN 3 * 1/2)) 2<9/4 = <WellDefined reflexive (symmetric *Associative) (halveInequality _ _ 1/2 pr1/2' (<WellDefined reflexive (transitive (symmetric *Associative) *Commutative) (halveInequality _ _ 1/2 pr1/2' (<WellDefined (transitive (fromNPreserves* 4 2) (transitive (*WellDefined (+WellDefined reflexive (+WellDefined reflexive (+WellDefined reflexive identRight))) (+WellDefined reflexive identRight)) (transitive *DistributesOver+ (+WellDefined (transitive *Commutative (transitive identIsIdent +Associative)) (transitive *Commutative (transitive identIsIdent +Associative)))))) (fromNPreserves* 3 3) (fromNPreservesOrder (0<1 nontrivial) (le {8} 0 refl)))))) 0<2 : 0R < (1R + 1R) 0<2 = <WellDefined identLeft reflexive (ringAddInequalities (0<1 nontrivial) (0<1 nontrivial)) 0<3/2 : 0R < (fromN 3 * 1/2) 0<3/2 = orderRespectsMultiplication (fromNPreservesOrder (0<1 nontrivial) (le {0} {3} 2 refl)) (inversePositiveIsPositive pr1/2 0<2) 3/2ub : {r : A} → (r * r) < (1R + 1R) → (r < (fromN 3 * 1/2)) 3/2ub {r} r^2<2 with totality r (fromN 3 * 1/2) 3/2ub {r} r^2<2 | inl (inl r<3/2) = r<3/2 3/2ub {r} r^2<2 | inl (inr 3/2<r) = exFalso (irreflexive (<Transitive r^2<2 (<Transitive 2<9/4 (ringMultiplyPositives 0<3/2 0<3/2 3/2<r 3/2<r)))) 3/2ub {r} r^2<2 | inr r=3/2 = exFalso (irreflexive (<Transitive r^2<2 (<WellDefined reflexive (symmetric (*WellDefined r=3/2 r=3/2)) 2<9/4))) 2/6<1 : ((1R + 1R) * underlying (allInvertible (fromN 6) (charZero' 5))) < 1R 2/6<1 with allInvertible (fromN 6) (charZero' 5) 2/6<1 | 1/6 , pr1/6 = <WellDefined reflexive (transitive *Commutative pr1/6) (ringCanMultiplyByPositive (inversePositiveIsPositive pr1/6 (fromNPreservesOrder (0<1 nontrivial) {0} {6} (le 5 refl))) (<WellDefined (+WellDefined reflexive identRight) reflexive (fromNPreservesOrder (0<1 nontrivial) {2} {6} (le 3 refl)))) 2<2*2 : (1R + 1R) < ((1R + 1R) * (1R + 1R)) 2<2*2 = (<WellDefined (+WellDefined reflexive identRight) (transitive (fromNPreserves* 2 2) (*WellDefined (+WellDefined reflexive identRight) (+WellDefined reflexive identRight))) (fromNPreservesOrder (0<1 nontrivial) {2} {4} (le 1 refl))) square<2Means<2 : (u : A) → (u * u) < (1R + 1R) → u < (1R + 1R) square<2Means<2 u u^2<2 with totality u (1R + 1R) square<2Means<2 u u^2<2 | inl (inl x) = x square<2Means<2 u u^2<2 | inl (inr x) = exFalso (irreflexive (<Transitive u^2<2 (<Transitive 2<2*2 (ringMultiplyPositives 0<2 0<2 x x)))) square<2Means<2 u u^2<2 | inr u=2 = exFalso (irreflexive (<Transitive (<WellDefined (*WellDefined u=2 u=2) reflexive u^2<2) 2<2*2)) 2=2*2-2 : (fromN 2) ∼ (((1R + 1R) * (1R + 1R)) + inverse (fromN 2)) 2=2*2-2 = transitive (+WellDefined reflexive identRight) (transitive (transitive (transitive (transitive (symmetric identRight) (+WellDefined reflexive (symmetric invRight))) +Associative) (+WellDefined (symmetric (+WellDefined (+WellDefined identIsIdent identIsIdent) (+WellDefined identIsIdent identIsIdent))) reflexive)) (+WellDefined (transitive (+WellDefined (symmetric *DistributesOver+') (symmetric *DistributesOver+')) (symmetric *DistributesOver+)) (inverseWellDefined (symmetric (+WellDefined reflexive identRight))))) sqrtRespectsInequality : {x y : A} → (x * x) < (y * y) → 0R < y → x < y sqrtRespectsInequality {x} {y} x^2<y^2 _ with totality x y sqrtRespectsInequality {x} {y} x^2<y^2 _ | inl (inl x<y) = x<y sqrtRespectsInequality {x} {y} x^2<y^2 0<y | inl (inr y<x) = exFalso (irreflexive (<Transitive x^2<y^2 (ringMultiplyPositives 0<y 0<y y<x y<x))) sqrtRespectsInequality {x} {y} x^2<y^2 _ | inr x=y = exFalso (irreflexive (<WellDefined (*WellDefined x=y x=y) reflexive x^2<y^2)) sqrt2 : Sg A (λ i → (i * i) ∼ (1R + 1R)) sqrt2 = sqrt2' , sqrt2IsSqrt2 where pred : A → Set c pred a = (a * a) < (1R + 1R) sub : subset S pred sub {y} x=y x^2<2 = <WellDefined (*WellDefined x=y x=y) reflexive x^2<2 abstract 2ub : UpperBound sub (1R + 1R) 2ub y y^2<2 with totality y (1R + 1R) 2ub y y^2<2 | inl (inl y<2) = inl y<2 2ub y y^2<2 | inl (inr 2<y) = exFalso (irreflexive (<Transitive y^2<2 (<Transitive s r))) where r : ((1R + 1R) * (1R + 1R)) < (y * y) r = ringMultiplyPositives 0<2 0<2 2<y 2<y s : (1R + 1R) < ((1R + 1R) * (1R + 1R)) s = <WellDefined reflexive (symmetric *DistributesOver+) (<WellDefined reflexive (+WellDefined (transitive (symmetric identIsIdent) *Commutative) (transitive (symmetric identIsIdent) *Commutative)) (<WellDefined identLeft reflexive (orderRespectsAddition 0<2 (1R + 1R)))) 2ub y y^2<2 | inr y=2 = inr y=2 abstract sup : Sg A (LeastUpperBound sub) sup = lub sub (0R , <Transitive (<WellDefined (symmetric timesZero) (symmetric identLeft) (0<1 nontrivial)) (orderRespectsAddition (0<1 nontrivial) 1R)) ((1R + 1R) , 2ub) sqrt2' : A sqrt2' = underlying sup sqrt2IsSqrt2 : (sqrt2' * sqrt2') ∼ (1R + 1R) sqrt2IsSqrt2 with totality (sqrt2' * sqrt2') (1R + 1R) sqrt2IsSqrt2 | inl (inl sup^2<2) with sup sqrt2IsSqrt2 | inl (inl sup^2<2) | sqrt2' , record { upperBound = upperBound ; leastUpperBound = leastUpperBound } = exFalso bad where abstract t : A t = ((fromN 2) + inverse (sqrt2' * sqrt2')) * (underlying (allInvertible (fromN 6) (charZero' 5))) pr' : (underlying (allInvertible (fromN 6) (charZero' 5)) * fromN 6) ∼ 1R pr' with allInvertible (fromN 6) (charZero' 5) ... | x , p = p crudeBound : isInInterval (sqrt2' * sqrt2') record { minBound = 0R ; maxBound = 1R + 1R } crudeBound with squarePositive sqrt2' crudeBound | inl (_ ,, snd) = snd ,, sup^2<2 crudeBound | inr sqrt2=0 with upperBound 1R (<WellDefined (transitive identRight (symmetric identIsIdent)) (+WellDefined reflexive identRight) (fromNPreservesOrder (0<1 nontrivial) {1} {2} (le 0 refl))) crudeBound | inr sqrt2=0 | inl 1<sqrt2 = exFalso (irreflexive (<Transitive 1<sqrt2 (<WellDefined (symmetric sqrt2=0) reflexive (0<1 nontrivial)))) crudeBound | inr sqrt2=0 | inr 1=sqrt2 = exFalso (nontrivial (transitive (symmetric sqrt2=0) (symmetric 1=sqrt2))) crudeBound' : isInInterval (inverse (sqrt2' * sqrt2')) record { minBound = inverse (1R + 1R) ; maxBound = inverse 0R } crudeBound' = intervalInverseContains crudeBound numeratorBound : isInInterval (inverse (sqrt2' * sqrt2') + fromN 2) record { minBound = 0R ; maxBound = 1R + 1R } numeratorBound = intervalWellDefined (transitive groupIsAbelian (transferToRight'' (transitive +Associative identRight)) ,, transitive (+WellDefined invIdent reflexive) (transitive identLeft (+WellDefined reflexive identRight))) (intervalConstantSumContains (fromN 2) crudeBound') numeratorBound' : isInInterval (fromN 2 + inverse (sqrt2' * sqrt2')) record { minBound = 0R ; maxBound = 1R + 1R } numeratorBound' = intervalWellDefined' groupIsAbelian numeratorBound tBound : isInInterval t record { minBound = 0R ; maxBound = (1R + 1R) * (underlying (allInvertible (fromN 6) (charZero' 5))) } tBound = intervalWellDefined (transitive *Commutative timesZero ,, reflexive) (intervalConstantProductContains (inversePositiveIsPositive pr' (fromNPreservesOrder (0<1 nontrivial) {0} {6} (le 5 refl))) numeratorBound') u : ((((fromN 5) * ((fromN 2) + inverse (sqrt2' * sqrt2'))) * underlying (allInvertible (fromN 6) (charZero' 5))) + (sqrt2' * sqrt2')) < ((fromN 2 + inverse (sqrt2' * sqrt2')) + (sqrt2' * sqrt2')) u = orderRespectsAddition (<WellDefined (transitive (symmetric *Associative) (transitive (*WellDefined reflexive *Commutative) *Associative)) identIsIdent (ringCanMultiplyByPositive {(fromN 5) * underlying (allInvertible (fromN 6) (charZero' 5))} {1R} {fromN 2 + inverse (sqrt2' * sqrt2')} (moveInequality (<WellDefined reflexive (transitive (symmetric identRight) (symmetric +Associative)) sup^2<2)) (fraction<1 5 6 (le zero refl) λ pr → charZero' 5 pr))) (sqrt2' * sqrt2') tBound' : (((fromN 5) * t) + (sqrt2' * sqrt2')) < (1R + 1R) tBound' = <WellDefined (+WellDefined (symmetric *Associative) reflexive) (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invLeft) (transitive identRight (+WellDefined reflexive identRight)))) u sqrt2<2 : sqrt2' < (1R + 1R) sqrt2<2 with leastUpperBound (fromN 3 * 1/2) (λ r s → inl (3/2ub s)) sqrt2<2 | inl x = <Transitive x 3/2<2 sqrt2<2 | inr x = <WellDefined (symmetric x) reflexive 3/2<2 2sqrt2<4 : (sqrt2' + sqrt2') < fromN 4 2sqrt2<4 = <WellDefined (transitive *DistributesOver+ (+WellDefined (transitive *Commutative identIsIdent) (transitive *Commutative identIsIdent))) (transitive (transitive (*WellDefined (symmetric identRight) (symmetric identRight)) (*WellDefined (symmetric +Associative) (symmetric +Associative))) (symmetric (fromNPreserves* 2 2))) (ringCanMultiplyByPositive {sqrt2'} {1R + 1R} {1R + 1R} (<WellDefined identLeft reflexive (ringAddInequalities (0<1 nontrivial) (0<1 nontrivial))) sqrt2<2) t<1 : t < 1R t<1 = <Transitive (_&&_.snd tBound) 2/6<1 newElementIsElement : ((sqrt2' + t) * (sqrt2' + t)) < (1R + 1R) newElementIsElement = <WellDefined (symmetric *DistributesOver+') reflexive (<WellDefined (+WellDefined (symmetric *DistributesOver+) reflexive) reflexive (<WellDefined (transitive groupIsAbelian +Associative) reflexive (<Transitive (orderRespectsAddition (<WellDefined (+WellDefined *Commutative reflexive) reflexive (<WellDefined (transitive *Commutative *DistributesOver+) reflexive (ringCanMultiplyByPositive (_&&_.fst tBound) (<WellDefined (symmetric +Associative) reflexive (<Transitive (orderRespectsAddition 2sqrt2<4 t) (<WellDefined groupIsAbelian reflexive (<WellDefined reflexive (reflexive {fromN 5}) (orderRespectsAddition t<1 (fromN 4))))))))) (sqrt2' * sqrt2')) tBound'))) bad : False bad with upperBound (sqrt2' + t) newElementIsElement bad | inl x = irreflexive (<Transitive x (<WellDefined identLeft groupIsAbelian (orderRespectsAddition (_&&_.fst tBound) sqrt2'))) bad | inr x = irreflexive (<WellDefined identLeft (transitive groupIsAbelian x) (orderRespectsAddition (_&&_.fst tBound) sqrt2')) sqrt2IsSqrt2 | inl (inr 2<sup^2) with sup sqrt2IsSqrt2 | inl (inr 2<sup^2) | sqrt2' , record { upperBound = upperBound ; leastUpperBound = leastUpperBound } = exFalso bad where abstract 1<sqrt2 : 1R < sqrt2' 1<sqrt2 with upperBound 1R (<WellDefined (transitive identRight (symmetric identIsIdent)) (+WellDefined reflexive identRight) (fromNPreservesOrder (0<1 nontrivial) {1} {2} (le zero refl))) 1<sqrt2 | inl x = x 1<sqrt2 | inr x = exFalso (irreflexive (<Transitive 2<sup^2 (<WellDefined (transitive identRight (transitive (symmetric identIsIdent) (*WellDefined x x))) (+WellDefined reflexive identRight) (fromNPreservesOrder (0<1 nontrivial) {1} {2} (le 0 refl))))) 0<sqrt2 : 0R < sqrt2' 0<sqrt2 = <Transitive (0<1 nontrivial) 1<sqrt2 sqrt2<2 : sqrt2' < (1R + 1R) sqrt2<2 with leastUpperBound (fromN 3 * 1/2) (λ r s → inl (3/2ub s)) sqrt2<2 | inl x = <Transitive x 3/2<2 sqrt2<2 | inr x = <WellDefined (symmetric x) reflexive 3/2<2 2sqrt2<4 : (sqrt2' + sqrt2') < fromN 4 2sqrt2<4 = <WellDefined (transitive *DistributesOver+ (+WellDefined (transitive *Commutative identIsIdent) (transitive *Commutative identIsIdent))) (transitive (transitive (*WellDefined (symmetric identRight) (symmetric identRight)) (*WellDefined (symmetric +Associative) (symmetric +Associative))) (symmetric (fromNPreserves* 2 2))) (ringCanMultiplyByPositive {sqrt2'} {1R + 1R} {1R + 1R} (<WellDefined identLeft reflexive (ringAddInequalities (0<1 nontrivial) (0<1 nontrivial))) sqrt2<2) t : A t = ((sqrt2' * sqrt2') + inverse (fromN 2)) * underlying (allInvertible (fromN 4) (charZero' 3)) pr1 : inverse (fromN 4 * t) ∼ (inverse (sqrt2' * sqrt2') + (fromN 2)) pr1 with allInvertible (fromN 4) (charZero' 3) ... | 1/4 , pr1/4 = transitive (transitive (transitive (transitive (symmetric ringMinusExtracts) (transitive (transitive (*WellDefined reflexive (transitive (symmetric ringMinusExtracts') (transitive *Commutative (*WellDefined reflexive (transitive invContravariant (transitive groupIsAbelian (+WellDefined reflexive invInv))))))) *Associative) *Commutative)) (*WellDefined reflexive (transitive *Commutative pr1/4))) *Commutative) identIsIdent t<sqrt2 : t < sqrt2' t<sqrt2 with allInvertible (fromN 4) (charZero' 3) ... | 1/4 , pr4 = <WellDefined reflexive (transitive (symmetric *Associative) (transitive (*WellDefined reflexive (transitive *Commutative pr4)) (transitive *Commutative identIsIdent))) (ringCanMultiplyByPositive (inversePositiveIsPositive pr4 (fromNPreservesOrder (0<1 nontrivial) {0} {4} (le 3 refl))) (<Transitive (orderRespectsAddition (ringMultiplyPositives 0<sqrt2 0<sqrt2 sqrt2<2 sqrt2<2) (inverse (1R + (1R + 0G)))) (<WellDefined {fromN 2} 2=2*2-2 reflexive (<Transitive {fromN 2} {sqrt2' * fromN 2} (<WellDefined identIsIdent reflexive (ringCanMultiplyByPositive (fromNPreservesOrder (0<1 nontrivial) {0} (le 1 refl)) 1<sqrt2)) (<WellDefined *Commutative *Commutative (ringCanMultiplyByPositive 0<sqrt2 (fromNPreservesOrder (0<1 nontrivial) {2} (le 1 refl)))))))) 0<t : 0R < t 0<t with allInvertible (fromN 4) (charZero' 3) ... | 1/4 , pr4 = orderRespectsMultiplication (<WellDefined reflexive (+WellDefined reflexive (inverseWellDefined (+WellDefined reflexive (symmetric identRight)))) (moveInequality 2<sup^2)) (inversePositiveIsPositive pr4 (fromNPreservesOrder (0<1 nontrivial) {0} {4} (le 3 refl))) anotherUpperBound : A anotherUpperBound = (sqrt2' + inverse t) * (sqrt2' + inverse t) abstract u : anotherUpperBound ∼ ((sqrt2' * sqrt2') + (inverse ((t * sqrt2') + (t * sqrt2')) + (t * t))) u = transitive *DistributesOver+' (transitive (+WellDefined *DistributesOver+ reflexive) (transitive (symmetric +Associative) (+WellDefined reflexive (transitive (+WellDefined ringMinusExtracts *DistributesOver+) (transitive +Associative (+WellDefined (transitive (+WellDefined (inverseWellDefined *Commutative) ringMinusExtracts') (symmetric invContravariant)) twoNegativesTimes)))))) w : ((sqrt2' * sqrt2') + inverse ((fromN 4) * t)) < anotherUpperBound w = <WellDefined reflexive (symmetric u) (<WellDefined groupIsAbelian groupIsAbelian (orderRespectsAddition (<WellDefined (ringMinusExtracts') (+WellDefined (inverseWellDefined (*DistributesOver+)) reflexive) (<WellDefined reflexive (+WellDefined ringMinusExtracts reflexive) (<WellDefined reflexive *DistributesOver+ (<WellDefined reflexive *Commutative (ringCanMultiplyByPositive 0<t (<WellDefined identRight reflexive (ringAddInequalities (ringSwapNegatives' (<WellDefined reflexive (transitive (+WellDefined (+WellDefined reflexive (symmetric identRight)) (+WellDefined reflexive (symmetric identRight))) (symmetric (fromNPreserves+ 2 2))) (ringAddInequalities sqrt2<2 sqrt2<2))) 0<t))))))) (sqrt2' * sqrt2'))) w' : ((sqrt2' * sqrt2') + inverse ((fromN 4) * t)) ∼ (1R + 1R) w' = transitive (+WellDefined reflexive pr1) (transitive +Associative (transitive (+WellDefined invRight reflexive) (transitive identLeft (+WellDefined reflexive identRight)))) anotherUpperBoundBounds : (1R + 1R) < anotherUpperBound anotherUpperBoundBounds = <WellDefined w' reflexive w aubIsBound : UpperBound sub (sqrt2' + inverse t) aubIsBound y y^2<2 with totality y (sqrt2' + inverse t) aubIsBound y y^2<2 | inl (inl x) = inl x aubIsBound y y^2<2 | inl (inr x) = exFalso (irreflexive (<Transitive (<Transitive anotherUpperBoundBounds (ringMultiplyPositives (moveInequality t<sqrt2) (moveInequality t<sqrt2) x x)) y^2<2)) aubIsBound y y^2<2 | inr x = inr x bad : False bad with leastUpperBound (sqrt2' + inverse t) aubIsBound bad | inl x = irreflexive (<Transitive x (<WellDefined groupIsAbelian identLeft (orderRespectsAddition (ringMinusFlipsOrder 0<t) sqrt2'))) bad | inr x = irreflexive (<WellDefined (symmetric (transitive x groupIsAbelian)) identLeft (orderRespectsAddition (ringMinusFlipsOrder 0<t) sqrt2')) sqrt2IsSqrt2 | inr x = x
{ "alphanum_fraction": 0.6970475615, "avg_line_length": 91.0458715596, "ext": "agda", "hexsha": "db57575cd3ff755fa728426eb256760623015f06", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-29T13:23:07.000Z", "max_forks_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "Smaug123/agdaproofs", "max_forks_repo_path": "Numbers/ClassicalReals/Examples.agda", "max_issues_count": 14, "max_issues_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_issues_repo_issues_event_max_datetime": "2020-04-11T11:03:39.000Z", "max_issues_repo_issues_event_min_datetime": "2019-01-06T21:11:59.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "Smaug123/agdaproofs", "max_issues_repo_path": "Numbers/ClassicalReals/Examples.agda", "max_line_length": 782, "max_stars_count": 4, "max_stars_repo_head_hexsha": "0f4230011039092f58f673abcad8fb0652e6b562", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "Smaug123/agdaproofs", "max_stars_repo_path": "Numbers/ClassicalReals/Examples.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-28T06:04:15.000Z", "max_stars_repo_stars_event_min_datetime": "2019-08-08T12:44:19.000Z", "num_tokens": 6746, "size": 19848 }
{-# OPTIONS --safe #-} module Cubical.Algebra.Field where open import Cubical.Algebra.Field.Base public
{ "alphanum_fraction": 0.7619047619, "avg_line_length": 21, "ext": "agda", "hexsha": "dbdabcbb88ca20f160e2c12f98efb49deadbb1ce", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "thomas-lamiaux/cubical", "max_forks_repo_path": "Cubical/Algebra/Field.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "thomas-lamiaux/cubical", "max_issues_repo_path": "Cubical/Algebra/Field.agda", "max_line_length": 45, "max_stars_count": 1, "max_stars_repo_head_hexsha": "58c0b83bb0fed0dc683f3d29b1709effe51c1689", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "thomas-lamiaux/cubical", "max_stars_repo_path": "Cubical/Algebra/Field.agda", "max_stars_repo_stars_event_max_datetime": "2021-10-31T17:32:49.000Z", "max_stars_repo_stars_event_min_datetime": "2021-10-31T17:32:49.000Z", "num_tokens": 23, "size": 105 }
module _ where import Agda.Primitive.Cubical as C -- Cannot alias module exporting primitives with typechecking constraints. module M = C
{ "alphanum_fraction": 0.7943262411, "avg_line_length": 17.625, "ext": "agda", "hexsha": "8c368233eb0f8c888d468f9e003ac21c6bb5d8ed", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "cruhland/agda", "max_forks_repo_path": "test/Fail/Issue2446.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "cruhland/agda", "max_issues_repo_path": "test/Fail/Issue2446.agda", "max_line_length": 74, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "7f58030124fa99dfbf8db376659416f3ad8384de", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "cruhland/agda", "max_stars_repo_path": "test/Fail/Issue2446.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 31, "size": 141 }
{-# OPTIONS --without-K --exact-split --safe #-} module Fragment.Setoid.Morphism where open import Fragment.Setoid.Morphism.Base public open import Fragment.Setoid.Morphism.Setoid public open import Fragment.Setoid.Morphism.Properties public
{ "alphanum_fraction": 0.8032786885, "avg_line_length": 30.5, "ext": "agda", "hexsha": "7241442ec4f99d5e04c3293b21423883e6df224d", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2021-06-16T08:04:31.000Z", "max_forks_repo_forks_event_min_datetime": "2021-06-15T15:34:50.000Z", "max_forks_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "yallop/agda-fragment", "max_forks_repo_path": "src/Fragment/Setoid/Morphism.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496", "max_issues_repo_issues_event_max_datetime": "2021-06-16T10:24:15.000Z", "max_issues_repo_issues_event_min_datetime": "2021-06-16T09:44:31.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "yallop/agda-fragment", "max_issues_repo_path": "src/Fragment/Setoid/Morphism.agda", "max_line_length": 54, "max_stars_count": 18, "max_stars_repo_head_hexsha": "f2a6b1cf4bc95214bd075a155012f84c593b9496", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "yallop/agda-fragment", "max_stars_repo_path": "src/Fragment/Setoid/Morphism.agda", "max_stars_repo_stars_event_max_datetime": "2022-01-17T17:26:09.000Z", "max_stars_repo_stars_event_min_datetime": "2021-06-15T15:45:39.000Z", "num_tokens": 50, "size": 244 }
------------------------------------------------------------------------------ -- Totality properties respect to Tree ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Program.SortList.Properties.Totality.TreeATP where open import FOTC.Base open import FOTC.Base.List open import FOTC.Data.Nat.Inequalities.PropertiesATP open import FOTC.Data.Nat.List.Type open import FOTC.Data.Nat.Type open import FOTC.Program.SortList.SortList open import FOTC.Data.Nat.Inequalities ------------------------------------------------------------------------------ toTree-Tree : ∀ {item t} → N item → Tree t → Tree (toTree · item · t) toTree-Tree {item} Nitem tnil = prf where postulate prf : Tree (toTree · item · nil) {-# ATP prove prf #-} toTree-Tree {item} Nitem (ttip {i} Ni) = prf (x>y∨x≤y Ni Nitem) where postulate prf : i > item ∨ i ≤ item → Tree (toTree · item · tip i) {-# ATP prove prf x>y→x≰y #-} toTree-Tree {item} Nitem (tnode {t₁} {i} {t₂} Tt₁ Ni Tt₂) = prf (x>y∨x≤y Ni Nitem) (toTree-Tree Nitem Tt₁) (toTree-Tree Nitem Tt₂) where postulate prf : i > item ∨ i ≤ item → Tree (toTree · item · t₁) → Tree (toTree · item · t₂) → Tree (toTree · item · node t₁ i t₂) {-# ATP prove prf x>y→x≰y #-} makeTree-Tree : ∀ {is} → ListN is → Tree (makeTree is) makeTree-Tree lnnil = prf where postulate prf : Tree (makeTree []) {-# ATP prove prf #-} makeTree-Tree (lncons {i} {is} Nn Lis) = prf (makeTree-Tree Lis) where postulate prf : Tree (makeTree is) → Tree (makeTree (i ∷ is)) {-# ATP prove prf toTree-Tree #-}
{ "alphanum_fraction": 0.5356359649, "avg_line_length": 38.8085106383, "ext": "agda", "hexsha": "766cdefee2075ac95efab20e2f9fa66d0b907e0d", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "asr/fotc", "max_forks_repo_path": "src/fot/FOTC/Program/SortList/Properties/Totality/TreeATP.agda", "max_issues_count": 2, "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "asr/fotc", "max_issues_repo_path": "src/fot/FOTC/Program/SortList/Properties/Totality/TreeATP.agda", "max_line_length": 78, "max_stars_count": 11, "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/fotc", "max_stars_repo_path": "src/fot/FOTC/Program/SortList/Properties/Totality/TreeATP.agda", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "num_tokens": 533, "size": 1824 }
{-# OPTIONS --allow-unsolved-metas #-} {-# OPTIONS --show-implicit #-} open import Oscar.Prelude open import Oscar.Class -- classes open import Oscar.Class.Transitivity -- data open import Oscar.Data.Substitunction open import Oscar.Data.Term module Test.EquivalentCandidates-2 where module _ {a} where instance 𝓣ransitivityFunction₁ : Transitivity.class Function⟦ a ⟧ 𝓣ransitivityFunction₁ .⋆ f g = g ∘ f 𝓣ransitivityFunction₂ : Transitivity.class Function⟦ a ⟧ 𝓣ransitivityFunction₂ .⋆ f g = g ∘ f module _ (𝔓 : Ø₀) where open Substitunction 𝔓 open Term 𝔓 test-1 test-2 test-3 test-4 test-5 test-6 : ∀ {m n} (f : Substitunction m n) → Substitunction m n test-1 f = transitivity {!!} {!!} test-2 f = transitivity {𝔒 = Ø₀} {_∼_ = Function⟦ ∅̂ ⟧} {!!} {!!} test-3 f = transitivity f {!!} test-4 {m} {n} f = transitivity {𝔒 = Ø₀} f (¡ {𝔒 = Term n}) test-5 f = transitivity {_∼_ = Function⟦ ∅̂ ⟧} f {!!} test-6 {m} {n} f = transitivity {𝔒 = Ø₀} ⦃ {!!} ⦄ f (¡ {𝔒 = Term n})
{ "alphanum_fraction": 0.634502924, "avg_line_length": 24.4285714286, "ext": "agda", "hexsha": "fcb00ad9888c507c83f0a73b74eaf1f8bb0b2324", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": [ "RSA-MD" ], "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_path": "archive/agda-3/src/Test/EquivalentCandidates-2.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_licenses": [ "RSA-MD" ], "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_path": "archive/agda-3/src/Test/EquivalentCandidates-2.agda", "max_line_length": 70, "max_stars_count": null, "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": [ "RSA-MD" ], "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_path": "archive/agda-3/src/Test/EquivalentCandidates-2.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 383, "size": 1026 }
{-# OPTIONS --without-K #-} open import lib.Base module test.fail.Test1 where module _ where private data #I-aux : Type₀ where #zero : #I-aux #one : #I-aux data #I : Type₀ where #i : #I-aux → (Unit → Unit) → #I I : Type₀ I = #I zero : I zero = #i #zero _ one : I one = #i #one _ postulate seg : zero == one absurd : zero ≠ one absurd () -- fails
{ "alphanum_fraction": 0.5334987593, "avg_line_length": 13, "ext": "agda", "hexsha": "a10aa65adb85fc8eceededf07f600b745b8a6e21", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "nicolaikraus/HoTT-Agda", "max_forks_repo_path": "test/fail/Test1.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "939a2d83e090fcc924f69f7dfa5b65b3b79fe633", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "nicolaikraus/HoTT-Agda", "max_issues_repo_path": "test/fail/Test1.agda", "max_line_length": 38, "max_stars_count": 1, "max_stars_repo_head_hexsha": "f8fa68bf753d64d7f45556ca09d0da7976709afa", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "UlrikBuchholtz/HoTT-Agda", "max_stars_repo_path": "test/fail/Test1.agda", "max_stars_repo_stars_event_max_datetime": "2021-06-30T00:17:55.000Z", "max_stars_repo_stars_event_min_datetime": "2021-06-30T00:17:55.000Z", "num_tokens": 144, "size": 403 }
data ℕ : Set where zero : ℕ suc : ℕ → ℕ {-# BUILTIN NATURAL ℕ #-} _+_ : ℕ → ℕ → ℕ zero + b = b suc a + b = suc (a + b) infix 100 _+_ data _≡_ : ℕ → ℕ → Set where refl : {n : ℕ} → n ≡ n sym : {n m : ℕ} → n ≡ m → m ≡ n sym refl = refl trans : {m n o : ℕ} → m ≡ n → n ≡ o → m ≡ o trans refl p₂ = p₂ suc-inj : {m n : ℕ} → suc m ≡ suc n → m ≡ n suc-inj refl = refl data ⊥ : Set where ¬ : Set → Set ¬ A = A → ⊥ _≢_ : ℕ → ℕ → Set m ≢ n = ¬(m ≡ n) zero-img : ∀ {m} → suc m ≢ 0 zero-img () induction : (P : ℕ → Set) → P 0 → (∀ {n} → P n → P (suc n)) → (∀ m → P m) induction pred base hypo zero = base induction pred base hypo (suc m) = hypo (induction pred base hypo m) cong : ∀ {m n} → (f : ℕ → ℕ) → m ≡ n → f m ≡ f n cong f refl = refl assoc : ∀ m n o → m + (n + o) ≡ (m + n) + o assoc zero n o = refl assoc (suc m) n o = cong suc (assoc m n o) n+zero : ∀ n → n ≡ n + 0 n+zero zero = refl n+zero (suc n) = cong suc (n+zero n) suc+ : ∀ m n → suc (n + m) ≡ (n + suc m) suc+ m zero = refl suc+ m (suc n) = cong suc (suc+ m n) comm : ∀ m n → m + n ≡ n + m comm zero n = n+zero n comm (suc m) n = trans (cong suc (comm m n)) (suc+ m n) -- Where to go from here? -- Agda: -- • Aaron Stump - Verified Functional Programming in Agda, https://svn.divms.uiowa.edu/repos/clc/projects/agda/book/book.pdf -- • Conor McBride - Dependently Typed Metaprogramming (in Agda), http://cs.ioc.ee/ewscs/2014/mcbride/mcbride-deptypedmetaprog.pdf -- Type theory: -- • So you want to learn type theory, http://purelytheoretical.com/sywtltt.html
{ "alphanum_fraction": 0.5541153597, "avg_line_length": 23.7384615385, "ext": "agda", "hexsha": "ef1ab753322df632942d29a24a836915c97932da", "lang": "Agda", "max_forks_count": 9, "max_forks_repo_forks_event_max_datetime": "2018-09-14T07:57:40.000Z", "max_forks_repo_forks_event_min_datetime": "2015-03-04T22:12:51.000Z", "max_forks_repo_head_hexsha": "970b31f80fc24481a088b099f32a8c8e4b120618", "max_forks_repo_licenses": [ "Artistic-2.0" ], "max_forks_repo_name": "FPBrno/FPBrno.github.io", "max_forks_repo_path": "fpb-6/talk.agda", "max_issues_count": 21, "max_issues_repo_head_hexsha": "970b31f80fc24481a088b099f32a8c8e4b120618", "max_issues_repo_issues_event_max_datetime": "2019-01-14T18:45:37.000Z", "max_issues_repo_issues_event_min_datetime": "2015-03-05T11:01:13.000Z", "max_issues_repo_licenses": [ "Artistic-2.0" ], "max_issues_repo_name": "FPBrno/FPBrno.github.io", "max_issues_repo_path": "fpb-6/talk.agda", "max_line_length": 132, "max_stars_count": 1, "max_stars_repo_head_hexsha": "970b31f80fc24481a088b099f32a8c8e4b120618", "max_stars_repo_licenses": [ "Artistic-2.0" ], "max_stars_repo_name": "FPBrno/FPBrno.github.io", "max_stars_repo_path": "fpb-6/talk.agda", "max_stars_repo_stars_event_max_datetime": "2018-12-06T14:30:32.000Z", "max_stars_repo_stars_event_min_datetime": "2018-12-06T14:30:32.000Z", "num_tokens": 646, "size": 1543 }
module UnifyTermF (FunctionName : Set) where open import Data.Fin using (Fin; suc; zero) open import Data.Nat using (ℕ; suc; zero) open import Relation.Binary.PropositionalEquality using (_≡_; refl; cong₂; cong; sym; trans) open import Function using (_∘_; flip) open import Relation.Nullary using (¬_; Dec; yes; no) open import Data.Product using (∃; _,_; _×_) open import Data.Empty using (⊥-elim) open import Data.Vec using (Vec; []; _∷_) renaming (map to mapV) data Term (n : ℕ) : Set where i : (x : Fin n) -> Term n leaf : Term n _fork_ : (s t : Term n) -> Term n function : FunctionName → ∀ {f} → Vec (Term n) f → Term n Term-function-inj-FunctionName : ∀ {fn₁ fn₂} {n N₁ N₂} {ts₁ : Vec (Term n) N₁} {ts₂ : Vec (Term n) N₂} → Term.function fn₁ ts₁ ≡ Term.function fn₂ ts₂ → fn₁ ≡ fn₂ Term-function-inj-FunctionName refl = refl Term-function-inj-VecSize : ∀ {fn₁ fn₂} {n N₁ N₂} {ts₁ : Vec (Term n) N₁} {ts₂ : Vec (Term n) N₂} → Term.function fn₁ ts₁ ≡ Term.function fn₂ ts₂ → N₁ ≡ N₂ Term-function-inj-VecSize refl = refl Term-function-inj-Vector : ∀ {fn₁ fn₂} {n N} {ts₁ : Vec (Term n) N} {ts₂ : Vec (Term n) N} → Term.function fn₁ ts₁ ≡ Term.function fn₂ ts₂ → ts₁ ≡ ts₂ Term-function-inj-Vector refl = refl Term-fork-inj-left : ∀ {n} {l₁ r₁ l₂ r₂ : Term n} → l₁ fork r₁ ≡ l₂ fork r₂ → l₁ ≡ l₂ Term-fork-inj-left refl = refl Term-fork-inj-right : ∀ {n} {l₁ r₁ l₂ r₂ : Term n} → l₁ fork r₁ ≡ l₂ fork r₂ → r₁ ≡ r₂ Term-fork-inj-right refl = refl open import Relation.Binary.HeterogeneousEquality using (_≅_; refl) Term-function-inj-HetVector : ∀ {fn₁ fn₂} {n N₁ N₂} {ts₁ : Vec (Term n) N₁} {ts₂ : Vec (Term n) N₂} → Term.function fn₁ ts₁ ≡ Term.function fn₂ ts₂ → ts₁ ≅ ts₂ Term-function-inj-HetVector refl = refl _~>_ : (m n : ℕ) -> Set m ~> n = Fin m -> Term n ▹ : ∀ {m n} -> (r : Fin m -> Fin n) -> Fin m -> Term n ▹ r = i ∘ r Property⋆ : (m : ℕ) -> Set1 Property⋆ m = ∀ {n} -> (Fin m -> Term n) -> Set record Substitution (T : ℕ → Set) : Set where field _◃_ : ∀ {m n} -> (f : m ~> n) -> T m -> T n Unifies⋆ : ∀ {m} (s t : T m) -> Property⋆ m Unifies⋆ s t f = f ◃ s ≡ f ◃ t open Substitution ⦃ … ⦄ public {-# DISPLAY Substitution._◃_ _ = _◃_ #-} mutual instance SubstitutionTerm : Substitution Term Substitution._◃_ SubstitutionTerm = _◃′_ where _◃′_ : ∀ {m n} -> (f : m ~> n) -> Term m -> Term n f ◃′ i x = f x f ◃′ leaf = leaf f ◃′ (s fork t) = (f ◃ s) fork (f ◃ t) f ◃′ (function fn ts) = function fn (f ◃ ts) instance SubstitutionVecTerm : ∀ {N} → Substitution (flip Vec N ∘ Term ) Substitution._◃_ (SubstitutionVecTerm {N}) = _◃′_ where _◃′_ : ∀ {m n} -> (f : m ~> n) -> Vec (Term m) N -> Vec (Term n) N f ◃′ [] = [] f ◃′ (t ∷ ts) = f ◃ t ∷ f ◃ ts _≐_ : {m n : ℕ} -> (Fin m -> Term n) -> (Fin m -> Term n) -> Set f ≐ g = ∀ x -> f x ≡ g x record SubstitutionExtensionality (T : ℕ → Set) ⦃ _ : Substitution T ⦄ : Set₁ where field ◃ext : ∀ {m n} {f g : Fin m -> Term n} -> f ≐ g -> (t : T m) -> f ◃ t ≡ g ◃ t open SubstitutionExtensionality ⦃ … ⦄ public mutual instance SubstitutionExtensionalityTerm : SubstitutionExtensionality Term SubstitutionExtensionality.◃ext SubstitutionExtensionalityTerm = ◃ext′ where ◃ext′ : ∀ {m n} {f g : Fin m -> Term n} -> f ≐ g -> ∀ t -> f ◃ t ≡ g ◃ t ◃ext′ p (i x) = p x ◃ext′ p leaf = refl ◃ext′ p (s fork t) = cong₂ _fork_ (◃ext p s) (◃ext p t) ◃ext′ p (function fn ts) = cong (function fn) (◃ext p ts) instance SubstitutionExtensionalityVecTerm : ∀ {N} → SubstitutionExtensionality (flip Vec N ∘ Term) SubstitutionExtensionality.◃ext (SubstitutionExtensionalityVecTerm {N}) = λ x → ◃ext′ x where ◃ext′ : ∀ {m n} {f g : Fin m -> Term n} -> f ≐ g -> ∀ {N} (t : Vec (Term m) N) -> f ◃ t ≡ g ◃ t ◃ext′ p [] = refl ◃ext′ p (t ∷ ts) = cong₂ _∷_ (◃ext p t) (◃ext p ts) _◇_ : ∀ {l m n : ℕ } -> (f : Fin m -> Term n) (g : Fin l -> Term m) -> Fin l -> Term n f ◇ g = (f ◃_) ∘ g ≐-cong : ∀ {m n o} {f : m ~> n} {g} (h : _ ~> o) -> f ≐ g -> (h ◇ f) ≐ (h ◇ g) ≐-cong h f≐g t = cong (h ◃_) (f≐g t) ≐-sym : ∀ {m n} {f : m ~> n} {g} -> f ≐ g -> g ≐ f ≐-sym f≐g = sym ∘ f≐g open import Prelude using (it) module Sub where record Fact1 (T : ℕ → Set) ⦃ _ : Substitution T ⦄ : Set where field fact1 : ∀ {n} -> (t : T n) -> i ◃ t ≡ t open Fact1 ⦃ … ⦄ public mutual instance Fact1Term : Fact1 Term Fact1.fact1 Fact1Term (i x) = refl Fact1.fact1 Fact1Term leaf = refl Fact1.fact1 Fact1Term (s fork t) = cong₂ _fork_ (fact1 s) (fact1 t) Fact1.fact1 Fact1Term (function fn ts) = cong (function fn) (fact1 ts) instance Fact1TermVec : ∀ {N} → Fact1 (flip Vec N ∘ Term) Fact1.fact1 Fact1TermVec [] = refl Fact1.fact1 Fact1TermVec (t ∷ ts) = cong₂ _∷_ (fact1 t) (fact1 ts) record Fact2 (T : ℕ → Set) ⦃ _ : Substitution T ⦄ : Set where field -- ⦃ s ⦄ : Substitution T fact2 : ∀ {l m n} -> {f : Fin m -> Term n} {g : _} (t : T l) → (f ◇ g) ◃ t ≡ f ◃ (g ◃ t) open Fact2 ⦃ … ⦄ public mutual instance Fact2Term : Fact2 Term -- Fact2.s Fact2Term = SubstitutionTerm Fact2.fact2 Fact2Term (i x) = refl Fact2.fact2 Fact2Term leaf = refl Fact2.fact2 Fact2Term (s fork t) = cong₂ _fork_ (fact2 s) (fact2 t) Fact2.fact2 Fact2Term {f = f} {g = g} (function fn ts) = cong (function fn) (fact2 {f = f} {g = g} ts) -- fact2 ts instance Fact2TermVec : ∀ {N} → Fact2 (flip Vec N ∘ Term) -- Fact2.s Fact2TermVec = SubstitutionVecTerm Fact2.fact2 Fact2TermVec [] = refl Fact2.fact2 Fact2TermVec (t ∷ ts) = cong₂ _∷_ (fact2 t) (fact2 ts) fact3 : ∀ {l m n} (f : Fin m -> Term n) (r : Fin l -> Fin m) -> (f ◇ (▹ r)) ≡ (f ∘ r) fact3 f r = refl ◃ext' : ∀ {m n o} {f : Fin m -> Term n}{g : Fin m -> Term o}{h} -> f ≐ (h ◇ g) -> ∀ (t : Term _) -> f ◃ t ≡ h ◃ (g ◃ t) ◃ext' p t = trans (◃ext p t) (Sub.fact2 t) open import Agda.Primitive Injectivity : ∀ {a} {A : Set a} {b} {B : Set b} (f : A → B) → Set (a ⊔ b) Injectivity f = ∀ {x y} → f x ≡ f y → x ≡ y Injectivity₂ : ∀ {a} {A : Set a} {b} {B : Set b} {c} {C : Set c} (f : A → B → C) → Set (a ⊔ b ⊔ c) Injectivity₂ f = ∀ {w x y z} → f w x ≡ f y z → x ≡ z record Injective {a} {A : Set a} {b} {B : Set b} (f : A → B) : Set (a ⊔ b) where field injectivity : ∀ x y → f x ≡ f y → x ≡ y open Injective public -- ⦃ … ⦄ public record Thin (T : ℕ → Set) : Set where field thin : ∀ {n} -> Fin (suc n) → T n → T (suc n) thinfact1 : ∀ {n} (f : Fin (suc n)) → Injectivity (thin f) term-i-inj : ∀ {n} → Injectivity (Term.i {n}) term-i-inj refl = refl term-fork-l-inj : ∀ {n} → Injectivity₂ (flip (_fork_ {n})) term-fork-l-inj refl = refl term-fork-r-inj : ∀ {n} → Injectivity₂ (_fork_ {n}) term-fork-r-inj refl = refl open Thin ⦃ … ⦄ public p : ∀ {n} -> Fin (suc (suc n)) -> Fin (suc n) p (suc x) = x p zero = zero instance ThinFin : Thin Fin Thin.thin ThinFin zero y = suc y Thin.thin ThinFin (suc x) zero = zero Thin.thin ThinFin (suc x) (suc y) = suc (thin x y) Thin.thinfact1 ThinFin zero refl = refl Thin.thinfact1 ThinFin (suc x) {zero} {zero} r = refl Thin.thinfact1 ThinFin (suc x) {zero} {(suc z)} () Thin.thinfact1 ThinFin (suc x) {(suc y)} {zero} () Thin.thinfact1 ThinFin (suc x) {(suc y)} {(suc z)} r = cong suc (thinfact1 x (cong p r)) {- TODO defining using the below leads to termination checker problem -} tfact1 : ∀ {n} (x : Fin (suc n)) (y : Fin _) (z : Fin n) -> thin x y ≡ thin x z -> y ≡ z tfact1 zero y .y refl = refl tfact1 (suc x) zero zero r = refl tfact1 (suc x) zero (suc z) () tfact1 (suc x) (suc y) zero () tfact1 (suc x) (suc y) (suc z) r = cong suc (tfact1 x y z (cong p r)) mutual mapTerm : ∀ {n m} → (Fin n → Fin m) → Term n → Term m mapTerm x (i x₁) = i (x x₁) mapTerm x leaf = leaf mapTerm x (x₁ fork x₂) = mapTerm x x₁ fork mapTerm x x₂ mapTerm x (function x₁ x₂) = function x₁ (mapTerms x x₂) mapTerms : ∀ {n m} → (Fin n → Fin m) → ∀ {N} → Vec (Term n) N → Vec (Term m) N mapTerms x [] = [] mapTerms x (x₁ ∷ x₂) = mapTerm x x₁ ∷ mapTerms x x₂ mutual thinfact1Term : ∀ {n} (f : Fin (suc n)) → Injectivity (mapTerm (thin f)) thinfact1Term x₁ {i x} {i x₃} x₂ = cong i (thinfact1 x₁ (term-i-inj x₂)) thinfact1Term x₁ {i x} {leaf} () thinfact1Term x₁ {i x} {y fork y₁} () thinfact1Term x₁ {i x} {function x₂ x₃} () thinfact1Term x₁ {leaf} {i x} () thinfact1Term x₁ {leaf} {leaf} x₂ = refl thinfact1Term x₁ {leaf} {y fork y₁} () thinfact1Term x₁ {leaf} {function x x₂} () thinfact1Term x₁ {x fork x₂} {i x₃} () thinfact1Term x₁ {x fork x₂} {leaf} () thinfact1Term x₁ {x fork x₂} {y fork y₁} x₃ = cong₂ _fork_ (thinfact1Term x₁ (term-fork-l-inj x₃)) ((thinfact1Term x₁ (term-fork-r-inj x₃))) thinfact1Term x₁ {x fork x₂} {function x₃ x₄} () thinfact1Term x₁ {function x x₂} {i x₃} () thinfact1Term x₁ {function x x₂} {leaf} () thinfact1Term x₁ {function x x₂} {y fork y₁} () thinfact1Term x₁ {function f1 {n} ts1} {function f2 ts2} r rewrite Term-function-inj-FunctionName r with Term-function-inj-VecSize r thinfact1Term x₁ {function f1 {n} ts1} {function f2 ts2} r | refl with Term-function-inj-Vector r thinfact1Term {m} x₁ {function f1 {n} ts1} {function f2 {.n} ts2} r | refl | w = cong (function f2) (((thinfact1Terms x₁ w))) thinfact1Terms : ∀ {N} {n} (f : Fin (suc n)) → Injectivity (mapTerms (thin f) {N}) thinfact1Terms {.0} f {[]} {[]} x₁ = refl thinfact1Terms {.(suc _)} f {x ∷ x₁} {x₂ ∷ y} x₃ = cong₂ _∷_ (thinfact1Term f (cong Data.Vec.head x₃)) (thinfact1Terms f (cong Data.Vec.tail x₃)) mutual instance ThinTerm : Thin Term Thin.thin ThinTerm = mapTerm ∘ thin Thin.thinfact1 ThinTerm = thinfact1Term instance ThinTermVec : ∀ {N} → Thin (flip Vec N ∘ Term) Thin.thin ThinTermVec x x₁ = mapTerms (thin x) x₁ Thin.thinfact1 ThinTermVec = thinfact1Terms module ThinFact where fact2 : ∀ {n} x (y : Fin n) -> ¬ thin x y ≡ x fact2 zero y () fact2 (suc x) zero () fact2 (suc x) (suc y) r = fact2 x y (cong p r) fact3 : ∀{n} x (y : Fin (suc n)) -> ¬ x ≡ y -> ∃ λ y' -> thin x y' ≡ y fact3 zero zero ne = ⊥-elim (ne refl) fact3 zero (suc y) _ = y , refl fact3 {zero} (suc ()) _ _ fact3 {suc n} (suc x) zero ne = zero , refl fact3 {suc n} (suc x) (suc y) ne with y | fact3 x y (ne ∘ cong suc) ... | .(thin x y') | y' , refl = suc y' , refl open import Data.Maybe open import Category.Functor open import Category.Monad import Level open RawMonad (Data.Maybe.monad {Level.zero}) thick : ∀ {n} -> (x y : Fin (suc n)) -> Maybe (Fin n) thick zero zero = nothing thick zero (suc y) = just y thick {zero} (suc ()) _ thick {suc _} (suc x) zero = just zero thick {suc _} (suc x) (suc y) = suc <$> (thick x y) open import Data.Sum _≡Fin_ : ∀ {n} -> (x y : Fin n) -> Dec (x ≡ y) zero ≡Fin zero = yes refl zero ≡Fin suc y = no λ () suc x ≡Fin zero = no λ () suc {suc _} x ≡Fin suc y with x ≡Fin y ... | yes r = yes (cong suc r) ... | no r = no λ e -> r (cong p e) suc {zero} () ≡Fin _ module Thick where half1 : ∀ {n} (x : Fin (suc n)) -> thick x x ≡ nothing half1 zero = refl half1 {suc _} (suc x) = cong (_<$>_ suc) (half1 x) half1 {zero} (suc ()) half2 : ∀ {n} (x : Fin (suc n)) y -> ∀ y' -> thin x y' ≡ y -> thick x y ≡ just y' half2 zero zero y' () half2 zero (suc y) .y refl = refl half2 {suc n} (suc x) zero zero refl = refl half2 {suc _} (suc _) zero (suc _) () half2 {suc n} (suc x) (suc y) zero () half2 {suc n} (suc x) (suc .(thin x y')) (suc y') refl with thick x (thin x y') | half2 x (thin x y') y' refl ... | .(just y') | refl = refl half2 {zero} (suc ()) _ _ _ fact1 : ∀ {n} (x : Fin (suc n)) y r -> thick x y ≡ r -> x ≡ y × r ≡ nothing ⊎ ∃ λ y' -> thin x y' ≡ y × r ≡ just y' fact1 x y .(thick x y) refl with x ≡Fin y fact1 x .x ._ refl | yes refl = inj₁ (refl , half1 x) ... | no el with ThinFact.fact3 x y el ... | y' , thinxy'=y = inj₂ (y' , ( thinxy'=y , half2 x y y' thinxy'=y )) record Check (T : ℕ → Set) : Set where field check : ∀{n} (x : Fin (suc n)) (t : T (suc n)) -> Maybe (T n) open Check ⦃ … ⦄ public _<*>_ = _⊛_ mutual instance CheckTerm : Check Term Check.check CheckTerm x (i y) = i <$> thick x y Check.check CheckTerm x leaf = just leaf Check.check CheckTerm x (s fork t) = _fork_ <$> check x s ⊛ check x t Check.check CheckTerm x (function fn ts) = ⦇ (function fn) (check x ts) ⦈ instance CheckTermVec : ∀ {N} → Check (flip Vec N ∘ Term) Check.check CheckTermVec x [] = just [] Check.check CheckTermVec x (t ∷ ts) = ⦇ check x t ∷ check x ts ⦈ _for_ : ∀ {n} (t' : Term n) (x : Fin (suc n)) -> Fin (suc n) -> Term n (t' for x) y = maybe′ i t' (thick x y) data AList : ℕ -> ℕ -> Set where anil : ∀ {n} -> AList n n _asnoc_/_ : ∀ {m n} (σ : AList m n) (t' : Term m) (x : Fin (suc m)) -> AList (suc m) n sub : ∀ {m n} (σ : AList m n) -> Fin m -> Term n sub anil = i sub (σ asnoc t' / x) = sub σ ◇ (t' for x) _++_ : ∀ {l m n} (ρ : AList m n) (σ : AList l m) -> AList l n ρ ++ anil = ρ ρ ++ (σ asnoc t' / x) = (ρ ++ σ) asnoc t' / x ++-assoc : ∀ {l m n o} (ρ : AList l m) (σ : AList n _) (τ : AList o _) -> ρ ++ (σ ++ τ) ≡ (ρ ++ σ) ++ τ ++-assoc ρ σ anil = refl ++-assoc ρ σ (τ asnoc t / x) = cong (λ s -> s asnoc t / x) (++-assoc ρ σ τ) module SubList where anil-id-l : ∀ {m n} (σ : AList m n) -> anil ++ σ ≡ σ anil-id-l anil = refl anil-id-l (σ asnoc t' / x) = cong (λ σ -> σ asnoc t' / x) (anil-id-l σ) fact1 : ∀ {l m n} (ρ : AList m n) (σ : AList l m) -> sub (ρ ++ σ) ≐ (sub ρ ◇ sub σ) fact1 ρ anil v = refl fact1 {suc l} {m} {n} r (s asnoc t' / x) v = trans hyp-on-terms ◃-assoc where t = (t' for x) v hyp-on-terms = ◃ext (fact1 r s) t ◃-assoc = Sub.fact2 t _∃asnoc_/_ : ∀ {m} (a : ∃ (AList m)) (t' : Term m) (x : Fin (suc m)) -> ∃ (AList (suc m)) (n , σ) ∃asnoc t' / x = n , σ asnoc t' / x flexFlex : ∀ {m} (x y : Fin m) -> ∃ (AList m) flexFlex {suc m} x y with thick x y ... | just y' = m , anil asnoc i y' / x ... | nothing = suc m , anil flexFlex {zero} () _ flexRigid : ∀ {m} (x : Fin m) (t : Term m) -> Maybe (∃(AList m)) flexRigid {suc m} x t with check x t ... | just t' = just (m , anil asnoc t' / x) ... | nothing = nothing flexRigid {zero} () _
{ "alphanum_fraction": 0.5654840733, "avg_line_length": 36.6930946292, "ext": "agda", "hexsha": "0d992d54181d582e56a306e4f2beb7bc658b5489", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_forks_repo_licenses": [ "RSA-MD" ], "max_forks_repo_name": "m0davis/oscar", "max_forks_repo_path": "archive/agda-1/UnifyTermF.agda", "max_issues_count": 1, "max_issues_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_issues_repo_issues_event_max_datetime": "2019-05-11T23:33:04.000Z", "max_issues_repo_issues_event_min_datetime": "2019-04-29T00:35:04.000Z", "max_issues_repo_licenses": [ "RSA-MD" ], "max_issues_repo_name": "m0davis/oscar", "max_issues_repo_path": "archive/agda-1/UnifyTermF.agda", "max_line_length": 162, "max_stars_count": null, "max_stars_repo_head_hexsha": "52e1cdbdee54d9a8eaee04ee518a0d7f61d25afb", "max_stars_repo_licenses": [ "RSA-MD" ], "max_stars_repo_name": "m0davis/oscar", "max_stars_repo_path": "archive/agda-1/UnifyTermF.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 5947, "size": 14347 }
module L.Base.Sigma.Core where -- Import the Σ record with constructors fst, snd open import Agda.Builtin.Sigma public split : ∀{a b c} {A : Set a} {B : A → Set b} (C : Σ A B → Set c) → ((x : A)(y : B x) → C (x , y)) → (p : Σ A B) → C p split C g (a , b) = g a b
{ "alphanum_fraction": 0.5421245421, "avg_line_length": 30.3333333333, "ext": "agda", "hexsha": "6256cef57b0b63ed19078c92be9494603863e07c", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3", "max_forks_repo_licenses": [ "BSD-2-Clause" ], "max_forks_repo_name": "borszag/smallib", "max_forks_repo_path": "src/L/Base/Sigma/Core.agda", "max_issues_count": 10, "max_issues_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3", "max_issues_repo_issues_event_max_datetime": "2020-11-09T16:40:39.000Z", "max_issues_repo_issues_event_min_datetime": "2020-10-19T10:13:16.000Z", "max_issues_repo_licenses": [ "BSD-2-Clause" ], "max_issues_repo_name": "borszag/smallib", "max_issues_repo_path": "src/L/Base/Sigma/Core.agda", "max_line_length": 64, "max_stars_count": null, "max_stars_repo_head_hexsha": "83707537b182ba8906228ac0bcb9ccef972eaaa3", "max_stars_repo_licenses": [ "BSD-2-Clause" ], "max_stars_repo_name": "borszag/smallib", "max_stars_repo_path": "src/L/Base/Sigma/Core.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 108, "size": 273 }
module Prelude.List where open import Prelude.Bool open import Prelude.Nat open import Prelude.Fin infixr 40 _::_ data List (A : Set) : Set where [] : List A _::_ : A -> List A -> List A {-# BUILTIN LIST List #-} {-# BUILTIN NIL [] #-} {-# BUILTIN CONS _::_ #-} infixr 30 _++_ _++_ : {A : Set} -> List A -> List A -> List A [] ++ ys = ys (x :: xs) ++ ys = x :: (xs ++ ys) snoc : {A : Set} -> List A -> A -> List A snoc [] e = e :: [] snoc (x :: xs) e = x :: snoc xs e length : {A : Set} -> List A -> Nat length [] = 0 length (x :: xs) = 1 + length xs zipWith : ∀ {A B C} -> (A -> B -> C) -> List A -> List B -> List C zipWith f (x :: xs) (y :: ys) = f x y :: zipWith f xs ys zipWith _ _ _ = [] map : ∀ {A B} -> (A -> B) -> List A -> List B map _ [] = [] map f (x :: xs) = f x :: map f xs mapIgen : ∀ {A B} -> (A -> B) -> List A -> List B mapIgen = map _!_ : ∀ {A} -> (xs : List A) -> Fin (length {A} xs) -> A _!_ {A} (x :: xs) (fz .{length xs}) = x _!_ {A} (x :: xs) (fs .{length xs} n) = _!_ {A} xs n _!_ {A} [] () _[_]=_ : {A : Set} -> (xs : List A) -> Fin (length xs) -> A -> List A (a :: as) [ fz ]= e = e :: as (a :: as) [ fs n ]= e = a :: (as [ n ]= e) [] [ () ]= e listEq : {A : Set} -> (A -> A -> Bool) -> List A -> List A -> Bool listEq _ [] [] = true listEq _==_ (a :: as) (b :: bs) with a == b ... | true = listEq _==_ as bs ... | false = false listEq _ _ _ = false tail : {A : Set} -> List A -> List A tail [] = [] tail (x :: xs) = xs reverse : {A : Set} -> List A -> List A reverse [] = [] reverse (x :: xs) = reverse xs ++ (x :: []) init : {A : Set} -> List A -> List A init xs = reverse (tail (reverse xs)) filter : {A : Set} -> (A -> Bool) -> List A -> List A filter p [] = [] filter p (a :: as) with p a ... | true = a :: filter p as ... | false = filter p as
{ "alphanum_fraction": 0.4635076253, "avg_line_length": 24.48, "ext": "agda", "hexsha": "52704b6415551eb49064fe265550c26e80408b2b", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "redfish64/autonomic-agda", "max_forks_repo_path": "test/epic/Prelude/List.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "redfish64/autonomic-agda", "max_issues_repo_path": "test/epic/Prelude/List.agda", "max_line_length": 69, "max_stars_count": null, "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_path": "test/epic/Prelude/List.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 707, "size": 1836 }
{-# OPTIONS --without-K --safe #-} -- Monoidal natural isomorphisms between lax and strong braided -- monoidal functors. -- -- NOTE. Braided monoidal natural isomorphisms are really just -- monoidal natural isomorphisms that happen to go between braided -- monoidal functors. No additional conditions are necessary. -- Nevertheless, the definitions in this module are useful when one is -- working in a braided monoidal setting. They also help Agda's type -- checker by bundling the (braided monoidal) categories and functors -- involved. module Categories.NaturalTransformation.NaturalIsomorphism.Monoidal.Braided where open import Level open import Relation.Binary using (IsEquivalence) open import Categories.Category.Monoidal using (BraidedMonoidalCategory) import Categories.Functor.Monoidal.Braided as BMF open import Categories.Functor.Monoidal.Properties using () renaming ( idF-BraidedMonoidal to idFˡ ; idF-StrongBraidedMonoidal to idFˢ ; ∘-BraidedMonoidal to _∘Fˡ_ ; ∘-StrongBraidedMonoidal to _∘Fˢ_ ) open import Categories.NaturalTransformation.NaturalIsomorphism as NI using (NaturalIsomorphism) import Categories.NaturalTransformation.NaturalIsomorphism.Monoidal as MNI module Lax where open BMF.Lax using (BraidedMonoidalFunctor) open MNI.Lax using (IsMonoidalNaturalIsomorphism) open BraidedMonoidalFunctor using () renaming (F to UF; monoidalFunctor to MF) private module U = MNI.Lax module _ {o ℓ e o′ ℓ′ e′} {C : BraidedMonoidalCategory o ℓ e} {D : BraidedMonoidalCategory o′ ℓ′ e′} where -- Monoidal natural isomorphisms between lax braided monoidal functors. record BraidedMonoidalNaturalIsomorphism (F G : BraidedMonoidalFunctor C D) : Set (o ⊔ ℓ ⊔ ℓ′ ⊔ e′) where field U : NaturalIsomorphism (UF F) (UF G) F⇒G-isMonoidal : IsMonoidalNaturalIsomorphism (MF F) (MF G) U ⌊_⌋ : U.MonoidalNaturalIsomorphism (MF F) (MF G) ⌊_⌋ = record { U = U ; F⇒G-isMonoidal = F⇒G-isMonoidal } open U.MonoidalNaturalIsomorphism ⌊_⌋ public hiding (U; F⇒G-isMonoidal) infix 4 _≃_ _≃_ = BraidedMonoidalNaturalIsomorphism -- "Strengthening" ⌈_⌉ : {F G : BraidedMonoidalFunctor C D} → U.MonoidalNaturalIsomorphism (MF F) (MF G) → F ≃ G ⌈ α ⌉ = record { U = U ; F⇒G-isMonoidal = F⇒G-isMonoidal } where open U.MonoidalNaturalIsomorphism α open BraidedMonoidalNaturalIsomorphism -- Identity and compositions infixr 9 _ⓘᵥ_ id : {F : BraidedMonoidalFunctor C D} → F ≃ F id = ⌈ U.id ⌉ _ⓘᵥ_ : {F G H : BraidedMonoidalFunctor C D} → G ≃ H → F ≃ G → F ≃ H α ⓘᵥ β = ⌈ ⌊ α ⌋ U.ⓘᵥ ⌊ β ⌋ ⌉ isEquivalence : IsEquivalence _≃_ isEquivalence = record { refl = id ; sym = λ α → record { U = NI.sym (U α) ; F⇒G-isMonoidal = F⇐G-isMonoidal α } ; trans = λ α β → β ⓘᵥ α } where open BraidedMonoidalNaturalIsomorphism module _ {o ℓ e o′ ℓ′ e′ o″ ℓ″ e″} {C : BraidedMonoidalCategory o ℓ e} {D : BraidedMonoidalCategory o′ ℓ′ e′} {E : BraidedMonoidalCategory o″ ℓ″ e″} where infixr 9 _ⓘₕ_ _ⓘˡ_ _ⓘʳ_ _ⓘₕ_ : {F G : BraidedMonoidalFunctor C D} {H I : BraidedMonoidalFunctor D E} → H ≃ I → F ≃ G → (H ∘Fˡ F) ≃ (I ∘Fˡ G) -- NOTE: this definition is clearly equivalent to -- -- α ⓘₕ β = ⌈ ⌊ α ⌋ U.ⓘₕ ⌊ β ⌋ ⌉ -- -- but the latter takes an unreasonably long time to typecheck, -- while the unfolded version typechecks almost immediately. α ⓘₕ β = record { U = C.U ; F⇒G-isMonoidal = record { ε-compat = C.ε-compat ; ⊗-homo-compat = C.⊗-homo-compat } } where module C = U.MonoidalNaturalIsomorphism (⌊ α ⌋ U.ⓘₕ ⌊ β ⌋) _ⓘˡ_ : {F G : BraidedMonoidalFunctor C D} (H : BraidedMonoidalFunctor D E) → F ≃ G → (H ∘Fˡ F) ≃ (H ∘Fˡ G) H ⓘˡ α = id {F = H} ⓘₕ α _ⓘʳ_ : {G H : BraidedMonoidalFunctor D E} → G ≃ H → (F : BraidedMonoidalFunctor C D) → (G ∘Fˡ F) ≃ (H ∘Fˡ F) α ⓘʳ F = α ⓘₕ id {F = F} -- Left and right unitors. module _ {o ℓ e o′ ℓ′ e′} {C : BraidedMonoidalCategory o ℓ e} {D : BraidedMonoidalCategory o′ ℓ′ e′} {F : BraidedMonoidalFunctor C D} where -- NOTE: Again, manual expansion seems necessary to type check in -- reasonable time. unitorˡ : idFˡ D ∘Fˡ F ≃ F unitorˡ = record { U = LU.U ; F⇒G-isMonoidal = record { ε-compat = LU.ε-compat ; ⊗-homo-compat = LU.⊗-homo-compat } } where module LU = U.MonoidalNaturalIsomorphism (U.unitorˡ {F = MF F}) unitorʳ : F ∘Fˡ idFˡ C ≃ F unitorʳ = record { U = RU.U ; F⇒G-isMonoidal = record { ε-compat = RU.ε-compat ; ⊗-homo-compat = RU.⊗-homo-compat } } where module RU = U.MonoidalNaturalIsomorphism (U.unitorʳ {F = MF F}) -- Associator. module _ {o ℓ e o′ ℓ′ e′ o″ ℓ″ e″ o‴ ℓ‴ e‴} {B : BraidedMonoidalCategory o ℓ e} {C : BraidedMonoidalCategory o′ ℓ′ e′} {D : BraidedMonoidalCategory o″ ℓ″ e″} {E : BraidedMonoidalCategory o‴ ℓ‴ e‴} {F : BraidedMonoidalFunctor B C} {G : BraidedMonoidalFunctor C D} {H : BraidedMonoidalFunctor D E} where -- NOTE: Again, manual expansion seems necessary to type check in -- reasonable time. associator : (H ∘Fˡ G) ∘Fˡ F ≃ H ∘Fˡ (G ∘Fˡ F) associator = record { U = AU.U ; F⇒G-isMonoidal = record { ε-compat = AU.ε-compat ; ⊗-homo-compat = AU.⊗-homo-compat } } where module AU = U.MonoidalNaturalIsomorphism (U.associator {F = MF F} {MF G} {MF H}) module Strong where open BMF.Strong using (BraidedMonoidalFunctor) open MNI.Strong using (IsMonoidalNaturalIsomorphism) open BraidedMonoidalFunctor using () renaming ( F to UF ; monoidalFunctor to MF ; laxBraidedMonoidalFunctor to laxBMF ) private module U = MNI.Strong module _ {o ℓ e o′ ℓ′ e′} {C : BraidedMonoidalCategory o ℓ e} {D : BraidedMonoidalCategory o′ ℓ′ e′} where -- Monoidal natural isomorphisms between strong braided monoidal functors. record BraidedMonoidalNaturalIsomorphism (F G : BraidedMonoidalFunctor C D) : Set (o ⊔ ℓ ⊔ ℓ′ ⊔ e′) where field U : NaturalIsomorphism (UF F) (UF G) F⇒G-isMonoidal : IsMonoidalNaturalIsomorphism (MF F) (MF G) U ⌊_⌋ : U.MonoidalNaturalIsomorphism (MF F) (MF G) ⌊_⌋ = record { U = U ; F⇒G-isMonoidal = F⇒G-isMonoidal } laxBNI : Lax.BraidedMonoidalNaturalIsomorphism (laxBMF F) (laxBMF G) laxBNI = record { U = U ; F⇒G-isMonoidal = F⇒G-isMonoidal } open Lax.BraidedMonoidalNaturalIsomorphism laxBNI public hiding (U; F⇒G-isMonoidal; ⌊_⌋) infix 4 _≃_ _≃_ = BraidedMonoidalNaturalIsomorphism -- "Strengthening" ⌈_⌉ : {F G : BraidedMonoidalFunctor C D} → U.MonoidalNaturalIsomorphism (MF F) (MF G) → F ≃ G ⌈ α ⌉ = record { U = U ; F⇒G-isMonoidal = F⇒G-isMonoidal } where open U.MonoidalNaturalIsomorphism α open BraidedMonoidalNaturalIsomorphism -- Identity and compositions infixr 9 _ⓘᵥ_ id : {F : BraidedMonoidalFunctor C D} → F ≃ F id = ⌈ U.id ⌉ _ⓘᵥ_ : {F G H : BraidedMonoidalFunctor C D} → G ≃ H → F ≃ G → F ≃ H α ⓘᵥ β = ⌈ ⌊ α ⌋ U.ⓘᵥ ⌊ β ⌋ ⌉ isEquivalence : IsEquivalence _≃_ isEquivalence = record { refl = id ; sym = λ α → record { U = NI.sym (U α) ; F⇒G-isMonoidal = F⇐G-isMonoidal α } ; trans = λ α β → β ⓘᵥ α } where open BraidedMonoidalNaturalIsomorphism module _ {o ℓ e o′ ℓ′ e′ o″ ℓ″ e″} {C : BraidedMonoidalCategory o ℓ e} {D : BraidedMonoidalCategory o′ ℓ′ e′} {E : BraidedMonoidalCategory o″ ℓ″ e″} where infixr 9 _ⓘₕ_ _ⓘˡ_ _ⓘʳ_ _ⓘₕ_ : {F G : BraidedMonoidalFunctor C D} {H I : BraidedMonoidalFunctor D E} → H ≃ I → F ≃ G → (H ∘Fˢ F) ≃ (I ∘Fˢ G) -- NOTE: this definition is clearly equivalent to -- -- α ⓘₕ β = ⌈ ⌊ α ⌋ U.ⓘₕ ⌊ β ⌋ ⌉ -- -- but the latter takes an unreasonably long time to typecheck, -- while the unfolded version typechecks almost immediately. α ⓘₕ β = record { U = C.U ; F⇒G-isMonoidal = record { ε-compat = C.ε-compat ; ⊗-homo-compat = C.⊗-homo-compat } } where module C = U.MonoidalNaturalIsomorphism (⌊ α ⌋ U.ⓘₕ ⌊ β ⌋) _ⓘˡ_ : {F G : BraidedMonoidalFunctor C D} (H : BraidedMonoidalFunctor D E) → F ≃ G → (H ∘Fˢ F) ≃ (H ∘Fˢ G) H ⓘˡ α = id {F = H} ⓘₕ α _ⓘʳ_ : {G H : BraidedMonoidalFunctor D E} → G ≃ H → (F : BraidedMonoidalFunctor C D) → (G ∘Fˢ F) ≃ (H ∘Fˢ F) α ⓘʳ F = α ⓘₕ id {F = F} -- Left and right unitors. module _ {o ℓ e o′ ℓ′ e′} {C : BraidedMonoidalCategory o ℓ e} {D : BraidedMonoidalCategory o′ ℓ′ e′} {F : BraidedMonoidalFunctor C D} where -- NOTE: Again, manual expansion seems necessary to type check in -- reasonable time. unitorˡ : idFˢ D ∘Fˢ F ≃ F unitorˡ = record { U = LU.U ; F⇒G-isMonoidal = record { ε-compat = LU.ε-compat ; ⊗-homo-compat = LU.⊗-homo-compat } } where module LU = U.MonoidalNaturalIsomorphism (U.unitorˡ {F = MF F}) unitorʳ : F ∘Fˢ idFˢ C ≃ F unitorʳ = record { U = RU.U ; F⇒G-isMonoidal = record { ε-compat = RU.ε-compat ; ⊗-homo-compat = RU.⊗-homo-compat } } where module RU = U.MonoidalNaturalIsomorphism (U.unitorʳ {F = MF F}) -- Associator. module _ {o ℓ e o′ ℓ′ e′ o″ ℓ″ e″ o‴ ℓ‴ e‴} {B : BraidedMonoidalCategory o ℓ e} {C : BraidedMonoidalCategory o′ ℓ′ e′} {D : BraidedMonoidalCategory o″ ℓ″ e″} {E : BraidedMonoidalCategory o‴ ℓ‴ e‴} {F : BraidedMonoidalFunctor B C} {G : BraidedMonoidalFunctor C D} {H : BraidedMonoidalFunctor D E} where -- NOTE: Again, manual expansion seems necessary to type check in -- reasonable time. associator : (H ∘Fˢ G) ∘Fˢ F ≃ H ∘Fˢ (G ∘Fˢ F) associator = record { U = AU.U ; F⇒G-isMonoidal = record { ε-compat = AU.ε-compat ; ⊗-homo-compat = AU.⊗-homo-compat } } where module AU = U.MonoidalNaturalIsomorphism (U.associator {F = MF F} {MF G} {MF H})
{ "alphanum_fraction": 0.5800797552, "avg_line_length": 32.5770392749, "ext": "agda", "hexsha": "dc639fb4abbc7f08ee0c2cc64d6a6b60c0435dd1", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "5fc007768264a270b8ff319570225986773da601", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "o1lo01ol1o/agda-categories", "max_forks_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Monoidal/Braided.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "5fc007768264a270b8ff319570225986773da601", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "o1lo01ol1o/agda-categories", "max_issues_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Monoidal/Braided.agda", "max_line_length": 80, "max_stars_count": null, "max_stars_repo_head_hexsha": "5fc007768264a270b8ff319570225986773da601", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "o1lo01ol1o/agda-categories", "max_stars_repo_path": "src/Categories/NaturalTransformation/NaturalIsomorphism/Monoidal/Braided.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 3991, "size": 10783 }
module Bool where data Bool : Set where true : Bool false : Bool {-# BUILTIN BOOL Bool #-} {-# BUILTIN TRUE true #-} {-# BUILTIN FALSE false #-}
{ "alphanum_fraction": 0.608974359, "avg_line_length": 15.6, "ext": "agda", "hexsha": "1ed7f786a85901ad4c75427a0f01d8d07191e3aa", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "76743baacba0f07992bac5234ba8045d18706893", "max_forks_repo_licenses": [ "Apache-2.0" ], "max_forks_repo_name": "mjhopkins/PowerOfPi", "max_forks_repo_path": "Bool.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "76743baacba0f07992bac5234ba8045d18706893", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "Apache-2.0" ], "max_issues_repo_name": "mjhopkins/PowerOfPi", "max_issues_repo_path": "Bool.agda", "max_line_length": 27, "max_stars_count": 1, "max_stars_repo_head_hexsha": "76743baacba0f07992bac5234ba8045d18706893", "max_stars_repo_licenses": [ "Apache-2.0" ], "max_stars_repo_name": "mjhopkins/PowerOfPi", "max_stars_repo_path": "Bool.agda", "max_stars_repo_stars_event_max_datetime": "2018-07-25T13:12:15.000Z", "max_stars_repo_stars_event_min_datetime": "2018-07-25T13:12:15.000Z", "num_tokens": 43, "size": 156 }
{-# OPTIONS --sized-types #-} open import Relation.Binary.Core module SelectSort {A : Set} (_≤_ : A → A → Set) (tot≤ : Total _≤_) where open import Data.List open import Data.Product open import Data.Sum open import Size open import SList open import SList.Order _≤_ select : {ι : Size} → A → SList A {ι} → A × SList A {ι} select x snil = (x , snil) select x (y ∙ ys) with tot≤ x y ... | inj₁ x≤y with select x ys select x (y ∙ ys) | inj₁ x≤y | (z , zs) = (z , y ∙ zs) select x (y ∙ ys) | inj₂ y≤x with select y ys select x (y ∙ ys) | inj₂ y≤x | (z , zs) = (z , x ∙ zs) selectSort : {ι : Size} → SList A {ι} → SList A {ι} selectSort snil = snil selectSort (x ∙ xs) with select x xs ... | (y , ys) = y ∙ (selectSort ys)
{ "alphanum_fraction": 0.5599489796, "avg_line_length": 25.2903225806, "ext": "agda", "hexsha": "ce2bfa5f1dd162215019bea1130537f74663d5d0", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "bgbianchi/sorting", "max_forks_repo_path": "agda/SelectSort.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "bgbianchi/sorting", "max_issues_repo_path": "agda/SelectSort.agda", "max_line_length": 56, "max_stars_count": 6, "max_stars_repo_head_hexsha": "b8d428bccbdd1b13613e8f6ead6c81a8f9298399", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "bgbianchi/sorting", "max_stars_repo_path": "agda/SelectSort.agda", "max_stars_repo_stars_event_max_datetime": "2021-08-24T22:11:15.000Z", "max_stars_repo_stars_event_min_datetime": "2015-05-21T12:50:35.000Z", "num_tokens": 294, "size": 784 }
{-# OPTIONS --without-K --safe #-} module Categories.Category.Instance.Monoidals where open import Level open import Categories.Category open import Categories.Category.Helper open import Categories.Category.Monoidal open import Categories.Functor.Monoidal open import Categories.Functor.Monoidal.Properties open import Categories.NaturalTransformation.NaturalIsomorphism module _ o ℓ e where Monoidals : Category (suc (o ⊔ ℓ ⊔ e)) (o ⊔ ℓ ⊔ e) (o ⊔ ℓ ⊔ e) Monoidals = categoryHelper record { Obj = MonoidalCategory o ℓ e ; _⇒_ = MonoidalFunctor ; _≈_ = λ F G → M.F F ≃ M.F G ; id = idF-Monoidal _ ; _∘_ = ∘-Monoidal ; assoc = λ {_ _ _ _ F G H} → associator (M.F F) (M.F G) (M.F H) ; identityˡ = unitorˡ ; identityʳ = unitorʳ ; equiv = record { refl = ≃.refl ; sym = ≃.sym ; trans = ≃.trans } ; ∘-resp-≈ = _ⓘₕ_ } where module M = MonoidalFunctor StrongMonoidals : Category (suc (o ⊔ ℓ ⊔ e)) (o ⊔ ℓ ⊔ e) (o ⊔ ℓ ⊔ e) StrongMonoidals = categoryHelper record { Obj = MonoidalCategory o ℓ e ; _⇒_ = StrongMonoidalFunctor ; _≈_ = λ F G → M.F F ≃ M.F G ; id = idF-StrongMonoidal _ ; _∘_ = ∘-StrongMonoidal ; assoc = λ {_ _ _ _ F G H} → associator (M.F F) (M.F G) (M.F H) ; identityˡ = unitorˡ ; identityʳ = unitorʳ ; equiv = record { refl = ≃.refl ; sym = ≃.sym ; trans = ≃.trans } ; ∘-resp-≈ = _ⓘₕ_ } where module M = StrongMonoidalFunctor
{ "alphanum_fraction": 0.5694356373, "avg_line_length": 29.7547169811, "ext": "agda", "hexsha": "49d38a4ad33b350897fb224483c3bfc744f02f8e", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_forks_event_min_datetime": "2021-11-04T06:54:45.000Z", "max_forks_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "bblfish/agda-categories", "max_forks_repo_path": "src/Categories/Category/Instance/Monoidals.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "bblfish/agda-categories", "max_issues_repo_path": "src/Categories/Category/Instance/Monoidals.agda", "max_line_length": 72, "max_stars_count": 5, "max_stars_repo_head_hexsha": "7672b7a3185ae77467cc30e05dbe50b36ff2af8a", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "bblfish/agda-categories", "max_stars_repo_path": "src/Categories/Category/Instance/Monoidals.agda", "max_stars_repo_stars_event_max_datetime": "2020-10-10T21:41:32.000Z", "max_stars_repo_stars_event_min_datetime": "2020-10-07T12:07:53.000Z", "num_tokens": 570, "size": 1577 }
{-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module LogicalFramework.Disjunction where module LF where postulate _∨_ : Set → Set → Set inj₁ : {A B : Set} → A → A ∨ B inj₂ : {A B : Set} → B → A ∨ B case : {A B C : Set} → (A → C) → (B → C) → A ∨ B → C ∨-comm : {A B : Set} → A ∨ B → B ∨ A ∨-comm = case inj₂ inj₁ module Inductive where open import Common.FOL.FOL ∨-comm-el : {A B : Set} → A ∨ B → B ∨ A ∨-comm-el = case inj₂ inj₁ ∨-comm : {A B : Set} → A ∨ B → B ∨ A ∨-comm (inj₁ a) = inj₂ a ∨-comm (inj₂ b) = inj₁ b
{ "alphanum_fraction": 0.4926900585, "avg_line_length": 24.4285714286, "ext": "agda", "hexsha": "ae53e908d7b804df376fab56e493fe41b95edd49", "lang": "Agda", "max_forks_count": 3, "max_forks_repo_forks_event_max_datetime": "2018-03-14T08:50:00.000Z", "max_forks_repo_forks_event_min_datetime": "2016-09-19T14:18:30.000Z", "max_forks_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "asr/fotc", "max_forks_repo_path": "notes/thesis/report/LogicalFramework/Disjunction.agda", "max_issues_count": 2, "max_issues_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_issues_repo_issues_event_max_datetime": "2017-01-01T14:34:26.000Z", "max_issues_repo_issues_event_min_datetime": "2016-10-12T17:28:16.000Z", "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "asr/fotc", "max_issues_repo_path": "notes/thesis/report/LogicalFramework/Disjunction.agda", "max_line_length": 56, "max_stars_count": 11, "max_stars_repo_head_hexsha": "2fc9f2b81052a2e0822669f02036c5750371b72d", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/fotc", "max_stars_repo_path": "notes/thesis/report/LogicalFramework/Disjunction.agda", "max_stars_repo_stars_event_max_datetime": "2021-09-12T16:09:54.000Z", "max_stars_repo_stars_event_min_datetime": "2015-09-03T20:53:42.000Z", "num_tokens": 267, "size": 684 }
------------------------------------------------------------------------ -- A type soundness result ------------------------------------------------------------------------ {-# OPTIONS --sized-types #-} module Lambda.Delay-monad.Type-soundness where open import Equality.Propositional open import Prelude open import Prelude.Size open import Function-universe equality-with-J open import Maybe equality-with-J open import Monad equality-with-J open import Vec.Function equality-with-J open import Delay-monad.Always open import Delay-monad.Bisimilarity open import Delay-monad.Monad open import Lambda.Delay-monad.Interpreter open import Lambda.Syntax open Closure Tm -- If we can prove □ ∞ (WF-MV σ) (run x), then x does not "go wrong". does-not-go-wrong : ∀ {σ} {x : M ∞ Value} → □ ∞ (WF-MV σ) (run x) → ¬ x ≈M fail does-not-go-wrong (now {x = nothing} ()) does-not-go-wrong (now {x = just x} x-wf) () does-not-go-wrong (later x-wf) (laterˡ x↯) = does-not-go-wrong (force x-wf) x↯ -- A "constructor" for □ i ∘ WF-MV. _>>=-wf_ : ∀ {i σ τ} {x : M ∞ Value} {f : Value → M ∞ Value} → □ i (WF-MV σ) (run x) → (∀ {v} → WF-Value σ v → □ i (WF-MV τ) (run (f v))) → □ i (WF-MV τ) (MaybeT.run (x >>= f)) x-wf >>=-wf f-wf = □->>= x-wf λ { {nothing} () ; {just v} v-wf → f-wf v-wf } -- Well-typed programs do not "go wrong". mutual ⟦⟧-wf : ∀ {i n Γ} (t : Tm n) {σ} → Γ ⊢ t ∈ σ → ∀ {ρ} → WF-Env Γ ρ → □ i (WF-MV σ) (run (⟦ t ⟧ ρ)) ⟦⟧-wf (con i) con ρ-wf = now con ⟦⟧-wf (var x) var ρ-wf = now (ρ-wf x) ⟦⟧-wf (ƛ t) (ƛ t∈) ρ-wf = now (ƛ t∈ ρ-wf) ⟦⟧-wf (t₁ · t₂) (t₁∈ · t₂∈) {ρ} ρ-wf = ⟦⟧-wf t₁ t₁∈ ρ-wf >>=-wf λ f-wf → ⟦⟧-wf t₂ t₂∈ ρ-wf >>=-wf λ v-wf → ∙-wf f-wf v-wf ∙-wf : ∀ {i σ τ f v} → WF-Value (σ ⇾ τ) f → WF-Value (force σ) v → □ i (WF-MV (force τ)) (run (f ∙ v)) ∙-wf (ƛ t₁∈ ρ₁-wf) v₂-wf = later λ { .force → ⟦⟧-wf _ t₁∈ (cons-wf v₂-wf ρ₁-wf) } type-soundness : ∀ {t : Tm 0} {σ} → nil ⊢ t ∈ σ → ¬ ⟦ t ⟧ nil ≈M fail type-soundness {t} {σ} = nil ⊢ t ∈ σ ↝⟨ (λ t∈ → ⟦⟧-wf _ t∈ nil-wf) ⟩ □ ∞ (WF-MV σ) (run (⟦ t ⟧ nil)) ↝⟨ does-not-go-wrong ⟩□ ¬ ⟦ t ⟧ nil ≈M fail □
{ "alphanum_fraction": 0.4745030251, "avg_line_length": 30.8533333333, "ext": "agda", "hexsha": "53a401ee354687dbd57ed58c8e6d6362c86a2744", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "f69749280969f9093e5e13884c6feb0ad2506eae", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "nad/partiality-monad", "max_forks_repo_path": "src/Lambda/Delay-monad/Type-soundness.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "f69749280969f9093e5e13884c6feb0ad2506eae", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "nad/partiality-monad", "max_issues_repo_path": "src/Lambda/Delay-monad/Type-soundness.agda", "max_line_length": 72, "max_stars_count": 2, "max_stars_repo_head_hexsha": "f69749280969f9093e5e13884c6feb0ad2506eae", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "nad/partiality-monad", "max_stars_repo_path": "src/Lambda/Delay-monad/Type-soundness.agda", "max_stars_repo_stars_event_max_datetime": "2020-07-03T08:56:08.000Z", "max_stars_repo_stars_event_min_datetime": "2020-05-21T22:59:18.000Z", "num_tokens": 938, "size": 2314 }
module _ where module Test₁ where postulate id : {X : Set} → X → X A : Set x : A record S : Set where field a : A postulate B : S → Set record T : Set where field s : S b : B s -- Agda hangs here t : T t = λ { .T.s .S.a → x ; .T.b → id {!!} } module Test₂ where postulate id : (X : Set) → X → X A : Set B : A → Set x : A record T : Set where field a : A b : B a -- Agda hangs here t : T t = λ { .T.a → x ; .T.b → id {!!} {!!} }
{ "alphanum_fraction": 0.4095744681, "avg_line_length": 12, "ext": "agda", "hexsha": "b79089bde3c685d5916ad7185016d78d56bea19e", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "231d6ad8e77b67ff8c4b1cb35a6c31ccd988c3e9", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "Agda-zh/agda", "max_forks_repo_path": "test/interaction/Issue3004.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "shlevy/agda", "max_issues_repo_path": "test/interaction/Issue3004.agda", "max_line_length": 26, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "shlevy/agda", "max_stars_repo_path": "test/interaction/Issue3004.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 222, "size": 564 }
{-# OPTIONS --cubical --safe #-} module Data.Maybe.Sugar where open import Prelude open import Data.Maybe _>>=_ : Maybe A → (A → Maybe B) → Maybe B nothing >>= f = nothing just x >>= f = f x pure : A → Maybe A pure = just _<*>_ : Maybe (A → B) → Maybe A → Maybe B nothing <*> xs = nothing just f <*> nothing = nothing just f <*> just x = just (f x)
{ "alphanum_fraction": 0.604519774, "avg_line_length": 18.6315789474, "ext": "agda", "hexsha": "3d9b73c12b25f7bf1931226fc56a0f6402dd3f4b", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "oisdk/combinatorics-paper", "max_forks_repo_path": "agda/Data/Maybe/Sugar.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "oisdk/combinatorics-paper", "max_issues_repo_path": "agda/Data/Maybe/Sugar.agda", "max_line_length": 41, "max_stars_count": null, "max_stars_repo_head_hexsha": "3c176d4690566d81611080e9378f5a178b39b851", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "oisdk/combinatorics-paper", "max_stars_repo_path": "agda/Data/Maybe/Sugar.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 108, "size": 354 }
------------------------------------------------------------------------ -- The Agda standard library -- -- Automatic solvers for equations over booleans ------------------------------------------------------------------------ -- See README.Nat for examples of how to use similar solvers {-# OPTIONS --without-K --safe #-} module Data.Bool.Solver where import Algebra.Solver.Ring.Simple as Solver import Algebra.Solver.Ring.AlmostCommutativeRing as ACR open import Data.Bool using (_≟_) open import Data.Bool.Properties ------------------------------------------------------------------------ -- A module for automatically solving propositional equivalences -- containing _∨_ and _∧_ module ∨-∧-Solver = Solver (ACR.fromCommutativeSemiring ∨-∧-commutativeSemiring) _≟_ ------------------------------------------------------------------------ -- A module for automatically solving propositional equivalences -- containing _xor_ and _∧_ module xor-∧-Solver = Solver (ACR.fromCommutativeRing xor-∧-commutativeRing) _≟_
{ "alphanum_fraction": 0.5515564202, "avg_line_length": 33.1612903226, "ext": "agda", "hexsha": "59239d2bfb4590f3c574c14326a4560a522bf7c8", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Data/Bool/Solver.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Data/Bool/Solver.agda", "max_line_length": 72, "max_stars_count": null, "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Data/Bool/Solver.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 208, "size": 1028 }
module WithInParModule (A : Set) where data Nat : Set where zero : Nat suc : Nat -> Nat data Bool : Set where true : Bool false : Bool isZero : Nat -> Bool isZero zero = true isZero (suc _) = false f : Nat -> Nat f n with isZero n f n | true = zero f n | false = suc zero g : Nat -> Nat g zero = zero g (suc n) with g n g (suc n) | zero = n g (suc n) | suc _ = n data T : Set where tt : T module A (x : T) where h : T h with x h | y = y postulate C : T -> Set test : C (A.h tt) -> C tt test x = x
{ "alphanum_fraction": 0.5681818182, "avg_line_length": 12.8780487805, "ext": "agda", "hexsha": "f83941e0b44b474d13f89c59ce470b31259a2ea8", "lang": "Agda", "max_forks_count": 1, "max_forks_repo_forks_event_max_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_forks_event_min_datetime": "2022-03-12T11:35:18.000Z", "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "masondesu/agda", "max_forks_repo_path": "test/succeed/WithInParModule.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "masondesu/agda", "max_issues_repo_path": "test/succeed/WithInParModule.agda", "max_line_length": 38, "max_stars_count": 1, "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_path": "test/succeed/WithInParModule.agda", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "num_tokens": 206, "size": 528 }
module Issue348 where import Common.Irrelevance data _==_ {A : Set1}(a : A) : A -> Set where refl : a == a record R : Set1 where constructor mkR field .fromR : Set reflR : (r : R) -> r == r reflR r = refl {a = _} -- issue: unsolved metavars resolved 2010-10-15 by making eta-expansion -- more lazy (do not eta expand all meta variable listeners, see MetaVars.hs
{ "alphanum_fraction": 0.6631299735, "avg_line_length": 23.5625, "ext": "agda", "hexsha": "18508e4172c1b1c83a8e65f05c70c783c69c8d90", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "masondesu/agda", "max_forks_repo_path": "test/succeed/Issue348.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "70c8a575c46f6a568c7518150a1a64fcd03aa437", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "masondesu/agda", "max_issues_repo_path": "test/succeed/Issue348.agda", "max_line_length": 76, "max_stars_count": 1, "max_stars_repo_head_hexsha": "aa10ae6a29dc79964fe9dec2de07b9df28b61ed5", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "asr/agda-kanso", "max_stars_repo_path": "test/succeed/Issue348.agda", "max_stars_repo_stars_event_max_datetime": "2019-11-27T04:41:05.000Z", "max_stars_repo_stars_event_min_datetime": "2019-11-27T04:41:05.000Z", "num_tokens": 124, "size": 377 }
module Cats.End where open import Level using (_⊔_) open import Cats.Category open import Cats.Category.Wedges using (Wedge ; Wedges) open import Cats.Profunctor module _ {lo la l≈ lo′ la′ l≈′} {C : Category lo la l≈} {D : Category lo′ la′ l≈′} where IsEnd : {F : Profunctor C C D} → Wedge F → Set (lo ⊔ la ⊔ lo′ ⊔ la′ ⊔ l≈′) IsEnd {F} = Wdg.IsTerminal where module Wdg = Category (Wedges F) record End (F : Profunctor C C D) : Set (lo ⊔ la ⊔ lo′ ⊔ la′ ⊔ l≈′) where field wedge : Wedge F isEnd : IsEnd wedge
{ "alphanum_fraction": 0.609800363, "avg_line_length": 22.9583333333, "ext": "agda", "hexsha": "4d4a582aaa8ba1d1e9bf9e4b44b6305cd2b69ce8", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "alessio-b-zak/cats", "max_forks_repo_path": "Cats/End.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "alessio-b-zak/cats", "max_issues_repo_path": "Cats/End.agda", "max_line_length": 76, "max_stars_count": null, "max_stars_repo_head_hexsha": "a3b69911c4c6ec380ddf6a0f4510d3a755734b86", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "alessio-b-zak/cats", "max_stars_repo_path": "Cats/End.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 206, "size": 551 }
------------------------------------------------------------------------ -- The Agda standard library -- -- An example of how Algebra.IdempotentCommutativeMonoidSolver can be -- used ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Algebra.Solver.IdempotentCommutativeMonoid.Example where open import Relation.Binary.PropositionalEquality using (_≡_) open import Data.Bool.Base using (_∨_) open import Data.Bool.Properties using (∨-idempotentCommutativeMonoid) open import Data.Fin using (zero; suc) open import Data.Vec using ([]; _∷_) open import Algebra.Solver.IdempotentCommutativeMonoid ∨-idempotentCommutativeMonoid test : ∀ x y z → (x ∨ y) ∨ (x ∨ z) ≡ (z ∨ y) ∨ x test a b c = let _∨_ = _⊕_ in prove 3 ((x ∨ y) ∨ (x ∨ z)) ((z ∨ y) ∨ x) (a ∷ b ∷ c ∷ []) where x = var zero y = var (suc zero) z = var (suc (suc zero))
{ "alphanum_fraction": 0.5693832599, "avg_line_length": 30.2666666667, "ext": "agda", "hexsha": "f46af32d2b251a55dfb4666696ea4704b8a7097a", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "omega12345/agda-mode", "max_forks_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Solver/IdempotentCommutativeMonoid/Example.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "omega12345/agda-mode", "max_issues_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Solver/IdempotentCommutativeMonoid/Example.agda", "max_line_length": 72, "max_stars_count": null, "max_stars_repo_head_hexsha": "0debb886eb5dbcd38dbeebd04b34cf9d9c5e0e71", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "omega12345/agda-mode", "max_stars_repo_path": "test/asset/agda-stdlib-1.0/Algebra/Solver/IdempotentCommutativeMonoid/Example.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 270, "size": 908 }
{-# OPTIONS --allow-unsolved-metas #-} open import Agda.Builtin.Equality open import Agda.Builtin.List postulate A : Set nilA : A consA : A → List A → A w/e : {x y : A} → x ≡ y data D : List A → Set where nil : D [] cons : (x : A) (xs : List A) → D (x ∷ xs) foo : ∀ {xs} (d : D xs) (let f : D xs → A f = λ where nil → nilA (cons y ys) → consA y ys) → f d ≡ nilA foo nil = {!!} foo (cons _ _) = w/e
{ "alphanum_fraction": 0.4715789474, "avg_line_length": 21.5909090909, "ext": "agda", "hexsha": "a157f0b6d69709a08cb23ab91e499a55e86db89f", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "shlevy/agda", "max_forks_repo_path": "test/Succeed/Issue4528.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "shlevy/agda", "max_issues_repo_path": "test/Succeed/Issue4528.agda", "max_line_length": 50, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "ed8ac6f4062ea8a20fa0f62d5db82d4e68278338", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "shlevy/agda", "max_stars_repo_path": "test/Succeed/Issue4528.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 175, "size": 475 }
{-# OPTIONS --without-K --exact-split --safe #-} module mwe where open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) public -------------------------------------------------------------------------------- data ℕ : Set lzero where zero-ℕ : ℕ succ-ℕ : ℕ → ℕ add-ℕ : ℕ → ℕ → ℕ add-ℕ x zero-ℕ = x add-ℕ x (succ-ℕ y) = succ-ℕ (add-ℕ x y) {- The following function returns the triangular numbers. In other words, test-with n = (1/2) * n * (n+1) -} test-with-1 : ℕ → ℕ test-with-1 x with x test-with-1 zero-ℕ | y = y test-with-1 (succ-ℕ x) | y = add-ℕ y (test-with-1 x) {- Now we construct a function with manual with-abstraction, of which the definition *looks* the same. But actually we will have test-with-2 n = n * (n+1). -} cases-test-with-2 : ℕ → ℕ → ℕ cases-test-with-2 zero-ℕ y = y cases-test-with-2 (succ-ℕ x) y = add-ℕ y (cases-test-with-2 x y) test-with-2 : ℕ → ℕ test-with-2 x = cases-test-with-2 x x {- The following function test-with-3 is again the same as test-with-1. -} cases-test-with-3 : ℕ → ℕ → ℕ cases-test-with-3 zero-ℕ y = y cases-test-with-3 (succ-ℕ x) zero-ℕ = zero-ℕ cases-test-with-3 (succ-ℕ x) (succ-ℕ y) = add-ℕ (succ-ℕ y) (cases-test-with-3 x y) test-with-3 : ℕ → ℕ test-with-3 x = cases-test-with-3 x x -- test-with-1 (succ-ℕ (succ-ℕ (succ-ℕ (succ-ℕ zero-ℕ)))) -- test-with-2 (succ-ℕ (succ-ℕ (succ-ℕ (succ-ℕ zero-ℕ)))) -- test-with-3 (succ-ℕ (succ-ℕ (succ-ℕ (succ-ℕ zero-ℕ)))) -- We do some basic setup, introducing only what we need. All else is removed. id : {i : Level} {A : Set i} → A → A id a = a data empty : Set lzero where ex-falso : {i : Level} {A : Set i} → empty → A ex-falso () ¬ : {i : Level} → Set i → Set i ¬ A = A → empty data unit : Set lzero where star : unit data coprod {i j : Level} (A : Set i) (B : Set j) : Set (i ⊔ j) where inl : A → coprod A B inr : B → coprod A B is-decidable : {l : Level} (A : Set l) → Set l is-decidable A = coprod A (¬ A) data Id {i : Level} {A : Set i} (x : A) : A → Set i where refl : Id x x _∙_ : {i : Level} {A : Set i} {x y z : A} → Id x y → Id y z → Id x z refl ∙ q = q inv : {i : Level} {A : Set i} {x y : A} → Id x y → Id y x inv refl = refl ap : {i j : Level} {A : Set i} {B : Set j} (f : A → B) {x y : A} (p : Id x y) → Id (f x) (f y) ap f refl = refl -------------------------------------------------------------------------------- -- We introduce the finite types Fin : ℕ → Set lzero Fin zero-ℕ = empty Fin (succ-ℕ k) = coprod (Fin k) unit Eq-Fin : (k : ℕ) → Fin k → Fin k → Set lzero Eq-Fin (succ-ℕ k) (inl x) (inl y) = Eq-Fin k x y Eq-Fin (succ-ℕ k) (inl x) (inr y) = empty Eq-Fin (succ-ℕ k) (inr x) (inl y) = empty Eq-Fin (succ-ℕ k) (inr x) (inr y) = unit eq-Eq-Fin : {k : ℕ} {x y : Fin k} → Eq-Fin k x y → Id x y eq-Eq-Fin {succ-ℕ k} {inl x} {inl y} e = ap inl (eq-Eq-Fin e) eq-Eq-Fin {succ-ℕ k} {inr star} {inr star} star = refl is-decidable-Eq-Fin : (k : ℕ) (x y : Fin k) → is-decidable (Eq-Fin k x y) is-decidable-Eq-Fin (succ-ℕ k) (inl x) (inl y) = is-decidable-Eq-Fin k x y is-decidable-Eq-Fin (succ-ℕ k) (inl x) (inr y) = inr id is-decidable-Eq-Fin (succ-ℕ k) (inr x) (inl y) = inr id is-decidable-Eq-Fin (succ-ℕ k) (inr x) (inr y) = inl star -------------------------------------------------------------------------------- -- We now study the successor and predecessor functions on Fin k zero-Fin : {k : ℕ} → Fin (succ-ℕ k) zero-Fin {zero-ℕ} = inr star zero-Fin {succ-ℕ k} = inl zero-Fin neg-one-Fin : {k : ℕ} → Fin (succ-ℕ k) neg-one-Fin {k} = inr star succ-Fin : {k : ℕ} → Fin k → Fin k succ-Fin {succ-ℕ zero-ℕ} x = x succ-Fin {succ-ℕ (succ-ℕ k)} (inl (inl x)) = inl (succ-Fin (inl x)) succ-Fin {succ-ℕ (succ-ℕ k)} (inl (inr x)) = neg-one-Fin succ-Fin {succ-ℕ (succ-ℕ k)} (inr x) = zero-Fin succ-neg-one-Fin : {k : ℕ} → Id (succ-Fin (neg-one-Fin {k})) zero-Fin succ-neg-one-Fin {zero-ℕ} = refl succ-neg-one-Fin {succ-ℕ k} = refl pred-Fin' : {k : ℕ} → Fin k → Fin k pred-Fin' {succ-ℕ k} x with (is-decidable-Eq-Fin (succ-ℕ k) x zero-Fin) pred-Fin' {succ-ℕ zero-ℕ} (inr star) | d = zero-Fin pred-Fin' {succ-ℕ (succ-ℕ k)} (inl x) | inl e = neg-one-Fin pred-Fin' {succ-ℕ (succ-ℕ k)} (inl x) | inr f = inl (pred-Fin' {succ-ℕ k} x) pred-Fin' {succ-ℕ (succ-ℕ k)} (inr x) | inr f = inl neg-one-Fin succ-pred-Fin' : {k : ℕ} (x : Fin k) → Id (succ-Fin (pred-Fin' x)) x succ-pred-Fin' {succ-ℕ k} x with is-decidable-Eq-Fin (succ-ℕ k) x zero-Fin succ-pred-Fin' {succ-ℕ zero-ℕ} (inr star) | d = refl succ-pred-Fin' {succ-ℕ (succ-ℕ k)} (inl x) | inl e = succ-neg-one-Fin ∙ inv (eq-Eq-Fin e) succ-pred-Fin' {succ-ℕ (succ-ℕ zero-ℕ)} (inl (inr star)) | inr f = ex-falso (f star) succ-pred-Fin' {succ-ℕ (succ-ℕ (succ-ℕ k))} (inl (inl x)) | inr f = {!!} ∙ ap inl (succ-pred-Fin' {succ-ℕ (succ-ℕ k)} (inl x)) succ-pred-Fin' {succ-ℕ (succ-ℕ (succ-ℕ k))} (inl (inr star)) | inr f = refl succ-pred-Fin' {succ-ℕ (succ-ℕ k)} (inr star) | inr f = refl
{ "alphanum_fraction": 0.5593978845, "avg_line_length": 31.3121019108, "ext": "agda", "hexsha": "5d2fc4c486dce1c29d5a88c0231647764f67bb1c", "lang": "Agda", "max_forks_count": 30, "max_forks_repo_forks_event_max_datetime": "2022-03-16T00:33:50.000Z", "max_forks_repo_forks_event_min_datetime": "2018-09-26T09:08:57.000Z", "max_forks_repo_head_hexsha": "1e1f8def50f9359928e52ebb2ee53ed1166487d9", "max_forks_repo_licenses": [ "CC-BY-4.0" ], "max_forks_repo_name": "UlrikBuchholtz/HoTT-Intro", "max_forks_repo_path": "Agda/mwe.agda", "max_issues_count": 8, "max_issues_repo_head_hexsha": "1e1f8def50f9359928e52ebb2ee53ed1166487d9", "max_issues_repo_issues_event_max_datetime": "2020-10-16T15:27:01.000Z", "max_issues_repo_issues_event_min_datetime": "2019-06-18T04:16:04.000Z", "max_issues_repo_licenses": [ "CC-BY-4.0" ], "max_issues_repo_name": "UlrikBuchholtz/HoTT-Intro", "max_issues_repo_path": "Agda/mwe.agda", "max_line_length": 80, "max_stars_count": 333, "max_stars_repo_head_hexsha": "1e1f8def50f9359928e52ebb2ee53ed1166487d9", "max_stars_repo_licenses": [ "CC-BY-4.0" ], "max_stars_repo_name": "UlrikBuchholtz/HoTT-Intro", "max_stars_repo_path": "Agda/mwe.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-22T23:50:15.000Z", "max_stars_repo_stars_event_min_datetime": "2018-09-26T08:33:30.000Z", "num_tokens": 2107, "size": 4916 }
-- Andreas, 2012-09-13 -- (The signature on the previous line does not apply to all of the -- text in this file.) module RelevanceSubtyping where -- this naturally type-checks: one : {A B : Set} → (.A → B) → A → B one f x = f x -- Subtyping is no longer supported for irrelevance, so the following -- code is no longer accepted. -- -- this type-checks because of subtyping -- one' : {A B : Set} → (.A → B) → A → B -- one' f = f
{ "alphanum_fraction": 0.6450116009, "avg_line_length": 26.9375, "ext": "agda", "hexsha": "ca39b34ff95708dd6ac0710b9641355456fb2a86", "lang": "Agda", "max_forks_count": 371, "max_forks_repo_forks_event_max_datetime": "2022-03-30T19:00:30.000Z", "max_forks_repo_forks_event_min_datetime": "2015-01-03T14:04:08.000Z", "max_forks_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_forks_repo_licenses": [ "BSD-2-Clause" ], "max_forks_repo_name": "cagix/agda", "max_forks_repo_path": "test/Succeed/RelevanceSubtyping.agda", "max_issues_count": 4066, "max_issues_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:14:49.000Z", "max_issues_repo_issues_event_min_datetime": "2015-01-10T11:24:51.000Z", "max_issues_repo_licenses": [ "BSD-2-Clause" ], "max_issues_repo_name": "cagix/agda", "max_issues_repo_path": "test/Succeed/RelevanceSubtyping.agda", "max_line_length": 69, "max_stars_count": 1989, "max_stars_repo_head_hexsha": "cc026a6a97a3e517bb94bafa9d49233b067c7559", "max_stars_repo_licenses": [ "BSD-2-Clause" ], "max_stars_repo_name": "cagix/agda", "max_stars_repo_path": "test/Succeed/RelevanceSubtyping.agda", "max_stars_repo_stars_event_max_datetime": "2022-03-30T18:20:48.000Z", "max_stars_repo_stars_event_min_datetime": "2015-01-09T23:51:16.000Z", "num_tokens": 134, "size": 431 }
{-# OPTIONS --without-K --safe #-} module Definition.Typed.EqualityRelation where open import Definition.Untyped open import Definition.Typed open import Definition.Typed.Weakening using (_∷_⊆_) -- Generic equality relation used with the logical relation record EqRelSet : Set₁ where constructor eqRel field --------------- -- Relations -- --------------- -- Equality of types _⊢_≅_ : Con Term → (A B : Term) → Set -- Equality of terms _⊢_≅_∷_ : Con Term → (t u A : Term) → Set -- Equality of neutral terms _⊢_~_∷_ : Con Term → (t u A : Term) → Set ---------------- -- Properties -- ---------------- -- Generic equality compatibility ~-to-≅ₜ : ∀ {k l A Γ} → Γ ⊢ k ~ l ∷ A → Γ ⊢ k ≅ l ∷ A -- Judgmental conversion compatibility ≅-eq : ∀ {A B Γ} → Γ ⊢ A ≅ B → Γ ⊢ A ≡ B ≅ₜ-eq : ∀ {t u A Γ} → Γ ⊢ t ≅ u ∷ A → Γ ⊢ t ≡ u ∷ A -- Universe ≅-univ : ∀ {A B Γ} → Γ ⊢ A ≅ B ∷ U → Γ ⊢ A ≅ B -- Symmetry ≅-sym : ∀ {A B Γ} → Γ ⊢ A ≅ B → Γ ⊢ B ≅ A ≅ₜ-sym : ∀ {t u A Γ} → Γ ⊢ t ≅ u ∷ A → Γ ⊢ u ≅ t ∷ A ~-sym : ∀ {k l A Γ} → Γ ⊢ k ~ l ∷ A → Γ ⊢ l ~ k ∷ A -- Transitivity ≅-trans : ∀ {A B C Γ} → Γ ⊢ A ≅ B → Γ ⊢ B ≅ C → Γ ⊢ A ≅ C ≅ₜ-trans : ∀ {t u v A Γ} → Γ ⊢ t ≅ u ∷ A → Γ ⊢ u ≅ v ∷ A → Γ ⊢ t ≅ v ∷ A ~-trans : ∀ {k l m A Γ} → Γ ⊢ k ~ l ∷ A → Γ ⊢ l ~ m ∷ A → Γ ⊢ k ~ m ∷ A -- Conversion ≅-conv : ∀ {t u A B Γ} → Γ ⊢ t ≅ u ∷ A → Γ ⊢ A ≡ B → Γ ⊢ t ≅ u ∷ B ~-conv : ∀ {k l A B Γ} → Γ ⊢ k ~ l ∷ A → Γ ⊢ A ≡ B → Γ ⊢ k ~ l ∷ B -- Weakening ≅-wk : ∀ {A B ρ Γ Δ} → ρ ∷ Δ ⊆ Γ → ⊢ Δ → Γ ⊢ A ≅ B → Δ ⊢ wk ρ A ≅ wk ρ B ≅ₜ-wk : ∀ {t u A ρ Γ Δ} → ρ ∷ Δ ⊆ Γ → ⊢ Δ → Γ ⊢ t ≅ u ∷ A → Δ ⊢ wk ρ t ≅ wk ρ u ∷ wk ρ A ~-wk : ∀ {k l A ρ Γ Δ} → ρ ∷ Δ ⊆ Γ → ⊢ Δ → Γ ⊢ k ~ l ∷ A → Δ ⊢ wk ρ k ~ wk ρ l ∷ wk ρ A -- Weak head expansion ≅-red : ∀ {A A′ B B′ Γ} → Γ ⊢ A ⇒* A′ → Γ ⊢ B ⇒* B′ → Whnf A′ → Whnf B′ → Γ ⊢ A′ ≅ B′ → Γ ⊢ A ≅ B ≅ₜ-red : ∀ {a a′ b b′ A B Γ} → Γ ⊢ A ⇒* B → Γ ⊢ a ⇒* a′ ∷ B → Γ ⊢ b ⇒* b′ ∷ B → Whnf B → Whnf a′ → Whnf b′ → Γ ⊢ a′ ≅ b′ ∷ B → Γ ⊢ a ≅ b ∷ A -- Universe type reflexivity ≅-Urefl : ∀ {Γ} → ⊢ Γ → Γ ⊢ U ≅ U -- Natural number type reflexivity ≅-ℕrefl : ∀ {Γ} → ⊢ Γ → Γ ⊢ ℕ ≅ ℕ ≅ₜ-ℕrefl : ∀ {Γ} → ⊢ Γ → Γ ⊢ ℕ ≅ ℕ ∷ U -- Π-congurence ≅-Π-cong : ∀ {F G H E Γ} → Γ ⊢ F → Γ ⊢ F ≅ H → Γ ∙ F ⊢ G ≅ E → Γ ⊢ Π F ▹ G ≅ Π H ▹ E ≅ₜ-Π-cong : ∀ {F G H E Γ} → Γ ⊢ F → Γ ⊢ F ≅ H ∷ U → Γ ∙ F ⊢ G ≅ E ∷ U → Γ ⊢ Π F ▹ G ≅ Π H ▹ E ∷ U -- Zero reflexivity ≅ₜ-zerorefl : ∀ {Γ} → ⊢ Γ → Γ ⊢ zero ≅ zero ∷ ℕ -- Successor congurence ≅-suc-cong : ∀ {m n Γ} → Γ ⊢ m ≅ n ∷ ℕ → Γ ⊢ suc m ≅ suc n ∷ ℕ -- η-equality ≅-η-eq : ∀ {f g F G Γ} → Γ ⊢ F → Γ ⊢ f ∷ Π F ▹ G → Γ ⊢ g ∷ Π F ▹ G → Function f → Function g → Γ ∙ F ⊢ wk1 f ∘ var 0 ≅ wk1 g ∘ var 0 ∷ G → Γ ⊢ f ≅ g ∷ Π F ▹ G -- Variable reflexivity ~-var : ∀ {x A Γ} → Γ ⊢ var x ∷ A → Γ ⊢ var x ~ var x ∷ A -- Application congurence ~-app : ∀ {a b f g F G Γ} → Γ ⊢ f ~ g ∷ Π F ▹ G → Γ ⊢ a ≅ b ∷ F → Γ ⊢ f ∘ a ~ g ∘ b ∷ G [ a ] -- Natural recursion congurence ~-natrec : ∀ {z z′ s s′ n n′ F F′ Γ} → Γ ∙ ℕ ⊢ F ≅ F′ → Γ ⊢ z ≅ z′ ∷ F [ zero ] → Γ ⊢ s ≅ s′ ∷ Π ℕ ▹ (F ▹▹ F [ suc (var 0) ]↑) → Γ ⊢ n ~ n′ ∷ ℕ → Γ ⊢ natrec F z s n ~ natrec F′ z′ s′ n′ ∷ F [ n ] -- Composition of universe and generic equality compatibility ~-to-≅ : ∀ {k l Γ} → Γ ⊢ k ~ l ∷ U → Γ ⊢ k ≅ l ~-to-≅ k~l = ≅-univ (~-to-≅ₜ k~l)
{ "alphanum_fraction": 0.340588376, "avg_line_length": 26.4620253165, "ext": "agda", "hexsha": "cec013b4aa7a041abf725f72c0ec94cc1510f742", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "max_forks_repo_licenses": [ "MIT" ], "max_forks_repo_name": "loic-p/logrel-mltt", "max_forks_repo_path": "Definition/Typed/EqualityRelation.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "MIT" ], "max_issues_repo_name": "loic-p/logrel-mltt", "max_issues_repo_path": "Definition/Typed/EqualityRelation.agda", "max_line_length": 76, "max_stars_count": null, "max_stars_repo_head_hexsha": "2251b8da423be0c6fb916f2675d7bd8537e4cd96", "max_stars_repo_licenses": [ "MIT" ], "max_stars_repo_name": "loic-p/logrel-mltt", "max_stars_repo_path": "Definition/Typed/EqualityRelation.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 1857, "size": 4181 }
module Agda.Builtin.FromNeg where open import Agda.Primitive open import Agda.Builtin.Nat record Negative {a} (A : Set a) : Set (lsuc a) where field Constraint : Nat → Set a fromNeg : ∀ n → {{_ : Constraint n}} → A open Negative {{...}} public using (fromNeg) {-# BUILTIN FROMNEG fromNeg #-} {-# DISPLAY Negative.fromNeg _ n = fromNeg n #-}
{ "alphanum_fraction": 0.6601123596, "avg_line_length": 22.25, "ext": "agda", "hexsha": "f0af710f6af07c052fed7a5c9db2014042e751fb", "lang": "Agda", "max_forks_count": null, "max_forks_repo_forks_event_max_datetime": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_forks_repo_licenses": [ "BSD-3-Clause" ], "max_forks_repo_name": "redfish64/autonomic-agda", "max_forks_repo_path": "src/data/lib/prim/Agda/Builtin/FromNeg.agda", "max_issues_count": null, "max_issues_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_issues_repo_issues_event_max_datetime": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_licenses": [ "BSD-3-Clause" ], "max_issues_repo_name": "redfish64/autonomic-agda", "max_issues_repo_path": "src/data/lib/prim/Agda/Builtin/FromNeg.agda", "max_line_length": 52, "max_stars_count": null, "max_stars_repo_head_hexsha": "c0ae7d20728b15d7da4efff6ffadae6fe4590016", "max_stars_repo_licenses": [ "BSD-3-Clause" ], "max_stars_repo_name": "redfish64/autonomic-agda", "max_stars_repo_path": "src/data/lib/prim/Agda/Builtin/FromNeg.agda", "max_stars_repo_stars_event_max_datetime": null, "max_stars_repo_stars_event_min_datetime": null, "num_tokens": 104, "size": 356 }