hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 163
values | lang
stringclasses 53
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
112
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
113
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
float64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
113
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 3
1.05M
| avg_line_length
float64 1
966k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dc0de19c50f032120db07b68521152fa0acb2df5
| 1,070
|
agda
|
Agda
|
part1/decidable/iff-erasure.agda
|
akiomik/plfa-solutions
|
df7722b88a9b3dfde320a690b78c4c1ef8c7c547
|
[
"Apache-2.0"
] | 1
|
2020-07-07T09:42:22.000Z
|
2020-07-07T09:42:22.000Z
|
part1/decidable/iff-erasure.agda
|
akiomik/plfa-solutions
|
df7722b88a9b3dfde320a690b78c4c1ef8c7c547
|
[
"Apache-2.0"
] | null | null | null |
part1/decidable/iff-erasure.agda
|
akiomik/plfa-solutions
|
df7722b88a9b3dfde320a690b78c4c1ef8c7c547
|
[
"Apache-2.0"
] | null | null | null |
module iff-erasure where
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
open import Data.Empty using (⊥-elim)
-- open import plfa.part1.Isomorphism using (_⇔_)
open import decidable using (Dec; yes; no; Bool; true; false; ⌊_⌋)
-- 同値 (equivalence)
record _⇔_ (A B : Set) : Set where
field
to : A → B
from : B → A
open _⇔_
-- 必要十分条件 (if and only if)
_iff_ : Bool → Bool → Bool
true iff true = true
true iff false = false
false iff true = false
false iff false = true
-- 同値のdecidable
_⇔-dec_ : ∀ {A B : Set} → Dec A → Dec B → Dec (A ⇔ B)
yes a ⇔-dec yes b = yes record { to = λ _ → b ; from = λ _ → a }
yes a ⇔-dec no ¬b = no λ a⇔b → ¬b (to a⇔b a)
no ¬a ⇔-dec yes b = no λ a⇔b → ¬a (from a⇔b b)
no ¬a ⇔-dec no ¬b = yes record { to = λ a → ⊥-elim (¬a a) ; from = λ b → ⊥-elim (¬b b) }
-- erasureを使うことで真偽値の必要十分条件とdecidableの同値が等しくなることの証明
iff-⇔ : ∀ {A B : Set} (x : Dec A) (y : Dec B) → ⌊ x ⌋ iff ⌊ y ⌋ ≡ ⌊ x ⇔-dec y ⌋
iff-⇔ (yes a) (yes b) = refl
iff-⇔ (yes a) (no b) = refl
iff-⇔ (no a) (yes b) = refl
iff-⇔ (no a) (no b) = refl
| 30.571429
| 88
| 0.584112
|
34e1daa952f89f7e35b0049e5f65fd3c62d4e10f
| 146
|
agda
|
Agda
|
test/Succeed/Issue2981.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/Issue2981.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/Issue2981.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
record Unit : Set where
constructor tt
postulate
C : Set
c : C
g : C
f : Unit → C
f tt = c
record R : Set where
constructor r
g = c
| 8.111111
| 23
| 0.59589
|
21a35f0732321cf595522119889a1247d8086286
| 1,831
|
agda
|
Agda
|
src/Util/Vec.agda
|
JLimperg/msc-thesis-code
|
104cddc6b65386c7e121c13db417aebfd4b7a863
|
[
"MIT"
] | 5
|
2021-04-13T21:31:17.000Z
|
2021-06-26T06:37:31.000Z
|
src/Util/Vec.agda
|
JLimperg/msc-thesis-code
|
104cddc6b65386c7e121c13db417aebfd4b7a863
|
[
"MIT"
] | null | null | null |
src/Util/Vec.agda
|
JLimperg/msc-thesis-code
|
104cddc6b65386c7e121c13db417aebfd4b7a863
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K --safe #-}
module Util.Vec where
open import Data.Vec public
open import Data.Vec.Relation.Unary.All as All public using (All ; [] ; _∷_)
open import Data.Vec.Relation.Unary.Any as Any public using (Any ; here ; there)
open import Data.Vec.Membership.Propositional public using (_∈_)
open import Data.Nat as ℕ using (_≤_)
open import Level using (_⊔_)
open import Relation.Binary using (Rel)
open import Util.Prelude
import Data.Nat.Properties as ℕ
max : ∀ {n} → Vec ℕ n → ℕ
max = foldr _ ℕ._⊔_ 0
max-weaken : ∀ {n} x (xs : Vec ℕ n) → max xs ≤ max (x ∷ xs)
max-weaken _ _ = ℕ.n≤m⊔n _ _
max-maximal : ∀ {n} (xs : Vec ℕ n) → All (_≤ max xs) xs
max-maximal [] = []
max-maximal (x ∷ xs)
= ℕ.m≤m⊔n _ _
∷ All.map (λ x≤max → ℕ.≤-trans x≤max (max-weaken x xs)) (max-maximal xs)
All→∈→P : ∀ {α β} {A : Set α} {P : A → Set β} {n} {xs : Vec A n}
→ All P xs
→ ∀ {x}
→ x ∈ xs
→ P x
All→∈→P (px ∷ allP) (here refl) = px
All→∈→P (px ∷ allP) (there x∈xs) = All→∈→P allP x∈xs
max-maximal-∈ : ∀ {n x} {xs : Vec ℕ n} → x ∈ xs → x ≤ max xs
max-maximal-∈ = All→∈→P (max-maximal _)
data All₂ {α} {A : Set α} {ρ} (R : Rel A ρ)
: ∀ {n} → Vec A n → Vec A n → Set (α ⊔ ρ) where
[] : All₂ R [] []
_∷_ : ∀ {n x y} {xs ys : Vec A n}
→ R x y
→ All₂ R xs ys
→ All₂ R (x ∷ xs) (y ∷ ys)
All₂-tabulate⁺ : ∀ {α} {A : Set α} {ρ} {R : Rel A ρ} {n} {f g : Fin n → A}
→ (∀ x → R (f x) (g x))
→ All₂ R (tabulate f) (tabulate g)
All₂-tabulate⁺ {n = zero} p = []
All₂-tabulate⁺ {n = suc n} p = p zero ∷ All₂-tabulate⁺ (λ x → p (suc x))
All₂-tabulate⁻ : ∀ {α} {A : Set α} {ρ} {R : Rel A ρ} {n} {f g : Fin n → A}
→ All₂ R (tabulate f) (tabulate g)
→ ∀ x → R (f x) (g x)
All₂-tabulate⁻ [] ()
All₂-tabulate⁻ (fzRgz ∷ all) zero = fzRgz
All₂-tabulate⁻ (fzRgz ∷ all) (suc x) = All₂-tabulate⁻ all x
| 26.926471
| 80
| 0.554888
|
7c07456542a4fb9b978319c3418ec525794ca884
| 335
|
agda
|
Agda
|
test/Fail/Issue5058.agda
|
cagix/agda
|
cc026a6a97a3e517bb94bafa9d49233b067c7559
|
[
"BSD-2-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/Issue5058.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/Issue5058.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
postulate
I : Set
data Box (A : Set) : Set where
[_] : A → Box A
variable
@0 i : I
@0 b : Box I
data D : @0 Box I → Set where
d : D [ i ] → D [ i ]
variable
@0 x : D b
data P : @0 D b → Set where
p : P (d x)
works : ∀ {i} {@0 x : D [ i ]} → P (d x)
works = p
fails : ∀ {@0 i} {@0 x : D [ i ]} → P (d x)
fails = p
| 12.884615
| 43
| 0.444776
|
35ecf410ca0f2bd1fa64816ceb2394828e56fdad
| 12,261
|
agda
|
Agda
|
src/Univalence-axiom/Isomorphism-is-equality/More/Examples.agda
|
nad/equality
|
402b20615cfe9ca944662380d7b2d69b0f175200
|
[
"MIT"
] | 3
|
2020-05-21T22:58:50.000Z
|
2021-09-02T17:18:15.000Z
|
src/Univalence-axiom/Isomorphism-is-equality/More/Examples.agda
|
nad/equality
|
402b20615cfe9ca944662380d7b2d69b0f175200
|
[
"MIT"
] | null | null | null |
src/Univalence-axiom/Isomorphism-is-equality/More/Examples.agda
|
nad/equality
|
402b20615cfe9ca944662380d7b2d69b0f175200
|
[
"MIT"
] | null | null | null |
------------------------------------------------------------------------
-- Examples related to Univalence-axiom.Isomorphism-is-equality.More
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
-- Note that this module uses ordinary propositional equality, with a
-- computing J rule.
-- This module has been developed in collaboration with Thierry
-- Coquand.
module Univalence-axiom.Isomorphism-is-equality.More.Examples where
open import Equality.Propositional renaming (equality-with-J to eq)
open import Equivalence eq hiding (id)
open import Function-universe eq hiding (id)
open import H-level.Closure eq
open import Prelude hiding (id)
open import Univalence-axiom.Isomorphism-is-equality.More
------------------------------------------------------------------------
-- Magmas
magma : Code
magma = ε ▻ A-type ▻ N-ary [0] 2
Magma : Type₁
Magma = ⟦ magma ⟧
private
-- An unfolding of Magma.
Magma-unfolded :
Magma ≡ Σ (Σ (↑ _ ⊤) λ _ →
Type ) λ { (_ , A) →
↑ _ A → ↑ _ A → ↑ _ A }
Magma-unfolded = refl
-- An unfolding of Isomorphic magma.
Isomorphic-magma-unfolded :
∀ {ass A₁ f₁ A₂ f₂} →
Isomorphic ass magma ((_ , A₁) , f₁) ((_ , A₂) , f₂) ≡
Σ (Σ (↑ _ ⊤) λ _ →
↑ _ (A₁ ≃ A₂) ) λ { (_ , lift A₁≃A₂) →
let open _≃_ (↑-cong A₁≃A₂) in
∀ x y → to (f₁ x y) ≡ f₂ (to x) (to y) }
Isomorphic-magma-unfolded = refl
------------------------------------------------------------------------
-- Semigroups
-- Note that one axiom states that the underlying type is a set. This
-- assumption is used to prove that the other axiom is propositional.
semigroup : Code
semigroup =
ε
▻ A-type
▻ Is-a-set [0]
▻ N-ary (1+ [0]) 2
▻ Proposition
(λ { (_ , _∙_) →
∀ x y z → (x ∙ (y ∙ z)) ≡ ((x ∙ y) ∙ z) })
assoc-prop
where
assoc-prop = λ { ass ((_ , A-set) , _) →
let open Assumptions ass in
Π-closure ext₁ 1 λ _ →
Π-closure ext₁ 1 λ _ →
Π-closure ext₁ 1 λ _ →
A-set }
Semigroup : Type₁
Semigroup = ⟦ semigroup ⟧
private
-- An unfolding of Semigroup.
Semigroup-unfolded :
Semigroup ≡ Σ (Σ (Σ (Σ (↑ _ ⊤) λ _ →
Type ) λ { (_ , A) →
Is-set (↑ _ A) }) λ { ((_ , A) , _) →
↑ _ A → ↑ _ A → ↑ _ A }) λ { (_ , _∙_) →
∀ x y z → (x ∙ (y ∙ z)) ≡ ((x ∙ y) ∙ z) }
Semigroup-unfolded = refl
-- An unfolding of Isomorphic semigroup.
Isomorphic-semigroup-unfolded :
∀ {ass A₁} {is₁ : Is-set (↑ _ A₁)} {_∙₁_ assoc₁}
{A₂} {is₂ : Is-set (↑ _ A₂)} {_∙₂_ assoc₂} →
Isomorphic ass semigroup ((((_ , A₁) , is₁) , _∙₁_) , assoc₁)
((((_ , A₂) , is₂) , _∙₂_) , assoc₂) ≡
Σ (Σ (Σ (Σ (↑ _ ⊤) λ _ →
↑ _ (A₁ ≃ A₂) ) λ { _ →
↑ _ ⊤ }) λ { ((_ , lift A₁≃A₂) , _) →
let open _≃_ (↑-cong A₁≃A₂) in
∀ x y → to (x ∙₁ y) ≡ (to x ∙₂ to y) }) λ { _ →
↑ _ ⊤ }
Isomorphic-semigroup-unfolded = refl
------------------------------------------------------------------------
-- Sets with fixed-point operators
set-with-fixed-point-operator : Code
set-with-fixed-point-operator =
ε
▻ A-type
▻ Is-a-set [0]
▻ Simple ((base (1+ [0]) ⟶ base (1+ [0])) ⟶ base (1+ [0]))
▻ Proposition
(λ { (_ , fix) →
∀ f → fix f ≡ f (fix f) })
fix-point-prop
where
fix-point-prop = λ { ass ((_ , A-set) , _) →
let open Assumptions ass in
Π-closure ext₁ 1 λ _ →
A-set }
Set-with-fixed-point-operator : Type₁
Set-with-fixed-point-operator = ⟦ set-with-fixed-point-operator ⟧
private
-- An unfolding of Set-with-fixed-point-operator.
Set-with-fixed-point-operator-unfolded :
Set-with-fixed-point-operator ≡ Σ (Σ (Σ (Σ (↑ _ ⊤) λ _ →
Type ) λ { (_ , A) →
Is-set (↑ _ A) }) λ { ((_ , A) , _) →
(↑ _ A → ↑ _ A) → ↑ _ A }) λ { (_ , fix) →
∀ f → fix f ≡ f (fix f) }
Set-with-fixed-point-operator-unfolded = refl
-- An unfolding of Isomorphic set-with-fixed-point-operator.
Isomorphic-set-with-fixed-point-operator-unfolded :
∀ {ass A₁} {is₁ : Is-set (↑ _ A₁)} {fix₁ fixed-point₁}
{A₂} {is₂ : Is-set (↑ _ A₂)} {fix₂ fixed-point₂} →
Isomorphic ass set-with-fixed-point-operator
((((_ , A₁) , is₁) , fix₁) , fixed-point₁)
((((_ , A₂) , is₂) , fix₂) , fixed-point₂) ≡
Σ (Σ (Σ (Σ (↑ _ ⊤) λ _ →
↑ _ (A₁ ≃ A₂) ) λ { _ →
↑ _ ⊤ }) λ { ((_ , lift A₁≃A₂) , _) →
let open _≃_ (↑-cong A₁≃A₂) in
∀ f g →
(∀ x y → to x ≡ y → to (f x) ≡ g y) →
to (fix₁ f) ≡ fix₂ g }) λ { _ →
↑ _ ⊤ }
Isomorphic-set-with-fixed-point-operator-unfolded = refl
------------------------------------------------------------------------
-- Abelian groups
abelian-group : Code
abelian-group =
ε
-- The underlying type.
▻ A-type
-- The underlying type is a set.
▻ Is-a-set [0]
-- The binary group operation.
▻ N-ary (1+ [0]) 2
-- Commutativity.
▻ Comm
-- Associativity.
▻ Assoc
-- Identity.
▻ N-ary (1+ 1+ 1+ 1+ [0]) 0
-- Left identity.
▻ Left-identity
-- Right identity.
▻ Right-identity
-- Inverse.
▻ N-ary (1+ 1+ 1+ 1+ 1+ 1+ 1+ [0]) 1
-- Left inverse.
▻ Left-inverse
-- Right inverse.
▻ Right-inverse
where
Comm = Proposition
(λ { (_ , _∙_) →
∀ x y → (x ∙ y) ≡ (y ∙ x) })
(λ { ass ((_ , A-set) , _) →
let open Assumptions ass in
Π-closure ext₁ 1 λ _ →
Π-closure ext₁ 1 λ _ →
A-set
})
Assoc = Proposition
(λ { ((_ , _∙_) , _) →
∀ x y z → (x ∙ (y ∙ z)) ≡ ((x ∙ y) ∙ z) })
(λ { ass (((_ , A-set) , _) , _) →
let open Assumptions ass in
Π-closure ext₁ 1 λ _ →
Π-closure ext₁ 1 λ _ →
Π-closure ext₁ 1 λ _ →
A-set
})
Left-identity = Proposition
(λ { ((((_ , _∙_) , _) , _) , e) →
∀ x → (e ∙ x) ≡ x })
(λ { ass (((((_ , A-set) , _) , _) , _) , _) →
let open Assumptions ass in
Π-closure ext₁ 1 λ _ →
A-set
})
Right-identity = Proposition
(λ { (((((_ , _∙_) , _) , _) , e) , _) →
∀ x → (x ∙ e) ≡ x })
(λ { ass ((((((_ , A-set) , _) , _) , _) , _) , _) →
let open Assumptions ass in
Π-closure ext₁ 1 λ _ →
A-set
})
Left-inverse = Proposition
(λ { (((((((_ , _∙_) , _) , _) , e) , _) , _) , _⁻¹) →
∀ x → ((x ⁻¹) ∙ x) ≡ e })
(λ { ass ((((((((_ , A-set) , _) , _) , _) , _) , _) , _) , _) →
let open Assumptions ass in
Π-closure ext₁ 1 λ _ →
A-set
})
Right-inverse = Proposition
(λ { ((((((((_ , _∙_) , _) , _) , e) , _) , _) , _⁻¹) , _) →
∀ x → (x ∙ (x ⁻¹)) ≡ e })
(λ { ass (((((((((_ , A-set) , _) , _) , _) , _) , _) , _) , _) , _) →
let open Assumptions ass in
Π-closure ext₁ 1 λ _ →
A-set
})
Abelian-group : Type₁
Abelian-group = ⟦ abelian-group ⟧
private
-- An unfolding of Abelian-group. Note that the inner structure is
-- left-nested.
Abelian-group-unfolded :
Abelian-group ≡ Σ (Σ (Σ (Σ (Σ (Σ (Σ (Σ (Σ (Σ (Σ (↑ _ ⊤) λ _ →
Type ) λ { (_ , A) →
Is-set (↑ _ A) }) λ { ((_ , A) , _) →
↑ _ A → ↑ _ A → ↑ _ A }) λ { (_ , _∙_) →
∀ x y → (x ∙ y) ≡ (y ∙ x) }) λ { ((_ , _∙_) , _) →
∀ x y z → (x ∙ (y ∙ z)) ≡ ((x ∙ y) ∙ z) }) λ { (((((_ , A) , _) , _ ) , _) , _) →
↑ _ A }) λ { ((((_ , _∙_) , _) , _) , e) →
∀ x → (e ∙ x) ≡ x }) λ { (((((_ , _∙_) , _) , _) , e) , _) →
∀ x → (x ∙ e) ≡ x }) λ { ((((((((_ , A) , _) , _ ) , _) , _) , _) , _) , _) →
↑ _ A → ↑ _ A }) λ { (((((((_ , _∙_) , _) , _) , e) , _) , _) , _⁻¹) →
∀ x → ((x ⁻¹) ∙ x) ≡ e }) λ { ((((((((_ , _∙_) , _) , _) , e) , _) , _) , _⁻¹) , _) →
∀ x → (x ∙ (x ⁻¹)) ≡ e }
Abelian-group-unfolded = refl
-- An unfolding of Isomorphic abelian-group.
Isomorphic-abelian-group-unfolded :
∀ {ass A₁} {is₁ : Is-set (↑ _ A₁)}
{_∙₁_ comm₁ assoc₁ e₁ lid₁ rid₁ _⁻¹₁ linv₁ rinv₁}
{A₂} {is₂ : Is-set (↑ _ A₂)}
{_∙₂_ comm₂ assoc₂ e₂ lid₂ rid₂ _⁻¹₂ linv₂ rinv₂} →
Isomorphic ass abelian-group
(((((((((((_ , A₁) , is₁) , _∙₁_) , comm₁) ,
assoc₁) , e₁) , lid₁) , rid₁) , _⁻¹₁) , linv₁) , rinv₁)
(((((((((((_ , A₂) , is₂) , _∙₂_) , comm₂) ,
assoc₂) , e₂) , lid₂) , rid₂) , _⁻¹₂) , linv₂) , rinv₂) ≡
Σ (Σ (Σ (Σ (Σ (Σ (Σ (Σ (Σ (Σ (Σ (↑ _ ⊤) λ _ →
↑ _ (A₁ ≃ A₂) ) λ { _ →
↑ _ ⊤ }) λ { ((_ , lift A₁≃A₂) , _) →
let open _≃_ (↑-cong A₁≃A₂) in
∀ x y → to (x ∙₁ y) ≡ (to x ∙₂ to y) }) λ { _ →
↑ _ ⊤ }) λ { _ →
↑ _ ⊤ }) λ { (((((_ , lift A₁≃A₂) , _) , _) , _) , _) →
let open _≃_ (↑-cong A₁≃A₂) in
to e₁ ≡ e₂ }) λ { _ →
↑ _ ⊤ }) λ { _ →
↑ _ ⊤ }) λ { ((((((((_ , lift A₁≃A₂) , _) , _) , _) , _) , _) , _) , _) →
let open _≃_ (↑-cong A₁≃A₂) in
∀ x → to (x ⁻¹₁) ≡ (to x ⁻¹₂) }) λ { _ →
↑ _ ⊤ }) λ { _ →
↑ _ ⊤ }
Isomorphic-abelian-group-unfolded = refl
------------------------------------------------------------------------
-- Church-encoded natural numbers for which we can do induction
-- Church-encoded natural numbers.
Nat : Type₁
Nat = (A : Type) → ↑ (# 1) A → (↑ (# 1) A → ↑ (# 1) A) → ↑ (# 1) A
-- Zero and successor.
Zero : Nat
Zero = λ A z s → z
Suc : Nat → Nat
Suc = λ n A z s → s (n A z s)
-- The code.
inductive-natural-numbers : Code
inductive-natural-numbers =
ε
▻ Dep (Π set (Π (base ⟨0⟩)
(Π (Π (base (1+ ⟨0⟩)) (base (1+ 1+ ⟨0⟩)))
(base (1+ 1+ ⟨0⟩)))))
▻ Proposition
(λ { (_ , n) →
(P : Nat → Type) →
Is-proposition (P n) →
P Zero →
(∀ m → P m → P (Suc m)) →
P n })
(λ ass _ →
let open Assumptions ass in
Π-closure ext₁ 1 λ _ →
Π-closure (lower-extensionality (# 1) (# 0) ext₁) 1 λ Pn-prop →
Π-closure (lower-extensionality (# 1) (# 0) ext₁) 1 λ _ →
Π-closure (lower-extensionality (# 0) (# 1) ext₁) 1 λ _ →
Pn-prop)
where open Dependent
private
-- The usual unfolding lemmas.
⟦inductive-natural-numbers⟧ :
⟦ inductive-natural-numbers ⟧
≡
Σ (Σ (↑ _ ⊤) λ _ →
Nat ) λ { (_ , n) →
(P : Nat → Type) →
Is-proposition (P n) →
P Zero →
(∀ m → P m → P (Suc m)) →
P n }
⟦inductive-natural-numbers⟧ = refl
Isomorphic-inductive-natural-numbers :
∀ {ass : Assumptions}
{n₁ n₂ : Nat}
{prop₁ : (P : Nat → Type) → Is-proposition (P n₁) →
P Zero → (∀ m → P m → P (Suc m)) → P n₁}
{prop₂ : (P : Nat → Type) → Is-proposition (P n₂) →
P Zero → (∀ m → P m → P (Suc m)) → P n₂} →
Isomorphic ass inductive-natural-numbers
((_ , n₁) , prop₁) ((_ , n₂) , prop₂)
≡
Σ (Σ (↑ (# 1) ⊤) λ _ →
((A₁ A₂ : Type) → (A₁≃A₂ : ↑ (# 1) (A₁ ≃ A₂)) →
let cast = _≃_.from (↑-cong (lower A₁≃A₂)) in
(z₁ : ↑ (# 1) A₁) (z₂ : ↑ (# 1) A₂) →
z₁ ≡ cast z₂ →
(s₁ : ↑ (# 1) A₁ → ↑ (# 1) A₁) (s₂ : ↑ (# 1) A₂ → ↑ (# 1) A₂) →
(∀ n₁ n₂ → n₁ ≡ cast n₂ → s₁ n₁ ≡ cast (s₂ n₂)) →
n₁ A₁ z₁ s₁ ≡ cast (n₂ A₂ z₂ s₂))) λ _ →
↑ (# 1) ⊤
Isomorphic-inductive-natural-numbers = refl
| 30.125307
| 118
| 0.4069
|
52562ea1b6afab62fa8a237799c074af9deff7f6
| 9,997
|
agda
|
Agda
|
src/Prelude.agda
|
nad/equality
|
402b20615cfe9ca944662380d7b2d69b0f175200
|
[
"MIT"
] | 3
|
2020-05-21T22:58:50.000Z
|
2021-09-02T17:18:15.000Z
|
src/Prelude.agda
|
nad/equality
|
402b20615cfe9ca944662380d7b2d69b0f175200
|
[
"MIT"
] | null | null | null |
src/Prelude.agda
|
nad/equality
|
402b20615cfe9ca944662380d7b2d69b0f175200
|
[
"MIT"
] | null | null | null |
------------------------------------------------------------------------
-- A small prelude
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
-- Note that parts of Agda's standard library make use of the K rule.
module Prelude where
------------------------------------------------------------------------
-- Universes
-- Basic type universes and universe levels.
open import Agda.Primitive public
renaming (Set to Type)
using (Prop; Level; _⊔_; lzero; lsuc)
private
variable
a b c ℓ p : Level
@0 A A₁ A₂ B B₁ B₂ C D Whatever : Type a
@0 P Q R : A → Type p
-- Lifting.
record ↑ ℓ (A : Type a) : Type (a ⊔ ℓ) where
constructor lift
field lower : A
open ↑ public
------------------------------------------------------------------------
-- Strings
open import Agda.Builtin.String public using (String)
------------------------------------------------------------------------
-- The unit type
-- A variant of the unit type with η-equality.
open import Agda.Builtin.Unit public using (⊤; tt)
-- A variant without η-equality.
data Unit : Type where
unit : Unit
-- Block s is used to block unfolding (for performance reasons). The
-- string can be used to indicate what it is that is blocked.
Block : String → Type
Block _ = Unit
pattern ⊠ = unit
-- A function that can be used to locally block something.
block : (Unit → A) → A
block f = f ⊠
-- A function that can be used to unblock something.
unblock : (b : Unit) (@0 P : Unit → Type p) → P ⊠ → P b
unblock ⊠ _ p = p
------------------------------------------------------------------------
-- The empty type
data ⊥ {ℓ} : Type ℓ where
⊥-elim : ⊥ {ℓ = ℓ} → Whatever
⊥-elim ()
-- A version of the empty type that is not universe-polymorphic.
⊥₀ : Type
⊥₀ = ⊥
-- Negation.
infix 3 ¬_
¬_ : Type ℓ → Type ℓ
¬ P = P → ⊥₀
------------------------------------------------------------------------
-- Natural numbers
open import Agda.Builtin.Nat public
using (zero; suc; _+_; _*_)
renaming (Nat to ℕ; _-_ to _∸_)
-- Dependent eliminator.
ℕ-rec : P 0 → (∀ n → P n → P (suc n)) → ∀ n → P n
ℕ-rec z s zero = z
ℕ-rec z s (suc n) = s n (ℕ-rec z s n)
-- A non-recursive variant of ℕ-rec.
ℕ-case : P 0 → (∀ n → P (suc n)) → ∀ n → P n
ℕ-case z s = ℕ-rec z (λ n _ → s n)
-- Exponentiation.
infixr 8 _^_
_^_ : ℕ → ℕ → ℕ
m ^ zero = 1
m ^ suc n = m * m ^ n
-- Factorial.
infix 9 _!
_! : ℕ → ℕ
zero ! = 1
suc n ! = suc n * n !
-- Translation from natural numbers to levels.
# : ℕ → Level
# zero = lzero
# (suc n) = lsuc (# n)
------------------------------------------------------------------------
-- Combinators defined using only abstraction and application
infixr 9 _∘_
infixl 1 _on_
infixr 0 _$_
-- The identity function.
id : A → A
id x = x
-- Composition.
_∘_ :
{@0 B : A → Type b} {@0 C : {x : A} → B x → Type c} →
(∀ {x} (y : B x) → C y) → (g : (x : A) → B x) →
((x : A) → C (g x))
f ∘ g = λ x → f (g x)
-- "Equational" reasoning combinators.
infix -1 finally-→
infixr -2 step-→
-- For an explanation of why step-⇔ is defined in this way, see
-- Equality.step-≡.
step-→ : (@0 A : Type a) → (B → C) → (A → B) → A → C
step-→ _ f g = f ∘ g
syntax step-→ A B→C A→B = A →⟨ A→B ⟩ B→C
finally-→ : (@0 A : Type a) (@0 B : Type b) → (A → B) → A → B
finally-→ _ _ A→B = A→B
syntax finally-→ A B A→B = A →⟨ A→B ⟩□ B □
-- Application.
_$_ :
{@0 B : A → Type b} →
((x : A) → B x) → ((x : A) → B x)
f $ x = f x
-- Constant functions.
const : A → (B → A)
const x = λ _ → x
{-# DISPLAY const x y = x #-}
-- Flips the first two arguments.
flip :
{@0 C : A → B → Type c} →
((x : A) (y : B) → C x y) → ((y : B) (x : A) → C x y)
flip f = λ x y → f y x
-- Applies the unary function to each argument and combines the
-- results using the binary function.
_on_ :
{@0 C : B → B → Type c} →
((x y : B) → C x y) →
(f : A → B) →
((x y : A) → C (f x) (f y))
_*_ on f = λ x y → f x * f y
-- A term's type.
Type-of : {A : Type a} → A → Type a
Type-of {A = A} _ = A
-- Type signatures.
infix 0 type-signature
type-signature : (@0 A : Type a) → A → A
type-signature _ a = a
syntax type-signature A a = a ⦂ A
-- The it function can be used to instantiate an argument by using
-- instance search.
it : ⦃ _ : A ⦄ → A
it ⦃ x ⦄ = x
-- Case expressions (to be used with pattern-matching lambdas).
infix 0 case_return_of_ case_of_
case_return_of_ :
(x : A) (@0 B : A → Type b) → ((x : A) → B x) → B x
case x return B of f = f x
case_of_ : A → (A → B) → B
case x of f = case x return _ of f
------------------------------------------------------------------------
-- Σ-types
infixr 4 _,′_
infixr 2 _×_
open import Agda.Builtin.Sigma public
using (Σ; _,_)
hiding (module Σ)
renaming (fst to proj₁; snd to proj₂)
module Σ where
open Agda.Builtin.Sigma.Σ public
using ()
renaming (fst to proj₁; snd to proj₂)
-- Variants of the projections with erased type arguments.
proj₁₀ :
{@0 B : A → Type b} →
Σ A B → A
proj₁₀ (x , y) = x
proj₂₀ :
{@0 B : A → Type b}
(p : Σ A B) → B (proj₁ p)
proj₂₀ (x , y) = y
open Σ public using (proj₁₀; proj₂₀)
-- A variant where the first argument is implicit.
∃ : {A : Type a} → (A → Type b) → Type (a ⊔ b)
∃ = Σ _
-- Binary products.
_×_ : (A : Type a) (B : Type b) → Type (a ⊔ b)
A × B = Σ A (const B)
-- A variant of _,_ that is specialised to _×_. Use of this variant
-- can make type-inference easier.
_,′_ : A → B → A × B
x ,′ y = x , y
-- A map function.
Σ-map :
(f : A → B) → (∀ {x} → P x → Q (f x)) →
Σ A P → Σ B Q
Σ-map f g = λ p → (f (proj₁₀ p) , g (proj₂₀ p))
-- Zip.
Σ-zip :
(f : A → B → C) → (∀ {x y} → P x → Q y → R (f x y)) →
Σ A P → Σ B Q → Σ C R
Σ-zip f g = λ p q → (f (proj₁₀ p) (proj₁₀ q) , g (proj₂₀ p) (proj₂₀ q))
-- Curry and uncurry.
curry :
{@0 B : A → Type b} {@0 C : Σ A B → Type c} →
((p : Σ A B) → C p) →
((x : A) (y : B x) → C (x , y))
curry f x y = f (x , y)
uncurry :
{@0 B : A → Type b} {@0 C : Σ A B → Type c} →
((x : A) (y : B x) → C (x , y)) →
((p : Σ A B) → C p)
uncurry f (x , y) = f x y
-- Swaps the two components of the pair.
swap : A × B → B × A
swap (x , y) = y , x
------------------------------------------------------------------------
-- W-types
data W (A : Type a) (B : A → Type b) : Type (a ⊔ b) where
sup : (x : A) (f : B x → W A B) → W A B
-- Projections.
headᵂ :
{@0 B : A → Type b} →
W A B → A
headᵂ (sup x f) = x
tailᵂ :
{@0 B : A → Type b} →
(x : W A B) → B (headᵂ x) → W A B
tailᵂ (sup x f) = f
-- If B is always inhabited, then W A B is empty.
abstract
inhabited⇒W-empty :
{@0 B : A → Type b} →
(∀ x → B x) → ¬ W A B
inhabited⇒W-empty b (sup x f) = inhabited⇒W-empty b (f (b x))
------------------------------------------------------------------------
-- Binary sums
infixr 1 _⊎_
data _⊎_ (A : Type a) (B : Type b) : Type (a ⊔ b) where
inj₁ : (x : A) → A ⊎ B
inj₂ : (y : B) → A ⊎ B
-- Eliminator for binary sums.
[_,_] :
{@0 C : A ⊎ B → Type c} →
((x : A) → C (inj₁ x)) → ((x : B) → C (inj₂ x)) →
((x : A ⊎ B) → C x)
[ f , g ] (inj₁ x) = f x
[ f , g ] (inj₂ y) = g y
-- A generalisation of if-then-else.
infix 5 if_then_else_
if_then_else_ : A ⊎ B → C → C → C
if x then t else f = [ const t , const f ] x
-- A generalisation of not.
not : A ⊎ B → B ⊎ A
not (inj₁ x) = inj₂ x
not (inj₂ x) = inj₁ x
-- A map function.
⊎-map : (A₁ → A₂) → (B₁ → B₂) → A₁ ⊎ B₁ → A₂ ⊎ B₂
⊎-map f g = [ (λ x → inj₁ (f x)) , (λ x → inj₂ (g x)) ]
-- The function from-⊎ is a safe analogue of fromJust. For an example
-- of how from-⊎ can be used, see
-- Quotient.equivalence-but-not-strong-equivalence.
From-⊎ : {A B : Type ℓ} → A ⊎ B → Type ℓ
From-⊎ {A = A} (inj₁ _) = A
From-⊎ {B = B} (inj₂ _) = B
from-⊎ : (x : A ⊎ B) → From-⊎ x
from-⊎ (inj₁ x) = x
from-⊎ (inj₂ y) = y
-- A special case of binary sums: decided predicates.
Dec : Type p → Type p
Dec P = P ⊎ ¬ P
pattern yes p = inj₁ p
pattern no p = inj₂ p
-- Decidable relations.
Decidable : {A : Type a} {B : Type b} →
(A → B → Type ℓ) → Type (a ⊔ b ⊔ ℓ)
Decidable _∼_ = ∀ x y → Dec (x ∼ y)
-- Exclusive or.
infixr 1 _Xor_
_Xor_ : Type a → Type b → Type (a ⊔ b)
A Xor B = (A × ¬ B) ⊎ (¬ A × B)
-- Maybe.
Maybe : Type a → Type a
Maybe A = ⊤ ⊎ A
pattern nothing = inj₁ tt
pattern just x = inj₂ x
-- The truth predicate T is only inhabited when its argument is
-- inj₁ something.
T : A ⊎ B → Type
T b = if b then ⊤ else ⊥
------------------------------------------------------------------------
-- Booleans
-- Booleans.
Bool : Type
Bool = ⊤ ⊎ ⊤
pattern true = inj₁ tt
pattern false = inj₂ tt
-- And.
infixr 6 _∧_
_∧_ : Bool → Bool → Bool
b₁ ∧ b₂ = if b₁ then b₂ else false
-- Or.
infixr 5 _∨_
_∨_ : Bool → Bool → Bool
b₁ ∨ b₂ = if b₁ then true else b₂
------------------------------------------------------------------------
-- Lists
open import Agda.Builtin.List public using (List; []; _∷_)
------------------------------------------------------------------------
-- Finite sets
Fin : ℕ → Type
Fin zero = ⊥
Fin (suc n) = ⊤ ⊎ Fin n
pattern fzero = inj₁ tt
pattern fsuc i = inj₂ i
------------------------------------------------------------------------
-- Some relation combinators
-- Combines two relations into a relation on functions.
_→-rel_ : {A : Type a} {C : Type c} →
(A → C → Type ℓ) → (B → D → Type ℓ) →
(A → B) → (C → D) → Type (a ⊔ c ⊔ ℓ)
(P →-rel Q) f g = ∀ x y → P x y → Q (f x) (g y)
-- Combines two relations into a relation on products.
_×-rel_ : (A → C → Type ℓ) → (B → D → Type ℓ) → A × B → C × D → Type ℓ
(P ×-rel Q) (x , u) (y , v) = P x y × Q u v
-- Combines two relations into a relation on sums.
_⊎-rel_ : (A → C → Type ℓ) → (B → D → Type ℓ) → A ⊎ B → C ⊎ D → Type ℓ
(P ⊎-rel Q) (inj₁ x) (inj₁ y) = P x y
(P ⊎-rel Q) (inj₁ x) (inj₂ v) = ⊥
(P ⊎-rel Q) (inj₂ u) (inj₁ y) = ⊥
(P ⊎-rel Q) (inj₂ u) (inj₂ v) = Q u v
| 20.783784
| 72
| 0.481644
|
1bcf0c6230bdb5e69a76d20196a5fee46f6c107b
| 1,952
|
agda
|
Agda
|
test/Compiler/simple/Issue4168-4185.agda
|
vlopezj/agda
|
ff4d89e75970cf27599fb9f572bd43c9455cbb56
|
[
"BSD-3-Clause"
] | 1
|
2019-09-27T06:54:44.000Z
|
2019-09-27T06:54:44.000Z
|
test/Compiler/simple/Issue4168-4185.agda
|
vlopezj/agda
|
ff4d89e75970cf27599fb9f572bd43c9455cbb56
|
[
"BSD-3-Clause"
] | 3
|
2018-11-14T15:31:44.000Z
|
2019-04-01T19:39:26.000Z
|
test/Compiler/simple/Issue4168-4185.agda
|
vlopezj/agda
|
ff4d89e75970cf27599fb9f572bd43c9455cbb56
|
[
"BSD-3-Clause"
] | null | null | null |
-- Andreas, 2019-11-12, issue #4168b
--
-- Meta variable solver should not use uncurrying
-- if the record type contains erased fields.
open import Agda.Builtin.Equality
open import Agda.Builtin.Sigma
open import Common.IO
P : (A B : Set) → (A → B) → Set
P A B f = (y : B) → Σ A (λ x → f x ≡ y)
record R (A B : Set) : Set where
field
to : A → B
from : B → A
from-to : (x : A) → from (to x) ≡ x
p : (A B : Set) (r : R A B) → P A B (R.to r)
p _ _ r y = R.from r y , to-from y
where
postulate
to-from : ∀ x → R.to r (R.from r x) ≡ x
record Box (A : Set) : Set where
constructor box
field
@0 unbox : A
test : (A : Set) → P (Box A) (Box (Box A)) (box {A = Box A})
test A = p _ _ (record
{ to = box {A = _}
; from = λ { (box (box x)) → box {A = A} x }
-- at first, a postponed type checking problem ?from
; from-to = λ x → refl {A = Box A} {x = _}
})
-- from-to creates constraint
--
-- x : Box A |- ?from (box x) = x : Box A
--
-- This was changed to
--
-- y : Box (Box A) |- ?from y = unbox y : Box A
--
-- which is an invalid transformation since x is not
-- guaranteed to be in erased context.
-- As a consequence, compilation (GHC backend) failed.
-- A variant with a non-erased field.
record ⊤ : Set where
record Box' (A : Set) : Set where
constructor box'
field
unit : ⊤
@0 unbox' : A
test' : (A : Set) → P (Box' A) (Box' (Box' A)) (box' {A = Box' A} _)
test' A = p _ _ (record
{ to = box' {A = _} _
; from = λ { (box' _ (box' _ x)) → box' {A = A} _ x }
; from-to = λ x → refl {A = Box' A} {x = _}
})
-- UPDATE (2019-11-17):
-- We may, however, uncurry if the record argument is erased.
mutual
X : {@0 A : Set} (@0 b : Box A) → Box (Box A)
X = _
spec : ∀{@0 A : Set} {@0 x : A}
→ X (box x) ≡ box (box x)
spec = refl
-- This can be solved by:
-- X := λ {@0 A} (@0 b) → box (box (Box.unbox b))
main : IO ⊤
main = return _
| 22.964706
| 68
| 0.531762
|
7339c4344a61d83c493059abcd8ccfe3fa9dcb58
| 170
|
agda
|
Agda
|
Cubical/HITs/SetQuotients.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 301
|
2018-10-17T18:00:24.000Z
|
2022-03-24T02:10:47.000Z
|
Cubical/HITs/SetQuotients.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 584
|
2018-10-15T09:49:02.000Z
|
2022-03-30T12:09:17.000Z
|
Cubical/HITs/SetQuotients.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 134
|
2018-11-16T06:11:03.000Z
|
2022-03-23T16:22:13.000Z
|
{-# OPTIONS --safe #-}
module Cubical.HITs.SetQuotients where
open import Cubical.HITs.SetQuotients.Base public
open import Cubical.HITs.SetQuotients.Properties public
| 28.333333
| 55
| 0.805882
|
3670fc640cd2937c820ee43f81ad0a8cd56c1199
| 1,605
|
agda
|
Agda
|
notes/FOT/FOTC/Data/List/WellFoundedRelationsSL.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 11
|
2015-09-03T20:53:42.000Z
|
2021-09-12T16:09:54.000Z
|
notes/FOT/FOTC/Data/List/WellFoundedRelationsSL.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 2
|
2016-10-12T17:28:16.000Z
|
2017-01-01T14:34:26.000Z
|
notes/FOT/FOTC/Data/List/WellFoundedRelationsSL.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 3
|
2016-09-19T14:18:30.000Z
|
2018-03-14T08:50:00.000Z
|
------------------------------------------------------------------------------
-- Well-founded relation on lists
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOT.FOTC.Data.List.WellFoundedRelationsSL {A : Set} where
open import Data.Product
open import Data.List hiding ( length )
open import Data.Nat
open import Induction.Nat
open import Induction.WellFounded
open import Relation.Binary.PropositionalEquality
------------------------------------------------------------------------------
-- We use our own version of the function length because we have
-- better reductions.
length : List A → ℕ
length [] = 0
length (x ∷ xs) = 1 + length xs
open module II = Induction.WellFounded.Inverse-image {_<_ = _<′_} length
-- Well-founded relation on lists based on their length.
LTL : List A → List A → Set
LTL xs ys = length xs <′ length ys
-- The relation LTL is well-founded (using the image inverse
-- combinator).
wfLTL : Well-founded LTL
wfLTL = II.well-founded <′-well-founded
-- Well-founded relation on lists based on their structure.
LTC : List A → List A → Set
LTC xs ys = Σ A (λ a → ys ≡ a ∷ xs)
LTC→LTL : ∀ {xs ys} → LTC xs ys → LTL xs ys
LTC→LTL (x , refl) = ≤′-refl
open module S = Induction.WellFounded.Subrelation {_<₁_ = LTC} LTC→LTL
-- The relation LTC is well-founded (using the subrelation combinator).
wfLTC : Well-founded LTC
wfLTC = S.well-founded wfLTL
| 31.470588
| 78
| 0.583801
|
1b8027e662980b6c5ada3e8b74f33d24ee36ab61
| 5,004
|
agda
|
Agda
|
Data/List/Properties.agda
|
oisdk/agda-playground
|
97a3aab1282b2337c5f43e2cfa3fa969a94c11b7
|
[
"MIT"
] | 6
|
2020-09-11T17:45:41.000Z
|
2021-11-16T08:11:34.000Z
|
Data/List/Properties.agda
|
oisdk/agda-playground
|
97a3aab1282b2337c5f43e2cfa3fa969a94c11b7
|
[
"MIT"
] | null | null | null |
Data/List/Properties.agda
|
oisdk/agda-playground
|
97a3aab1282b2337c5f43e2cfa3fa969a94c11b7
|
[
"MIT"
] | 1
|
2021-11-11T12:30:21.000Z
|
2021-11-11T12:30:21.000Z
|
{-# OPTIONS --cubical --safe #-}
module Data.List.Properties where
open import Data.List
open import Prelude
open import Data.Fin
open import Strict.Properties
map-length : (f : A → B) (xs : List A)
→ length xs ≡ length (map f xs)
map-length f [] _ = zero
map-length f (x ∷ xs) i = suc (map-length f xs i)
map-ind : (f : A → B) (xs : List A)
→ PathP (λ i → Fin (map-length f xs i) → B) (f ∘ (xs !_)) (map f xs !_)
map-ind f [] i ()
map-ind f (x ∷ xs) i f0 = f x
map-ind f (x ∷ xs) i (fs n) = map-ind f xs i n
tab-length : ∀ n (f : Fin n → A) → length (tabulate n f) ≡ n
tab-length zero f _ = zero
tab-length (suc n) f i = suc (tab-length n (f ∘ fs) i)
tab-distrib : ∀ n (f : Fin n → A) m → ∃ i × (f i ≡ tabulate n f ! m)
tab-distrib (suc n) f f0 = f0 , refl
tab-distrib (suc n) f (fs m) = let i , p = tab-distrib n (f ∘ fs) m in fs i , p
tab-id : ∀ n (f : Fin n → A) → PathP (λ i → Fin (tab-length n f i) → A) (_!_ (tabulate n f)) f
tab-id zero f _ ()
tab-id (suc n) f i f0 = f f0
tab-id (suc n) f i (fs m) = tab-id n (f ∘ fs) i m
list-elim : ∀ {p} (P : List A → Type p) →
(∀ x xs → P xs → P (x ∷ xs)) →
(P []) →
∀ xs → P xs
list-elim P f b [] = b
list-elim P f b (x ∷ xs) = f x xs (list-elim P f b xs)
foldr-universal : ∀ (h : List B → A) f e
→ (h [] ≡ e)
→ (∀ x xs → h (x ∷ xs) ≡ f x (h xs))
→ ∀ xs → h xs ≡ foldr f e xs
foldr-universal h f e base step [] = base
foldr-universal h f e base step (x ∷ xs) =
step x xs ; cong (f x) (foldr-universal h f e base step xs)
foldr-id : (xs : List A) → xs ≡ foldr _∷_ [] xs
foldr-id = foldr-universal id _∷_ [] refl (λ _ _ → refl)
foldr-fusion : ∀ (f : C → A) {_⊕_ : B → C → C} {_⊗_ : B → A → A} e
→ (∀ x y → f (x ⊕ y) ≡ x ⊗ f y)
→ ∀ xs → f (foldr _⊕_ e xs) ≡ foldr _⊗_ (f e) xs
foldr-fusion h {f} {g} e fuse =
foldr-universal (h ∘ foldr f e) g (h e) refl (λ x xs → fuse x (foldr f e xs))
foldl-is-foldr : (f : B → A → B) (z : B) (xs : List A) →
foldl f z xs ≡ foldr (λ x k xs → k (f xs x)) id xs z
foldl-is-foldr f z xs =
cong (_$ z) (foldr-universal (flip (foldl f)) (λ x k xs → k (f xs x)) id refl (λ x xs → refl) xs)
foldl-fusion : ∀ (f : C → A) {_⊕_ : C → B → C} {_⊗_ : A → B → A} e →
(∀ x y → f (x ⊕ y) ≡ f x ⊗ y) →
∀ xs → f (foldl _⊕_ e xs) ≡ foldl _⊗_ (f e) xs
foldl-fusion h {f} {g} e fuse [] = refl
foldl-fusion h {f} {g} e fuse (x ∷ xs) =
foldl-fusion h (f e x) fuse xs ; cong (flip (foldl g) xs) (fuse e x)
++-assoc : (xs ys zs : List A) → (xs ++ ys) ++ zs ≡ xs ++ (ys ++ zs)
++-assoc xs ys zs = foldr-fusion (_++ zs) ys (λ _ _ → refl) xs
map-fusion : ∀ f (b : C) (g : A → B) xs → foldr f b (map g xs) ≡ foldr (f ∘ g) b xs
map-fusion f b g = foldr-fusion (foldr f b) [] λ _ _ → refl
++-idʳ : (xs : List A) → xs ++ [] ≡ xs
++-idʳ [] = refl
++-idʳ (x ∷ xs) = cong (x ∷_) (++-idʳ xs)
open import Function.Injective
∷-inj : (x : A) → Injective (x ∷_)
∷-inj x xs ys = cong λ where [] → []
(_ ∷ zs) → zs
++-inj : (xs : List A) → Injective (xs ++_)
++-inj [] ys zs ys≡zs = ys≡zs
++-inj (x ∷ xs) ys zs ys≡zs = ++-inj xs ys zs (∷-inj x (xs ++ ys) (xs ++ zs) ys≡zs)
open import Algebra
module _ (mon : Monoid b) where
open Monoid mon
module _ (f : A → 𝑆) where
monStepL : 𝑆 → A → 𝑆
monStepL xs x = xs ∙ f x
{-# INLINE monStepL #-}
foldMapL : List A → 𝑆
foldMapL = foldl monStepL ε
foldMapLStep : ∀ x xs → f x ∙ foldMapL xs ≡ foldMapL (x ∷ xs)
foldMapLStep x xs = foldl-fusion (f x ∙_) ε (λ y z → sym (assoc (f x) y (f z))) xs ; cong (flip (foldl monStepL) xs) (∙ε (f x) ; sym (ε∙ (f x)))
foldl-foldr-monoid : (xs : List A) → foldMapL xs ≡ foldr (_∙_ ∘ f) ε xs
foldl-foldr-monoid = foldr-universal _ (_∙_ ∘ f) ε refl λ x xs → sym (foldMapLStep x xs)
module _ (A : Type a) where
listMonoid : Monoid a
listMonoid .Monoid.𝑆 = List A
listMonoid .Monoid._∙_ = _++_
listMonoid .Monoid.ε = []
listMonoid .Monoid.assoc = ++-assoc
listMonoid .Monoid.ε∙ _ = refl
listMonoid .Monoid.∙ε = ++-idʳ
foldl′-foldl : (f : B → A → B) (z : B) (xs : List A) → foldl′ f z xs ≡ foldl f z xs
foldl′-foldl f z [] = refl
foldl′-foldl f z (x ∷ xs) = $!-≡ (λ y → foldl′ f y xs) (f z x) ; foldl′-foldl f (f z x) xs
foldr′-foldr : (f : A → B → B) (z : B) (xs : List A) → foldr′ f z xs ≡ foldr f z xs
foldr′-foldr f z [] = refl
foldr′-foldr f z (x ∷ xs) = $!-≡ (f x) (foldr′ f z xs) ; cong (f x) (foldr′-foldr f z xs)
is-empty : List A → Bool
is-empty [] = true
is-empty (_ ∷ _) = false
NonEmpty : List A → Type
NonEmpty = T ∘ not ∘ is-empty
open import Data.Maybe.Properties
foldrMay-nonEmpty : (f : A → A → A) (xs : List A) → NonEmpty xs → IsJust (foldrMay f xs)
foldrMay-nonEmpty f (x ∷ xs) _ = tt
foldr1 : (A → A → A) → (xs : List A) → ⦃ NonEmpty xs ⦄ → A
foldr1 f xs ⦃ xsne ⦄ = fromJust (foldrMay f xs)
where instance _ = foldrMay-nonEmpty f xs xsne
| 34.993007
| 148
| 0.520783
|
36b4bf417ee4518bc210c2fae908010ddc2a7981
| 7,254
|
agda
|
Agda
|
StructurallyRecursiveDescentParsing/Simplified/Semantics.agda
|
nad/parser-combinators
|
76774f54f466cfe943debf2da731074fe0c33644
|
[
"MIT"
] | 1
|
2020-07-03T08:56:13.000Z
|
2020-07-03T08:56:13.000Z
|
StructurallyRecursiveDescentParsing/Simplified/Semantics.agda
|
nad/parser-combinators
|
76774f54f466cfe943debf2da731074fe0c33644
|
[
"MIT"
] | null | null | null |
StructurallyRecursiveDescentParsing/Simplified/Semantics.agda
|
nad/parser-combinators
|
76774f54f466cfe943debf2da731074fe0c33644
|
[
"MIT"
] | null | null | null |
------------------------------------------------------------------------
-- Semantics of the simplified parsers
------------------------------------------------------------------------
module StructurallyRecursiveDescentParsing.Simplified.Semantics where
open import Algebra
open import Codata.Musical.Notation
open import Data.Bool
open import Data.List
import Data.List.Properties
private
module LM {Tok : Set} = Monoid (Data.List.Properties.++-monoid Tok)
open import Data.Product as Prod
open import Function
open import Data.Empty
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import StructurallyRecursiveDescentParsing.Simplified
open import TotalParserCombinators.Parser using (○; ◌)
open import TotalParserCombinators.Semantics as Semantics
using ([_-_]_>>=_) renaming (_∈_·_ to _∈′_·_)
open Semantics._∈_·_
------------------------------------------------------------------------
-- Semantics
-- The semantics of the parsers. x ∈ p · s means that x can be the
-- result of applying the parser p to the string s. Note that the
-- semantics is defined inductively.
infixl 10 _?>>=_ _!>>=_
infix 4 _∈_·_
data _∈_·_ {Tok} : ∀ {R e} → R → Parser Tok e R → List Tok → Set1 where
return : ∀ {R} {x : R} → x ∈ return x · []
token : ∀ {x} → x ∈ token · [ x ]
∣ˡ : ∀ {R x e₁ e₂ s} {p₁ : Parser Tok e₁ R} {p₂ : Parser Tok e₂ R}
(x∈p₁ : x ∈ p₁ · s) → x ∈ p₁ ∣ p₂ · s
∣ʳ : ∀ {R x e₂ s} e₁ {p₁ : Parser Tok e₁ R} {p₂ : Parser Tok e₂ R}
(x∈p₂ : x ∈ p₂ · s) → x ∈ p₁ ∣ p₂ · s
_?>>=_ : ∀ {R₁ R₂ x y e₂ s₁ s₂}
{p₁ : Parser Tok true R₁} {p₂ : R₁ → Parser Tok e₂ R₂}
(x∈p₁ : x ∈ p₁ · s₁) (y∈p₂x : y ∈ p₂ x · s₂) →
y ∈ p₁ ?>>= p₂ · s₁ ++ s₂
_!>>=_ : ∀ {R₁ R₂ x y} {e₂ : R₁ → Bool} {s₁ s₂}
{p₁ : Parser Tok false R₁}
{p₂ : (x : R₁) → ∞ (Parser Tok (e₂ x) R₂)}
(x∈p₁ : x ∈ p₁ · s₁) (y∈p₂x : y ∈ ♭ (p₂ x) · s₂) →
y ∈ p₁ !>>= p₂ · s₁ ++ s₂
------------------------------------------------------------------------
-- _∈_·_ is correct with respect to _∈′_·_
sound : ∀ {Tok e R} {p : Parser Tok e R} {x s} →
x ∈ p · s → x ∈′ ⟦ p ⟧ · s
sound return = return
sound token = token
sound (∣ˡ x∈p₁) = cast (∣-left (sound x∈p₁))
sound (∣ʳ _ {p₁} x∈p₂) = cast (∣-right (initial p₁) (sound x∈p₂))
sound (_?>>=_ {p₂ = p₂}
x∈p₁ y∈p₂x) = cast ([_-_]_>>=_ ○ ○ {p₂ = λ x → ⟦ p₂ x ⟧}
(sound x∈p₁) (sound y∈p₂x))
sound (x∈p₁ !>>= y∈p₂x) = [ ○ - ◌ ] sound x∈p₁ >>= sound y∈p₂x
complete : ∀ {Tok e R} (p : Parser Tok e R) {x s} →
x ∈′ ⟦ p ⟧ · s → x ∈ p · s
complete (return x) return = return
complete fail ()
complete token token = token
complete (p₁ ∣ p₂) (cast (∣-left x∈p₁)) = ∣ˡ (complete p₁ x∈p₁)
complete (_∣_ {e₁} p₁ p₂) (cast (∣-right ._ x∈p₂)) = ∣ʳ e₁ (complete p₂ x∈p₂)
complete (p₁ ?>>= p₂) (cast (x∈p₁ >>= y∈p₂x)) = complete p₁ x∈p₁ ?>>= complete (p₂ _) y∈p₂x
complete (p₁ !>>= p₂) (x∈p₁ >>= y∈p₂x) = complete p₁ x∈p₁ !>>= complete (♭ (p₂ _)) y∈p₂x
------------------------------------------------------------------------
-- A lemma
-- A simple cast lemma.
cast∈ : ∀ {Tok e R} {p p′ : Parser Tok e R} {x x′ s s′} →
x ≡ x′ → p ≡ p′ → s ≡ s′ → x ∈ p · s → x′ ∈ p′ · s′
cast∈ P.refl P.refl P.refl x∈ = x∈
------------------------------------------------------------------------
-- A variant of the semantics
-- The statement x ⊕ s₂ ∈ p · s means that there is some s₁ such that
-- s ≡ s₁ ++ s₂ and x ∈ p · s₁. This variant of the semantics is
-- perhaps harder to understand, but sometimes easier to work with
-- (and it is proved equivalent to the semantics above).
infix 4 _⊕_∈_·_
data _⊕_∈_·_ {Tok} : ∀ {R e} → R → List Tok →
Parser Tok e R → List Tok → Set1 where
return : ∀ {R} {x : R} {s} → x ⊕ s ∈ return x · s
token : ∀ {x s} → x ⊕ s ∈ token · x ∷ s
∣ˡ : ∀ {R x e₁ e₂ s s₁}
{p₁ : Parser Tok e₁ R} {p₂ : Parser Tok e₂ R}
(x∈p₁ : x ⊕ s₁ ∈ p₁ · s) → x ⊕ s₁ ∈ p₁ ∣ p₂ · s
∣ʳ : ∀ {R x e₂ s s₁} e₁
{p₁ : Parser Tok e₁ R} {p₂ : Parser Tok e₂ R}
(x∈p₂ : x ⊕ s₁ ∈ p₂ · s) → x ⊕ s₁ ∈ p₁ ∣ p₂ · s
_?>>=_ : ∀ {R₁ R₂ x y e₂ s s₁ s₂}
{p₁ : Parser Tok true R₁} {p₂ : R₁ → Parser Tok e₂ R₂}
(x∈p₁ : x ⊕ s₁ ∈ p₁ · s) (y∈p₂x : y ⊕ s₂ ∈ p₂ x · s₁) →
y ⊕ s₂ ∈ p₁ ?>>= p₂ · s
_!>>=_ : ∀ {R₁ R₂ x y} {e₂ : R₁ → Bool} {s s₁ s₂}
{p₁ : Parser Tok false R₁}
{p₂ : (x : R₁) → ∞ (Parser Tok (e₂ x) R₂)}
(x∈p₁ : x ⊕ s₁ ∈ p₁ · s) (y∈p₂x : y ⊕ s₂ ∈ ♭ (p₂ x) · s₁) →
y ⊕ s₂ ∈ p₁ !>>= p₂ · s
-- The definition is sound and complete with respect to the one above.
⊕-sound′ : ∀ {Tok R e x s₂ s} {p : Parser Tok e R} →
x ⊕ s₂ ∈ p · s → ∃ λ s₁ → (s ≡ s₁ ++ s₂) × (x ∈ p · s₁)
⊕-sound′ return = ([] , P.refl , return)
⊕-sound′ {x = x} token = ([ x ] , P.refl , token)
⊕-sound′ (∣ˡ x∈p₁) with ⊕-sound′ x∈p₁
⊕-sound′ (∣ˡ x∈p₁) | (s₁ , P.refl , x∈p₁′) = (s₁ , P.refl , ∣ˡ x∈p₁′)
⊕-sound′ (∣ʳ e₁ x∈p₁) with ⊕-sound′ x∈p₁
⊕-sound′ (∣ʳ e₁ x∈p₁) | (s₁ , P.refl , x∈p₁′) = (s₁ , P.refl , ∣ʳ e₁ x∈p₁′)
⊕-sound′ (x∈p₁ ?>>= y∈p₂x) with ⊕-sound′ x∈p₁ | ⊕-sound′ y∈p₂x
⊕-sound′ (x∈p₁ ?>>= y∈p₂x) | (s₁ , P.refl , x∈p₁′) | (s₂ , P.refl , y∈p₂x′) =
(s₁ ++ s₂ , P.sym (LM.assoc s₁ s₂ _)
, x∈p₁′ ?>>= y∈p₂x′)
⊕-sound′ (x∈p₁ !>>= y∈p₂x) with ⊕-sound′ x∈p₁ | ⊕-sound′ y∈p₂x
⊕-sound′ (x∈p₁ !>>= y∈p₂x) | (s₁ , P.refl , x∈p₁′) | (s₂ , P.refl , y∈p₂x′) =
(s₁ ++ s₂ , P.sym (LM.assoc s₁ s₂ _)
, x∈p₁′ !>>= y∈p₂x′)
⊕-sound : ∀ {Tok R e x s} {p : Parser Tok e R} →
x ⊕ [] ∈ p · s → x ∈ p · s
⊕-sound x∈p with ⊕-sound′ x∈p
⊕-sound x∈p | (s , P.refl , x∈p′) with s ++ [] | proj₂ LM.identity s
⊕-sound x∈p | (s , P.refl , x∈p′) | .s | P.refl = x∈p′
extend : ∀ {Tok R e x s s′ s″} {p : Parser Tok e R} →
x ⊕ s′ ∈ p · s → x ⊕ s′ ++ s″ ∈ p · s ++ s″
extend return = return
extend token = token
extend (∣ˡ x∈p₁) = ∣ˡ (extend x∈p₁)
extend (∣ʳ e₁ x∈p₂) = ∣ʳ e₁ (extend x∈p₂)
extend (x∈p₁ ?>>= y∈p₂x) = extend x∈p₁ ?>>= extend y∈p₂x
extend (x∈p₁ !>>= y∈p₂x) = extend x∈p₁ !>>= extend y∈p₂x
⊕-complete : ∀ {Tok R e x s} {p : Parser Tok e R} →
x ∈ p · s → x ⊕ [] ∈ p · s
⊕-complete return = return
⊕-complete token = token
⊕-complete (∣ˡ x∈p₁) = ∣ˡ (⊕-complete x∈p₁)
⊕-complete (∣ʳ e₁ x∈p₂) = ∣ʳ e₁ (⊕-complete x∈p₂)
⊕-complete (x∈p₁ ?>>= y∈p₂x) = extend (⊕-complete x∈p₁) ?>>=
⊕-complete y∈p₂x
⊕-complete (x∈p₁ !>>= y∈p₂x) = extend (⊕-complete x∈p₁) !>>=
⊕-complete y∈p₂x
⊕-complete′ : ∀ {Tok R e x s₂ s} {p : Parser Tok e R} →
(∃ λ s₁ → s ≡ s₁ ++ s₂ × x ∈ p · s₁) →
x ⊕ s₂ ∈ p · s
⊕-complete′ (s₁ , P.refl , x∈p) = extend (⊕-complete x∈p)
| 44.231707
| 100
| 0.444031
|
fd003316db28d02fe24fd80ffcbc8106023e9ed0
| 725
|
agda
|
Agda
|
theorems/cw/cohomology/TopGrid.agda
|
mikeshulman/HoTT-Agda
|
e7d663b63d89f380ab772ecb8d51c38c26952dbb
|
[
"MIT"
] | null | null | null |
theorems/cw/cohomology/TopGrid.agda
|
mikeshulman/HoTT-Agda
|
e7d663b63d89f380ab772ecb8d51c38c26952dbb
|
[
"MIT"
] | null | null | null |
theorems/cw/cohomology/TopGrid.agda
|
mikeshulman/HoTT-Agda
|
e7d663b63d89f380ab772ecb8d51c38c26952dbb
|
[
"MIT"
] | 1
|
2018-12-26T21:31:57.000Z
|
2018-12-26T21:31:57.000Z
|
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import cohomology.Theory
module cw.cohomology.TopGrid {i} (OT : OrdinaryTheory i)
(n : ℤ) {X Y Z : Ptd i} (f : X ⊙→ Y) (g : Y ⊙→ Z) where
{-
X --> Y ---> Z
| | this |
v v one v
1 -> Y/X -> Z/X
-}
open OrdinaryTheory OT
open import cohomology.PtdMapSequence cohomology-theory
open import cw.cohomology.GridPtdMap f g using (Y/X-to-Z/X)
top-grid-comm-sqr : CommSquare (fst g) (fst Y/X-to-Z/X) cfcod cfcod
top-grid-comm-sqr = comm-sqr λ _ → idp
C-top-grid-commutes : CommSquareᴳ
(C-fmap n Y/X-to-Z/X) (C-fmap n g) (C-fmap n (⊙cfcod' (g ⊙∘ f))) (C-fmap n (⊙cfcod' f))
C-top-grid-commutes = C-comm-square n top-grid-comm-sqr
| 27.884615
| 91
| 0.615172
|
064790ae8bae4da98de12318df96fcb3564abc2b
| 105
|
agda
|
Agda
|
examples/outdated-and-incorrect/AIM6/Cat/lib/Data/Maybe.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
examples/outdated-and-incorrect/AIM6/Cat/lib/Data/Maybe.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
examples/outdated-and-incorrect/AIM6/Cat/lib/Data/Maybe.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
module Data.Maybe where
data Maybe (a : Set) : Set where
nothing : Maybe a
just : a -> Maybe a
| 13.125
| 32
| 0.619048
|
3f58bc5160499308af94a0ff68921f543cf44262
| 1,266
|
agda
|
Agda
|
src/LibraBFT/Impl/Consensus/ConsensusTypes/VoteData.agda
|
LaudateCorpus1/bft-consensus-agda
|
a4674fc473f2457fd3fe5123af48253cfb2404ef
|
[
"UPL-1.0"
] | null | null | null |
src/LibraBFT/Impl/Consensus/ConsensusTypes/VoteData.agda
|
LaudateCorpus1/bft-consensus-agda
|
a4674fc473f2457fd3fe5123af48253cfb2404ef
|
[
"UPL-1.0"
] | null | null | null |
src/LibraBFT/Impl/Consensus/ConsensusTypes/VoteData.agda
|
LaudateCorpus1/bft-consensus-agda
|
a4674fc473f2457fd3fe5123af48253cfb2404ef
|
[
"UPL-1.0"
] | null | null | null |
{- 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
| 40.83871
| 111
| 0.71643
|
4e8766da2f5e2d58c6094f30b6b937ad89e87b8b
| 5,233
|
agda
|
Agda
|
test/Succeed/CompileTimeInlining.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/CompileTimeInlining.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/CompileTimeInlining.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
------------------------------------------------------------------------
-- A small definition of a dependently typed language, using the
-- technique from McBride's "Outrageous but Meaningful Coincidences"
------------------------------------------------------------------------
-- Inlining saves a lot of memory. Test with +RTS -M100M
-- The inlining of zero and suc in raw-category at the end is the most
-- important.
{-# OPTIONS --type-in-type #-}
module _ where
open import Agda.Builtin.Equality
open import Agda.Builtin.Unit
open import Agda.Builtin.Sigma
------------------------------------------------------------------------
-- Prelude
data ⊥ : Set where
⊥-elim : ⊥ → {A : Set} → A
⊥-elim ()
data Either (A B : Set) : Set where
left : A → Either A B
right : B → Either A B
uncurry : {A : Set} {B : A → Set} {C : Σ A B → Set} →
((x : A) (y : B x) → C (x , y)) →
((p : Σ A B) → C p)
uncurry f p = f (fst p) (snd p)
infixr 2 _×_
_×_ : Set → Set → Set
_×_ A B = Σ A (λ _ → B)
------------------------------------------------------------------------
-- A universe
data U : Set
El : U → Set
data U where
set : U
el : Set → U
sigma : (a : U) → (El a → U) → U
pi : (a : U) → (El a → U) → U
El set = Set
El (el A) = A
El (sigma a b) = Σ (El a) (λ x → El (b x))
El (pi a b) = (x : El a) → El (b x)
-- Abbreviations.
fun : U → U → U
fun a b = pi a (λ _ → b)
times : U → U → U
times a b = sigma a (λ _ → b)
-- -- Example.
------------------------------------------------------------------------
-- Contexts
-- Contexts.
data Ctxt : Set
-- Types.
Ty : Ctxt → Set
-- Environments.
Env : Ctxt → Set
data Ctxt where
empty : Ctxt
snoc : (G : Ctxt) → Ty G → Ctxt
Ty G = Env G → U
Env empty = ⊤
Env (snoc G s) = Σ (Env G) (λ g → El (s g))
-- Variables (deBruijn indices).
Var : ∀ G → Ty G → Set
Var empty t = ⊥
Var (snoc G s) t =
Either ((λ g → s (fst g)) ≡ t)
(Σ _ (λ u → (λ g → u (fst g)) ≡ t × Var G u))
zero : ∀ {G s} → Var (snoc G s) (λ g → s (fst g))
zero = left refl
suc : ∀ {G s t} → (x : Var G t) → Var (snoc G s) (λ g → t (fst g))
suc x = right (_ , refl , x)
-- A lookup function.
lookup : ∀ G (s : Ty G) → Var G s → (g : Env G) → El (s g)
lookup empty _ absurd _ = ⊥-elim absurd
lookup (snoc vs v) _ (left refl) g = snd g
lookup (snoc vs v) t (right (_ , refl , x)) g = lookup _ _ x (fst g)
------------------------------------------------------------------------
-- A language
-- Syntax for types.
data Type (G : Ctxt) (s : Ty G) : Set
-- Terms.
data Term (G : Ctxt) (s : Ty G) : Set
-- The semantics of a term.
eval : ∀ {G s} → Term G s → (g : Env G) → El (s g)
data Type G s where
set'' : s ≡ (λ _ → set) → Type G s
el'' : (x : Term G (λ _ → set)) →
(λ g → el (eval {s = λ _ → set} x g)) ≡ s →
Type G s
sigma'' : {t : _} {u : _} →
Type G t →
Type (snoc G t) u →
(λ g → sigma (t g) (λ v → u (g , v))) ≡ s →
Type G s
pi'' : {t : _} {u : _} →
Type G t →
Type (snoc G t) u →
(λ g → pi (t g) (λ v → u (g , v))) ≡ s →
Type G s
data Term G s where
var : Var G s → Term G s
lam'' : {t : _} {u : _} →
Term (snoc G t) (uncurry u) →
(λ g → pi (t g) (λ v → u g v)) ≡ s →
Term G s
app'' : {t : _} {u : (g : Env G) → El (t g) → U} →
Term G (λ g → pi (t g) (λ v → u g v)) →
(t2 : Term G t) →
(λ g → u g (eval t2 g)) ≡ s →
Term G s
eval (var x) g = lookup _ _ x g
eval (lam'' t refl) g = λ v → eval t (g , v)
eval (app'' t1 t2 refl) g = eval t1 g (eval t2 g)
-- Abbreviations.
set' : {G : Ctxt} → Type G (λ _ → set)
set' = set'' refl
el' : {G : Ctxt}
(x : Term G (λ _ → set)) →
Type G (λ g → el (eval {G} {λ _ → set} x g))
el' x = el'' x refl
sigma' : {G : Ctxt} {t : Env G → U} {u : Env (snoc G t) → U} →
Type G t →
Type (snoc G t) u →
Type G (λ g → sigma (t g) (λ v → u (g , v)))
sigma' s t = sigma'' s t refl
pi' : {G : _} {t : _} {u : _} →
Type G t →
Type (snoc G t) u →
Type G (λ g → pi (t g) (λ v → u (g , v)))
pi' s t = pi'' s t refl
lam : {G : _} {t : _} {u : _} →
Term (snoc G t) (uncurry u) →
Term G (λ g → pi (t g) (λ v → u g v))
lam t = lam'' t refl
app : {G : _} {t : _} {u : (g : Env G) → El (t g) → U} →
Term G (λ g → pi (t g) (λ v → u g v)) →
(t2 : Term G t) →
Term G (λ g → u g (eval t2 g))
app t1 t2 = app'' t1 t2 refl
-- Example.
raw-categoryU : U
raw-categoryU =
sigma set (λ obj →
sigma (fun (el obj) (fun (el obj) set)) (λ hom →
times
(pi (el obj) (λ x → el (hom x x)))
(pi (el obj) (λ x → el (hom x x)))))
raw-category : Type empty (λ _ → raw-categoryU)
raw-category =
-- Objects.
sigma' set'
-- Morphisms.
(sigma' (pi' (el' (var zero)) (pi' (el' (var (suc zero))) set'))
-- Identity.
(sigma' (pi' (el' (var (suc zero)))
(el' (app (app (var (suc zero)) (var zero)) (var zero))))
(pi' (el' (var (suc (suc zero))))
(el' (app (app (var (suc (suc zero))) (var zero)) (var zero))))))
| 24.568075
| 80
| 0.426142
|
cc721a0db950022add0729c2fa16a9a1483b2460
| 7,724
|
agda
|
Agda
|
Cubical/HITs/James/Inductive/Reduced.agda
|
guilhermehas/cubical
|
ce3120d3f8d692847b2744162bcd7a01f0b687eb
|
[
"MIT"
] | 1
|
2021-10-31T17:32:49.000Z
|
2021-10-31T17:32:49.000Z
|
Cubical/HITs/James/Inductive/Reduced.agda
|
guilhermehas/cubical
|
ce3120d3f8d692847b2744162bcd7a01f0b687eb
|
[
"MIT"
] | null | null | null |
Cubical/HITs/James/Inductive/Reduced.agda
|
guilhermehas/cubical
|
ce3120d3f8d692847b2744162bcd7a01f0b687eb
|
[
"MIT"
] | null | null | null |
{-
This file contains:
- Some alternative inductive definitions of James, and they give the same results.
The most relevant one is called `𝕁Red` because it is much simpler.
It has fewer constructors, among which the 2-dimensional constructor `coh`
has a form essentially more clearer, and it avoids indexes.
-}
{-# OPTIONS --safe #-}
module Cubical.HITs.James.Inductive.Reduced where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Pointed
open import Cubical.Foundations.Univalence
open import Cubical.Data.Nat
open import Cubical.HITs.SequentialColimit
open import Cubical.HITs.James.Inductive.Base
renaming (𝕁ames to 𝕁amesConstruction ; 𝕁ames∞ to 𝕁ames∞Construction)
private
variable
ℓ : Level
module _
((X , x₀) : Pointed ℓ) where
infixr 5 _∷_
-- Inductive James with fewer constructors
data 𝕁Red : Type ℓ where
[] : 𝕁Red
_∷_ : X → 𝕁Red → 𝕁Red
unit : (x : X)(xs : 𝕁Red) → x₀ ∷ x ∷ xs ≡ x ∷ x₀ ∷ xs
coh : (xs : 𝕁Red) → refl ≡ unit x₀ xs
data 𝕁Red∞ : Type ℓ where
inl : 𝕁Red → 𝕁Red∞
push : (xs : 𝕁Red) → inl xs ≡ inl (x₀ ∷ xs)
-- Auxiliary constructions
-- The following square of types is defined as HIT over I × I.
-- Notice that the constructor `incl∷` can be seen parametrized by i, `coh` by both i j,
-- and other constructors are constant.
data 𝕁Square (i j : I) : Type ℓ where
[] : 𝕁Square i j
_∷_ : X → 𝕁Square i j → 𝕁Square i j
incl : 𝕁Square i j → 𝕁Square i j
unit : (xs : 𝕁Square i j) → incl xs ≡ x₀ ∷ xs
incl∷ : (x : X)(xs : 𝕁Square i j) → unit (x ∷ xs) i ≡ x ∷ unit xs i
coh : (xs : 𝕁Square i j) →
PathP (λ k → unit (unit xs (i ∨ k)) i ≡ unit (unit xs i) (i ∨ j ∨ k))
(λ k → unit (unit xs i) (i ∨ j ∧ k)) (incl∷ x₀ xs)
-- What we need actually is its diagonal.
𝕁Path : I → Type ℓ
𝕁Path i = 𝕁Square i (~ i)
-- If you expand the very definition at end points,
-- you will find that `𝕁Red` is almost a deformation retraction of `𝕁1`,
-- and `𝕁0` is almost the same as the original inductive definition of James.
-- That explains why the isomorphisms given bellow are mainly of c-c, c-v and refls.
𝕁0 = 𝕁Path i0
𝕁1 = 𝕁Path i1
data 𝕁Path∞ (i : I) : Type ℓ where
inl : 𝕁Path i → 𝕁Path∞ i
push : (xs : 𝕁Path i) → inl xs ≡ inl (unit xs i)
𝕁0∞ = 𝕁Path∞ i0
𝕁1∞ = 𝕁Path∞ i1
-- The equivalence 𝕁1 ≃ 𝕁Red
-- This part reduces the constructors.
𝕁1→𝕁Red : 𝕁1 → 𝕁Red
𝕁1→𝕁Red [] = []
𝕁1→𝕁Red (x ∷ xs) = x ∷ 𝕁1→𝕁Red xs
𝕁1→𝕁Red (incl xs) = x₀ ∷ 𝕁1→𝕁Red xs
𝕁1→𝕁Red (incl∷ x xs i) = unit x (𝕁1→𝕁Red xs) i
𝕁1→𝕁Red (unit xs i) = x₀ ∷ 𝕁1→𝕁Red xs
𝕁1→𝕁Red (coh xs i j) = coh (𝕁1→𝕁Red xs) i j
𝕁Red→𝕁1 : 𝕁Red → 𝕁1
𝕁Red→𝕁1 [] = []
𝕁Red→𝕁1 (x ∷ xs) = x ∷ 𝕁Red→𝕁1 xs
𝕁Red→𝕁1 (unit x xs i) = incl∷ x (𝕁Red→𝕁1 xs) i
𝕁Red→𝕁1 (coh xs i j) = coh (𝕁Red→𝕁1 xs) i j
𝕁Red→𝕁1→𝕁Red : (xs : 𝕁Red) → 𝕁1→𝕁Red (𝕁Red→𝕁1 xs) ≡ xs
𝕁Red→𝕁1→𝕁Red [] = refl
𝕁Red→𝕁1→𝕁Red (x ∷ xs) t = x ∷ 𝕁Red→𝕁1→𝕁Red xs t
𝕁Red→𝕁1→𝕁Red (unit x xs i) t = unit x (𝕁Red→𝕁1→𝕁Red xs t) i
𝕁Red→𝕁1→𝕁Red (coh xs i j) t = coh (𝕁Red→𝕁1→𝕁Red xs t) i j
𝕁1→𝕁Red→𝕁1 : (xs : 𝕁1) → 𝕁Red→𝕁1 (𝕁1→𝕁Red xs) ≡ xs
𝕁1→𝕁Red→𝕁1 [] = refl
𝕁1→𝕁Red→𝕁1 (x ∷ xs) t = x ∷ 𝕁1→𝕁Red→𝕁1 xs t
𝕁1→𝕁Red→𝕁1 (incl xs) = (λ t → x₀ ∷ 𝕁1→𝕁Red→𝕁1 xs t) ∙ sym (unit xs)
𝕁1→𝕁Red→𝕁1 (incl∷ x xs i) t = incl∷ x (𝕁1→𝕁Red→𝕁1 xs t) i
𝕁1→𝕁Red→𝕁1 (unit xs i) j =
hcomp (λ k → λ
{ (i = i0) → compPath-filler (λ t → x₀ ∷ 𝕁1→𝕁Red→𝕁1 xs t) (sym (unit xs)) k j
; (i = i1) → x₀ ∷ 𝕁1→𝕁Red→𝕁1 xs j
; (j = i0) → x₀ ∷ 𝕁Red→𝕁1 (𝕁1→𝕁Red xs)
; (j = i1) → unit xs (i ∨ ~ k)})
(x₀ ∷ 𝕁1→𝕁Red→𝕁1 xs j)
𝕁1→𝕁Red→𝕁1 (coh xs i j) t = coh (𝕁1→𝕁Red→𝕁1 xs t) i j
𝕁Red∞→𝕁1∞ : 𝕁Red∞ → 𝕁1∞
𝕁Red∞→𝕁1∞ (inl xs) = inl (𝕁Red→𝕁1 xs)
𝕁Red∞→𝕁1∞ (push xs i) = push (𝕁Red→𝕁1 xs) i
𝕁1∞→𝕁Red∞ : 𝕁1∞ → 𝕁Red∞
𝕁1∞→𝕁Red∞ (inl xs) = inl (𝕁1→𝕁Red xs)
𝕁1∞→𝕁Red∞ (push xs i) = push (𝕁1→𝕁Red xs) i
𝕁Red∞→𝕁1∞→𝕁Red∞ : (xs : 𝕁Red∞) → 𝕁1∞→𝕁Red∞ (𝕁Red∞→𝕁1∞ xs) ≡ xs
𝕁Red∞→𝕁1∞→𝕁Red∞ (inl xs) t = inl (𝕁Red→𝕁1→𝕁Red xs t)
𝕁Red∞→𝕁1∞→𝕁Red∞ (push xs i) t = push (𝕁Red→𝕁1→𝕁Red xs t) i
𝕁1∞→𝕁Red∞→𝕁1∞ : (xs : 𝕁1∞) → 𝕁Red∞→𝕁1∞ (𝕁1∞→𝕁Red∞ xs) ≡ xs
𝕁1∞→𝕁Red∞→𝕁1∞ (inl xs) t = inl (𝕁1→𝕁Red→𝕁1 xs t)
𝕁1∞→𝕁Red∞→𝕁1∞ (push xs i) t = push (𝕁1→𝕁Red→𝕁1 xs t) i
𝕁1∞≃𝕁Red∞ : 𝕁1∞ ≃ 𝕁Red∞
𝕁1∞≃𝕁Red∞ = isoToEquiv (iso 𝕁1∞→𝕁Red∞ 𝕁Red∞→𝕁1∞ 𝕁Red∞→𝕁1∞→𝕁Red∞ 𝕁1∞→𝕁Red∞→𝕁1∞)
-- The equivalence 𝕁ames ≃ 𝕁0
-- This part removes the indexes.
private
𝕁ames = 𝕁amesConstruction (X , x₀)
𝕁ames∞ = 𝕁ames∞Construction (X , x₀)
index : 𝕁0 → ℕ
index [] = 0
index (x ∷ xs) = 1 + index xs
index (incl xs) = 1 + index xs
index (incl∷ x xs i) = 2 + index xs
index (unit xs i) = 1 + index xs
index (coh xs i j) = 2 + index xs
𝕁ames→𝕁0 : {n : ℕ} → 𝕁ames n → 𝕁0
𝕁ames→𝕁0 [] = []
𝕁ames→𝕁0 (x ∷ xs) = x ∷ 𝕁ames→𝕁0 xs
𝕁ames→𝕁0 (incl xs) = incl (𝕁ames→𝕁0 xs)
𝕁ames→𝕁0 (incl∷ x xs i) = incl∷ x (𝕁ames→𝕁0 xs) i
𝕁ames→𝕁0 (unit xs i) = unit (𝕁ames→𝕁0 xs) i
𝕁ames→𝕁0 (coh xs i j) = coh (𝕁ames→𝕁0 xs) i j
𝕁0→𝕁ames : (xs : 𝕁0) → 𝕁ames (index xs)
𝕁0→𝕁ames [] = []
𝕁0→𝕁ames (x ∷ xs) = x ∷ 𝕁0→𝕁ames xs
𝕁0→𝕁ames (incl xs) = incl (𝕁0→𝕁ames xs)
𝕁0→𝕁ames (incl∷ x xs i) = incl∷ x (𝕁0→𝕁ames xs) i
𝕁0→𝕁ames (unit xs i) = unit (𝕁0→𝕁ames xs) i
𝕁0→𝕁ames (coh xs i j) = coh (𝕁0→𝕁ames xs) i j
𝕁0→𝕁ames→𝕁0 : (xs : 𝕁0) → 𝕁ames→𝕁0 (𝕁0→𝕁ames xs) ≡ xs
𝕁0→𝕁ames→𝕁0 [] = refl
𝕁0→𝕁ames→𝕁0 (x ∷ xs) t = x ∷ 𝕁0→𝕁ames→𝕁0 xs t
𝕁0→𝕁ames→𝕁0 (incl xs) t = incl (𝕁0→𝕁ames→𝕁0 xs t)
𝕁0→𝕁ames→𝕁0 (incl∷ x xs i) t = incl∷ x (𝕁0→𝕁ames→𝕁0 xs t) i
𝕁0→𝕁ames→𝕁0 (unit xs i) t = unit (𝕁0→𝕁ames→𝕁0 xs t) i
𝕁0→𝕁ames→𝕁0 (coh xs i j) t = coh (𝕁0→𝕁ames→𝕁0 xs t) i j
index-path : {n : ℕ}(xs : 𝕁ames n) → index (𝕁ames→𝕁0 xs) ≡ n
index-path [] = refl
index-path (x ∷ xs) t = 1 + index-path xs t
index-path (incl xs) t = 1 + index-path xs t
index-path (incl∷ x xs i) t = 2 + index-path xs t
index-path (unit xs i) t = 1 + index-path xs t
index-path (coh xs i j) t = 2 + index-path xs t
𝕁ames→𝕁0→𝕁ames : {n : ℕ}(xs : 𝕁ames n)
→ PathP (λ i → 𝕁ames (index-path xs i)) (𝕁0→𝕁ames (𝕁ames→𝕁0 xs)) xs
𝕁ames→𝕁0→𝕁ames [] = refl
𝕁ames→𝕁0→𝕁ames (x ∷ xs) t = x ∷ 𝕁ames→𝕁0→𝕁ames xs t
𝕁ames→𝕁0→𝕁ames (incl xs) t = incl (𝕁ames→𝕁0→𝕁ames xs t)
𝕁ames→𝕁0→𝕁ames (incl∷ x xs i) t = incl∷ x (𝕁ames→𝕁0→𝕁ames xs t) i
𝕁ames→𝕁0→𝕁ames (unit xs i) t = unit (𝕁ames→𝕁0→𝕁ames xs t) i
𝕁ames→𝕁0→𝕁ames (coh xs i j) t = coh (𝕁ames→𝕁0→𝕁ames xs t) i j
𝕁ames∞→𝕁0∞ : 𝕁ames∞ → 𝕁0∞
𝕁ames∞→𝕁0∞ (inl xs) = inl (𝕁ames→𝕁0 xs)
𝕁ames∞→𝕁0∞ (push xs i) = push (𝕁ames→𝕁0 xs) i
𝕁0∞→𝕁ames∞ : 𝕁0∞ → 𝕁ames∞
𝕁0∞→𝕁ames∞ (inl xs) = inl (𝕁0→𝕁ames xs)
𝕁0∞→𝕁ames∞ (push xs i) = push (𝕁0→𝕁ames xs) i
𝕁ames∞→𝕁0∞→𝕁ames∞ : (xs : 𝕁ames∞) → 𝕁0∞→𝕁ames∞ (𝕁ames∞→𝕁0∞ xs) ≡ xs
𝕁ames∞→𝕁0∞→𝕁ames∞ (inl xs) t = inl (𝕁ames→𝕁0→𝕁ames xs t)
𝕁ames∞→𝕁0∞→𝕁ames∞ (push xs i) t = push (𝕁ames→𝕁0→𝕁ames xs t) i
𝕁0∞→𝕁ames∞→𝕁0∞ : (xs : 𝕁0∞) → 𝕁ames∞→𝕁0∞ (𝕁0∞→𝕁ames∞ xs) ≡ xs
𝕁0∞→𝕁ames∞→𝕁0∞ (inl xs) t = inl (𝕁0→𝕁ames→𝕁0 xs t)
𝕁0∞→𝕁ames∞→𝕁0∞ (push xs i) t = push (𝕁0→𝕁ames→𝕁0 xs t) i
𝕁ames∞≃𝕁0∞ : 𝕁ames∞ ≃ 𝕁0∞
𝕁ames∞≃𝕁0∞ = isoToEquiv (iso 𝕁ames∞→𝕁0∞ 𝕁0∞→𝕁ames∞ 𝕁0∞→𝕁ames∞→𝕁0∞ 𝕁ames∞→𝕁0∞→𝕁ames∞)
-- The main equivalence:
𝕁ames∞≃𝕁Red∞ : 𝕁ames∞ ≃ 𝕁Red∞
𝕁ames∞≃𝕁Red∞ = compEquiv 𝕁ames∞≃𝕁0∞ (compEquiv (pathToEquiv (λ i → 𝕁Path∞ i)) 𝕁1∞≃𝕁Red∞)
-- Test of canonicity
private
-- It's good for [].
eq1 : 𝕁ames∞≃𝕁Red∞ .fst (inl []) ≡ inl []
eq1 = refl
-- Without regularity, "obvious" equality doesn't hold definitionally.
eq2 : (x : X) → 𝕁ames∞≃𝕁Red∞ .fst (inl (x ∷ [])) ≡ inl (x ∷ [])
eq2 _ = transportRefl _
| 33.729258
| 90
| 0.587778
|
11c6a9a972de708a31f31dc921cd96e613b7921c
| 244
|
agda
|
Agda
|
test/interaction/Issue1820.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/interaction/Issue1820.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/interaction/Issue1820.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
data Nat : Set where
zero : Nat
suc : (n : Nat) → Nat
test₁ : (n : Nat) → Nat
test₁ n with zero
... | x = {!x!}
data Tree : Set where
leaf : Tree
node : Tree → Tree → Tree
test₂ : (n : Tree) → Tree
test₂ n₁ with leaf
... | n = {!n!}
| 15.25
| 27
| 0.536885
|
73a5f0f6cb2a9795768a93b3de077e31615073b0
| 17,168
|
agda
|
Agda
|
JamesFirstComposite.agda
|
guillaumebrunerie/JamesConstruction
|
89fbc29473d2d1ed1a45c3c0e56288cdcf77050b
|
[
"MIT"
] | 5
|
2016-12-07T04:34:52.000Z
|
2018-11-16T22:10:16.000Z
|
JamesFirstComposite.agda
|
guillaumebrunerie/JamesConstruction
|
89fbc29473d2d1ed1a45c3c0e56288cdcf77050b
|
[
"MIT"
] | null | null | null |
JamesFirstComposite.agda
|
guillaumebrunerie/JamesConstruction
|
89fbc29473d2d1ed1a45c3c0e56288cdcf77050b
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K --rewriting #-}
open import PathInduction
open import Pushout
module JamesFirstComposite {i} (A : Type i) (⋆A : A) where
open import JamesTwoMaps A ⋆A
ap-from-αJ-δJ : (a : A) (x : JA) → ap from (ap (αJ a) (δJ x)) == ap (α∞ a) (δ∞ (from x))
ap-from-αJ-δJ a x = ap-from-αJ a (δJ x) ∙ ap (ap (α∞ a)) (δJ-β x)
ap-from-γ : (a : A) (x : JA) → ap from (γJ a x) == γ∞ a (from x)
ap-from-γ = λ a x → ap-!∙ from (ap (αJ a) (δJ x)) (δJ (αJ a x)) ∙ & coh (ap-from-αJ-δJ a x) (δJ-β (αJ a x)) module ApFromγ where
coh : Coh ({A : Type i} {a b : A} {p p' : b == a} (p= : p == p') {c : A} {q q' : b == c} (q= : q == q') → ! p ∙ q == ! p' ∙ q')
coh = path-induction
ap-from-η : (x : JA) → Square (ap (ap from) (ηJ x)) (ap-from-γ ⋆A x) idp (η∞ (from x))
ap-from-η x = & (η-ify-coh from) (ap-δJ (δJ x)) ∙□ & η-coh-homotopy from-δJ-δJ where
-- [ap] commutes with [ηIfy.coh]
-- This lemma would also be true for arbitrary [αJ], [δJ], [α∞] and [δ∞], but for simplicity
-- we do not abstract over them. We do abstract over [from] because otherwise Agda uses a
-- crazy amount of memory.
η-ify-coh : (from : JA → J∞A) → Coh ({a b : JA} {p : a == b} {c : JA} {q r : b == c} (sq : Square p p q r)
→ Square (ap (ap from) (& (ηIfy.coh αJ δJ) sq)) (ap-!∙ from q r) idp (& (ηIfy.coh α∞ δ∞) (ap-square from sq)))
η-ify-coh = path-induction
from-δJ-δJ : FlatCube (ap-square from (natural-square δJ (δJ x) (ap-idf (δJ x)) idp))
(natural-square δ∞ (δ∞ (from x)) (ap-idf (δ∞ (from x))) idp)
(δJ-β x)
(δJ-β x)
(ap-from-αJ-δJ ⋆A x)
(δJ-β (αJ ⋆A x))
from-δJ-δJ = adapt-flatcube ∙idp idp∙ idp∙ ∙idp
(& (ap-square-natural-square from) (δJ x) δJ (& coh) ∙idp
/∙³ & natural-square-homotopy (δJ-β) (δJ x)
∙fc & (natural-square-∘ (δJ x) from) δ∞ (& coh') idp
/∙³ & natural-square= δ∞ (δJ-β x) (& ap2-idf) (& coh'')) where
coh : {A B : Type i} {f : A → B} → Coh ({x y : A} {p : x == y} → ap-∘ f (λ z → z) p ∙ ap (ap f) (ap-idf p) == idp)
coh = path-induction
coh' : {A B : Type i} {f : A → B} → Coh ({x y : A} {p : x == y} → ∘-ap (λ z → z) f p ∙ idp == ap-idf _)
coh' = path-induction
coh'' : Coh ({A : Type i} {a b : A} {p : a == b} {c : A} {q : c == a} {d : A} {r : c == d}
→ Square p (! q ∙ r) idp ((! r ∙ q) ∙ p))
coh'' = path-induction
-- If [sq] and [sq'] are equal (via a FlatCube), then applying [ηIfy.coh] to them give equal terms
-- (via a Square).
η-coh-homotopy : Coh ({a b : J∞A} {p : a == b} {c : J∞A} {q : b == c} {r : b == c} {sq : Square p p q r}
{p' : a == b} {p= : p == p'} {q' : b == c} {q= : q == q'} {r' : b == c} {r= : r == r'}
{sq' : Square p' p' q' r'} (cube : FlatCube sq sq' p= p= q= r=)
→ Square (& (ηIfy.coh α∞ δ∞) sq) (& ApFromγ.coh q= r=) idp (& (ηIfy.coh α∞ δ∞) sq'))
η-coh-homotopy = path-induction
comp-square2 : Coh ({A : Type i} {a b : A} {p : a == b} {c : A} {q : b == c} → Square p idp q (p ∙ q))
comp-square2 = path-induction
ap-square-comp-square2 : {A B : Type i} (f : A → B) → Coh ({a b : A} {p : a == b} {c : A} {q : b == c}
→ FlatCube (ap-square f (& comp-square2 {p = p} {q = q})) (& comp-square2) idp idp idp (ap-∙ f p q))
ap-square-comp-square2 f = path-induction
{- First composite -}
-- As for [inJ], we need both [from-inJ] and [from-inJS] for the termination checker
from-inJ : (n : ℕ) (x : J n) → from (inJ n x) == in∞ n x
from-inJS : (n : ℕ) (x : J (S n)) → from (inJS n x) == in∞ (S n) x
-- Those three describe [from ∘ inJS] applied to [ι], [α] and [β], in the case [S n] as it is
-- the only one we need.
from-inJSS-ι : (n : ℕ) (x : J (S n)) → from (inJS (S n) (ι (S n) x)) == in∞ (S (S n)) (ι (S n) x)
from-inJSS-ι n x = ap (α∞ ⋆A) (from-inJS n x) ∙ ap (in∞ (S (S n))) (β (S n) x)
from-inJSS-α : (n : ℕ) (a : A) (x : J (S n)) → from (inJS (S n) (α (S n) a x)) == in∞ (S (S n)) (α (S n) a x)
from-inJSS-α n a x = ap (α∞ a) (from-inJS n x)
from-inJSS-β : (n : ℕ) (x : J (S n)) → Square (ap from (ap (inJS (S n)) (β (S n) x))) (from-inJSS-α n ⋆A x) (from-inJSS-ι n x) (ap (in∞ (S (S n))) (β (S n) x))
from-inJSS-β n x = ap (ap from) (inJS-βS n x) |∙ comp-square
-- Those three terms describe what happens when we apply [from-inJS] to [ι], [α] or [β].
-- Note that the naming scheme is slightly ambiguous, they do *not* describe [from (inJS (ι _ _))] as above.
-- They are defined later, as we need to know the definition of [from-inJS].
from-inJS-ι : (n : ℕ) (x : J n) → Square (from-inJS n (ι n x)) (ap from (inJS-ι n x)) idp (ap (α∞ ⋆A) (from-inJ n x) ∙ ap (in∞ (S n)) (β n x))
from-inJS-α : (n : ℕ) (a : A) (x : J n) → Square (from-inJS n (α n a x)) (ap from (inJS-α n a x)) idp (ap (α∞ a) (from-inJ n x))
from-inJS-β : (n : ℕ) (x : J n) → Cube (natural-square (from-inJS n) (β n x) (ap-∘ from (inJS n) (β n x)) idp) (& comp-square2) (from-inJS-α n ⋆A x) (ap-square from (inJS-β n x)) hid-square (from-inJS-ι n x)
-- The following three terms show that the two ways of reducing [from ∘ inJS (S n) ∘ (ι (S n) | α (S n) a) ∘ (ι n | α n a)]
-- are equal. For some reason, we don’t need it with α twice
side1 : (n : ℕ) (a : A) (x : J n) → ap (α∞ a) (ap from (inJS-ι n x)) ∙
ap (α∞ a) (ap (α∞ ⋆A) (from-inJ n x)) ∙
ap (in∞ (S (S n))) (ap (α (S n) a) (β n x))
== from-inJSS-α n a (ι n x)
side1 n = λ a x → & coh (ap-∙ _ _ _) (ap-square (α∞ a) (from-inJS-ι n x)) (ap-α∞-in∞ (S n) a (β n x)) module Side1 where
coh : Coh ({A : Type i} {a c : A} {q : a == c} {d : A} {s1 : c == d} {b : A} {s2 : d == b} {s : c == b} (s= : s == s1 ∙ s2)
{p : a == b} (sq : Square p q idp s) {s2' : d == b} (s2= : s2 == s2')
→ q ∙ s1 ∙ s2' == p)
coh = path-induction
side2 : (n : ℕ) (a : A) (x : J n) → ap (α∞ ⋆A) (ap from (inJS-α n a x)) ∙
ap (α∞ ⋆A) (ap (α∞ a) (from-inJ n x)) ∙
ap (in∞ (S (S n))) (β (S n) (α n a x))
== from-inJSS-ι n (α n a x)
side2 n = λ a x → & coh (ap-square (α∞ ⋆A) (from-inJS-α n a x)) module Side2 where
coh : Coh ({A : Type i} {a b : A} {p : a == b} {c : A} {q : a == c} {s : c == b} (sq : Square p q idp s) {e : A} {t : b == e}
→ q ∙ s ∙ t == p ∙ t)
coh = path-induction
side3 : (n : ℕ) (x : J n) → ap (α∞ ⋆A) (ap from (inJS-ι n x)) ∙
ap (α∞ ⋆A) (ap (α∞ ⋆A) (from-inJ n x)) ∙
ap (in∞ (S (S n))) (β (S n) (α n ⋆A x)) ∙
ap (in∞ (S (S n))) (ap (ι (S n)) (β n x))
== from-inJSS-ι n (ι n x)
side3 n = λ x → & coh (ap-∙ _ _ _) (ap-α∞-in∞ (S n) ⋆A (β n x)) (ap-square (α∞ ⋆A) (from-inJS-ι n x))
(ap-square (in∞ (S (S n))) (natural-square (β (S n)) (β n x) idp idp)) module Side3 where
coh : Coh ({A : Type i} {a c : A} {q : a == c} {d : A} {s : c == d} {b : A} {r : d == b} {rs : c == b} (rs= : rs == s ∙ r)
{r' : d == b} (r= : r == r') {p : a == b} (sq : Square p q idp rs)
{e : A} {t : d == e} {f : A} {u : e == f} {v : b == f} (sq2 : Square t r' u v)
→ q ∙ s ∙ t ∙ u == p ∙ v)
coh = path-induction
piece1 : (n : ℕ) (a : A) (x : J n) → Square (ap from (ap (inJS (S n)) (γ n a x)))
(ap (α∞ a) (ap from (inJS-ι n x)))
(ap (α∞ ⋆A) (ap from (inJS-α n a x)))
(ap from (γJ a (inJ n x)))
piece1 n a x = adapt-square (ap-square from (inJSS-γ n a x)) (ap-from-αJ a (inJS-ι n x)) (ap-from-αJ ⋆A (inJS-α n a x))
from-inJSS-γ : (n : ℕ) (a : A) (x : J n) → Square (ap from (ap (inJS (S n)) (γ n a x))) (from-inJSS-α n a (ι n x)) (from-inJSS-ι n (α n a x)) (ap (in∞ (S (S n))) (γ n a x))
from-inJSS-γ n a x = adapt-square (piece1 n a x
∙□ ap-from-γ a (inJ n x)
|∙ natural-square (γ∞ a) (from-inJ n x) (ap-∘ (α∞ a) (α∞ ⋆A) (from-inJ n x)) (ap-∘ (α∞ ⋆A) (α∞ a) (from-inJ n x))
∙□ γ∞-in a n x)
(side1 n a x) (side2 n a x)
adapt-eq : Coh ({A : Type i} {a b : A} {q : a == b} {sq : Square idp q q idp} (sq= : sq == vid-square) {q' : a == b} {p : q == q'} → adapt-square sq p p == vid-square)
adapt-eq = path-induction
natural-square-idp : {A B : Type i} {f : A → B} {x y : A} {p : x == y} {fp : f x == f y} {fp= : ap f p == fp} → natural-square (λ a → idp {a = f a}) p fp= fp= == vid-square
natural-square-idp {p = idp} {fp= = idp} = idp
vid-square∙□vid-square∙□vid-square : Coh ({A : Type i} {a b : A} {p : a == b} {c : A} {q : b == c} {d : A} {r : c == d} → vid-square {p = p} ∙□ vid-square {p = q} ∙□ vid-square {p = r} == vid-square {p = p ∙ q ∙ r})
vid-square∙□vid-square∙□vid-square = path-induction
adapt-square-natural-square : ∀ {i j} {A : Type i} {B : Type j} → Coh ({f g : A → B} {h : (a : A) → f a == g a}
{x y : A} {p : x == y} {pf' : f x == f y} {q : ap f p == pf'} {pg' : g x == g y} {r : ap g p == pg'}
→ adapt-square (natural-square h p idp idp) q r == natural-square h p q r)
adapt-square-natural-square = path-induction
piece1-η : (n : ℕ) (x : J n) → Cube (ap-square from (ap-square (inJS (S n)) (η n x)))
(horiz-degen-square (ap (ap from) (ηJ (inJ n x))))
(piece1 n ⋆A x) vid-square _ _
piece1-η n x = & (ap-shapeInJSη from) {to = ηJ (inJ n x)} (inJSS-η n x) (ap-from-αJ ⋆A (inJS-α n ⋆A x)) (ap-from-αJ ⋆A (inJS-ι n x))
coh-blip : {A B : Type i} {a b : A} (p : a == b)
→ Coh ({f g : A → B} {k : (a : A) → f a == g a} {h : A → B} {l : (a : A) → g a == h a}
{fp : _} {fp= : ap f p == fp}
{gp : _} (gp= : ap g p == gp)
{hp : _} {hp= : ap h p == hp}
→ square-symmetry (natural-square (λ x → k x ∙ l x) p fp= hp=) == square-symmetry (natural-square k p fp= gp=) ∙□ square-symmetry (natural-square l p gp= hp=))
coh-blip {a = a} idp = path-induction
ap-square-hid : {A B : Type i} {f : A → B} {x y : A} {p : x == y} → ap-square f (hid-square {p = p}) == hid-square
ap-square-hid {p = idp} = idp
from-inJSS-η : (n : ℕ) (x : J n) → Cube (ap-square from (ap-square (inJS (S n)) (η n x)))
(ap-square (in∞ (S (S n))) (η n x))
(from-inJSS-γ n ⋆A x)
vid-square
(square-symmetry (natural-square (from-inJSS-ι n) (β n x) (ap-∘ _ _ _ ∙ ap-∘ _ _ _) (ap-∘ _ _ _)))
(from-inJSS-β n (ι n x))
from-inJSS-η n x =
adapt-cube (piece1-η n x
∙³x ap-from-η (inJ n x)
-|∙³ natural-cube-η∞ η∞ (from-inJ n x)
∙³x η∞-in n x)
(side1 n ⋆A x) (side2 n ⋆A x) (side1 n ⋆A x) (side3 n x)
idp
(& adapt-eq (& vid-square∙□vid-square∙□vid-square))
(& coh4 (ap-square-from-αJ ⋆A (inJS-β n x)) (& (ap-square-comp-square2 (α∞ ⋆A))) ap-square-hid (ap-cube (α∞ ⋆A) (from-inJS-β n x))
eq1
eq2
∙ ! (& (coh-blip (β n x)) (ap-∘ (in∞ (S (S n))) (α (S n) ⋆A) (β n x))))
(& coh (ap (ap from) (inJS-βS n (ι n x)))) where
coh : {A : Type i} {a : A} → Coh ({p : a == a} (sq : p == idp) {b : A} {s : a == b}
{c : A} {q : b == c} {d : A} {u u'' : c == d} {u= : u'' == u} {u' : b == d} {u'= : u' == q ∙ u''}
{e : A} {t : c == e} {f : A} {v : e == f} {w : d == f} {ββ : Square t u v w} {k : a == d} {X : Square k s idp u'}
→ adapt-square ((sq |∙ vid-square {p = s}) ∙□ idp |∙ vid-square {p = q} ∙□ skew ββ) (& (Side1.coh n) u'= X u=) (& (Side3.coh n) u'= u= X ββ)
== sq |∙ comp-square)
coh = path-induction
eq1 : natural-square (λ a₁ → ap (α∞ ⋆A) (from-inJS n a₁)) (β n x)
(ap-∘ (from ∘ inJS (S n)) inr (β n x) ∙
ap-∘ from (inJS (S n)) (ap inr (β n x)))
(ap-∘ (in∞ (S (S n))) (α (S n) ⋆A) (β n x))
== adapt-square (ap-square (α∞ ⋆A) (natural-square (from-inJS n) (β n x) (ap-∘ from (inJS n) (β n x)) idp)) (! (ap-from-αJ ⋆A (ap (inJS n) (β n x))) ∙ ! (ap (ap from) (ap-inJSS-ι n (β n x)))) (ap-α∞-in∞ (S n) ⋆A (β n x))
eq1 = & (natural-square-ap (α∞ ⋆A)) (β n x) (from-inJS n) (coh' (β n x)) (coh'' (β n x)) where
coh' : {x y : _} (p : x == y)
→ Square (∘-ap (α∞ ⋆A) (λ z → from (inJS n z)) p)
(ap (ap (α∞ ⋆A)) (ap-∘ from (inJS n) p))
(ap-∘ (from ∘ inJS (S n)) inr p
∙ ap-∘ from (inJS (S n)) (ap inr p))
(! (ap-from-αJ ⋆A (ap (inJS n) p))
∙ ! (ap (ap from) (ap-inJSS-ι n p)))
coh' idp = ids
coh'' : {x y : _} (p : x == y)
→ Square (∘-ap (α∞ ⋆A) (λ z → in∞ (S n) z) p)
idp
(ap-∘ (in∞ (S (S n))) (α (S n) ⋆A) p)
(ap-α∞-in∞ (S n) ⋆A p)
coh'' idp = ids
eq2 : ap-square (in∞ (S (S n))) (natural-square (β (S n)) (β n x) idp idp)
== natural-square (λ a₁ → ap (in∞ (S (S n))) (β (S n) a₁)) (β n x)
(ap-∘ (in∞ (S (S n))) (α (S n) ⋆A) (β n x))
(ap-∘ (in∞ (S (S n))) inr (β n x))
eq2 = & (ap-square-natural-square (in∞ (S (S n)))) (β n x) (β (S n)) ∙idp ∙idp
coh4 : Coh ({A : Type i} {a b : A} {p : a == b} {c : A} {q q'' : a == c} {q''= : q'' == q} {q' : a == c}
{q'= : q' == q''} {d : A} {r r' : b == d} {r= : r == r'}
{s : c == d} {sq1 : Square p q r s} {e : A} {t : b == e} {f : A} {u : e == f} {v : d == f}
{sqββ : Square t r' u v} {g : A} {k k' : a == g} {k= : k == k'} {l : c == g}
{sq2 : Square q'' k l idp} {l' : c == g} {l= : l == l'} {u : g == b} {sqα : Square p k' idp u}
{ur : g == d} {ur= : ur == u ∙ r} {sq3 : Square q k' l' idp}
(cube-right : FlatCube sq2 sq3 q''= k= l= idp)
{comp-square2' : _} (comp-square2'= : FlatCube comp-square2' (& comp-square2) idp idp idp ur=)
{hid' : _} (hid'= : hid' == hid-square)
{sqι : Square s l' idp ur} (cube-left : Cube sq1 comp-square2' sqα sq3 hid' sqι)
{sqx : _} (eq1 : sqx == adapt-square sq1 (! q''= ∙ ! q'=) r=)
{sqy : _} (eq2 : sqββ == sqy)
→ adapt-square (adapt-square (q'= |∙ sq2) k= l= ∙□ vid-square {p = u} ∙□ comp-square) (& (Side2.coh n) sqα) (& (Side3.coh n) ur= r= sqι sqββ)
== square-symmetry sqx ∙□ square-symmetry sqy)
coh4 = path-induction
from-inJ O ε = idp
from-inJ (S n) x = from-inJS n x
hdpssvs : Coh ({A : Type i} {x y : A} {p : x == y} → idp == horiz-degen-path (square-symmetry (vid-square {p = p})))
hdpssvs = path-induction
from-inJS O a = idp
from-inJS (S n) =
JSS-elim n (from-inJSS-ι n)
(from-inJSS-α n)
(λ x → ↓-='-from-square (ap-∘ from (inJS (S n)) (β (S n) x)) idp (square-symmetry (from-inJSS-β n x)))
(λ a x → ↓-='-from-square (ap-∘ from (inJS (S n)) (γ n a x)) idp (square-symmetry (from-inJSS-γ n a x)))
(λ x → cube-to-↓-square (from-inJSS-γ n ⋆A x)
(& hdpssvs)
(↓-ap-in-=' (ι (S n)) (from-inJSS-ι n))
(from-inJSS-β n (ι n x))
(ap-square-∘ from (inJS (S n)) (η n x) |∙³ from-inJSS-η n x))
from-inJS-ι O ε = ids
from-inJS-ι (S n) x = hid-square
from-inJS-α O a ε = ids
from-inJS-α (S n) a x = hid-square
from-inJS-β O ε = idc
from-inJS-β (S n) x = & coh (ap-square-horiz-degen-square (inJS-βS n x))
(natural-square-β (from-inJS (S n)) (β (S n) x) (push-βd _)) where
coh : Coh ({A : Type i} {a b : A} {p : a == b} {q : a == a} {k : q == idp}
{k' : Square q idp idp idp} (k= : k' == horiz-degen-square k)
{c : A} {r : b == c} {sq : Square p q r (p ∙ r)} → sq == square-symmetry (k |∙ comp-square)
→ Cube sq (& comp-square2) hid-square k' hid-square hid-square)
coh = path-induction
from-pushJ : (n : ℕ) (x : J n) → Square (ap from (pushJ n x)) (from-inJ n x) (from-inJ (S n) (ι n x)) (push∞ n x)
from-pushJ n x = & coh (δJ-β (inJ n x)) (ap from (inJS-ι n x)) (ap-∙! from _ _)
(natural-square δ∞ (from-inJ n x) (ap-idf (from-inJ n x)) idp) (from-inJS-ι n x) where
coh : Coh ({A : Type i} {a d : A} {p p' : a == d} (p= : p == p')
{b : A} (q : b == d) {pq : a == b} (pq= : pq == p ∙ ! q)
{c : A} {r : a == c} {f : A} {u : c == f} {e : A} {v : e == f}
{s : d == e} (sq : Square p' r s (u ∙ ! v)) {t : b == f} (sq2 : Square t q idp (s ∙ v))
→ Square pq r t u)
coh = path-induction
from-to : (x : J∞A) → from (to x) == x
from-to = J∞A-elim from-inJ (λ n x → ↓-='-from-square (ap-∘ from to (push∞ n x) ∙ ap (ap from) (push∞-β n x)) (ap-idf (push∞ n x)) (square-symmetry (from-pushJ n x)))
| 56.660066
| 229
| 0.438199
|
d1a531840ac57fc693c8a91e5abb3f9f07309db1
| 989
|
agda
|
Agda
|
src/Prelude/List/Relations/Any.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | null | null | null |
src/Prelude/List/Relations/Any.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | null | null | null |
src/Prelude/List/Relations/Any.agda
|
t-more/agda-prelude
|
da4fca7744d317b8843f2bc80a923972f65548d3
|
[
"MIT"
] | null | null | null |
module Prelude.List.Relations.Any where
open import Agda.Primitive
open import Prelude.Nat
open import Prelude.List.Base
open import Prelude.Equality
open import Prelude.List.Relations.All
data Any {a b} {A : Set a} (P : A → Set b) : List A → Set (a ⊔ b) where
zero : ∀ {x xs} (p : P x) → Any P (x ∷ xs)
suc : ∀ {x xs} (i : Any P xs) → Any P (x ∷ xs)
pattern zero! = zero refl
infix 3 _∈_
_∈_ : ∀ {a} {A : Set a} → A → List A → Set a
x ∈ xs = Any (_≡_ x) xs
module _ {a b} {A : Set a} {P : A → Set b} where
-- Delete
deleteIx : ∀ xs → Any P xs → List A
deleteIx (_ ∷ xs) (zero _) = xs
deleteIx (x ∷ xs) (suc i) = x ∷ deleteIx xs i
deleteAllIx : ∀ {c} {Q : A → Set c} {xs} → All Q xs → (i : Any P xs) → All Q (deleteIx xs i)
deleteAllIx (q ∷ qs) (zero _) = qs
deleteAllIx (q ∷ qs) (suc i) = q ∷ deleteAllIx qs i
forgetAny : ∀ {a p} {A : Set a} {P : A → Set p} {xs : List A} → Any P xs → Nat
forgetAny (zero _) = zero
forgetAny (suc i) = suc (forgetAny i)
| 26.026316
| 94
| 0.575329
|
cc107d1c71f61dd307cabab22cd25ceef2906a65
| 521
|
agda
|
Agda
|
agda/Categories/Pullback.agda
|
oisdk/combinatorics-paper
|
3c176d4690566d81611080e9378f5a178b39b851
|
[
"MIT"
] | 4
|
2021-01-05T14:07:44.000Z
|
2021-01-05T15:32:14.000Z
|
agda/Categories/Pullback.agda
|
oisdk/combinatorics-paper
|
3c176d4690566d81611080e9378f5a178b39b851
|
[
"MIT"
] | null | null | null |
agda/Categories/Pullback.agda
|
oisdk/combinatorics-paper
|
3c176d4690566d81611080e9378f5a178b39b851
|
[
"MIT"
] | 1
|
2021-01-05T14:05:30.000Z
|
2021-01-05T14:05:30.000Z
|
{-# OPTIONS --cubical --safe #-}
open import Prelude
open import Categories
module Categories.Pullback {ℓ₁ ℓ₂} (C : Category ℓ₁ ℓ₂) where
open Category C
record Pullback (f : X ⟶ Z) (g : Y ⟶ Z) : Type (ℓ₁ ℓ⊔ ℓ₂) where
field
{P} : Ob
p₁ : P ⟶ X
p₂ : P ⟶ Y
commute : f · p₁ ≡ g · p₂
ump : ∀ {A : Ob} (h₁ : A ⟶ X) (h₂ : A ⟶ Y) → f · h₁ ≡ g · h₂ →
∃![ u ] ((p₁ · u ≡ h₁) × (p₂ · u ≡ h₂))
HasPullbacks : Type (ℓ₁ ℓ⊔ ℓ₂)
HasPullbacks = ∀ {X Y Z} (f : X ⟶ Z) (g : Y ⟶ Z) → Pullback f g
| 23.681818
| 66
| 0.49904
|
141bfd48fdc832301a7d3d0dfe6090d166ab6732
| 24,543
|
agda
|
Agda
|
Cubical/Algebra/CommRing/Localisation/Base.agda
|
apabepa10/cubical
|
3a9bb56260c25a6f2e9c20af8d278de0fe8d9e05
|
[
"MIT"
] | null | null | null |
Cubical/Algebra/CommRing/Localisation/Base.agda
|
apabepa10/cubical
|
3a9bb56260c25a6f2e9c20af8d278de0fe8d9e05
|
[
"MIT"
] | null | null | null |
Cubical/Algebra/CommRing/Localisation/Base.agda
|
apabepa10/cubical
|
3a9bb56260c25a6f2e9c20af8d278de0fe8d9e05
|
[
"MIT"
] | null | null | null |
-- We define the localisation of a commutative ring
-- at a multiplicatively closed subset and show that it
-- has a commutative ring structure.
{-# OPTIONS --cubical --no-import-sorts --safe --experimental-lossy-unification #-}
module Cubical.Algebra.CommRing.Localisation.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Powerset
open import Cubical.Foundations.Transport
open import Cubical.Functions.FunExtEquiv
import Cubical.Data.Empty as ⊥
open import Cubical.Data.Bool
open import Cubical.Data.Nat renaming ( _+_ to _+ℕ_ ; _·_ to _·ℕ_
; +-comm to +ℕ-comm ; +-assoc to +ℕ-assoc
; ·-assoc to ·ℕ-assoc ; ·-comm to ·ℕ-comm)
open import Cubical.Data.Vec
open import Cubical.Data.Sigma.Base
open import Cubical.Data.Sigma.Properties
open import Cubical.Data.FinData
open import Cubical.Relation.Nullary
open import Cubical.Relation.Binary
open import Cubical.Algebra.Group
open import Cubical.Algebra.AbGroup
open import Cubical.Algebra.Monoid
open import Cubical.Algebra.Ring
open import Cubical.Algebra.CommRing
open import Cubical.Algebra.RingSolver.CommRingSolver
open import Cubical.HITs.SetQuotients as SQ
open import Cubical.HITs.PropositionalTruncation as PT
open Iso
private
variable
ℓ ℓ' : Level
A : Type ℓ
-- A multiplicatively closed subset is assumed to contain 1
record isMultClosedSubset (R' : CommRing {ℓ}) (S' : ℙ (R' .fst)) : Type ℓ where
constructor
multclosedsubset
field
containsOne : (R' .snd .CommRingStr.1r) ∈ S'
multClosed : ∀ {s t} → s ∈ S' → t ∈ S' → (R' .snd .CommRingStr._·_ s t) ∈ S'
module Loc (R' : CommRing {ℓ}) (S' : ℙ (R' .fst)) (SMultClosedSubset : isMultClosedSubset R' S') where
open isMultClosedSubset
private R = R' .fst
open CommRingStr (R' .snd)
open Theory (CommRing→Ring R')
open CommTheory R'
S = Σ[ s ∈ R ] (s ∈ S')
-- We define the localisation of R by S by quotienting by the following relation:
_≈_ : R × S → R × S → Type ℓ
(r₁ , s₁) ≈ (r₂ , s₂) = Σ[ s ∈ S ] (fst s · r₁ · fst s₂ ≡ fst s · r₂ · fst s₁)
S⁻¹R = (R × S) / _≈_
-- now define addition for S⁻¹R
open BinaryRelation
locRefl : isRefl _≈_
locRefl _ = (1r , SMultClosedSubset .containsOne) , refl
locSym : isSym _≈_
locSym (r , s , s∈S') (r' , s' , s'∈S') (u , p) = u , sym p
open VarNames5 R'
locTrans : isTrans _≈_
locTrans (r , s , s∈S') (r' , s' , s'∈S') (r'' , s'' , s''∈S') ((u , u∈S') , p) ((v , v∈S') , q) =
((u · v · s') , SMultClosedSubset .multClosed (SMultClosedSubset .multClosed u∈S' v∈S') s'∈S')
, path
where
path : u · v · s' · r · s'' ≡ u · v · s' · r'' · s
path = u · v · s' · r · s'' ≡⟨ solve R' (X4 ·' X5 ·' X1 ·' X3 ·' X2)
(X4 ·' X3 ·' X1 ·' X5 ·' X2)
(s' ∷ s'' ∷ r ∷ u ∷ v ∷ [])
refl ⟩
u · r · s' · v · s'' ≡⟨ cong (λ x → x · v · s'') p ⟩
u · r' · s · v · s'' ≡⟨ cong (λ x → x · v · s'') (·-commAssocr _ _ _) ⟩
u · s · r' · v · s'' ≡⟨ cong (_· s'') (·-commAssocr _ _ _) ⟩
u · s · v · r' · s'' ≡⟨ cong (_· s'') (sym (·Assoc _ _ _)) ⟩
u · s · (v · r') · s'' ≡⟨ sym (·Assoc _ _ _) ⟩
u · s · (v · r' · s'') ≡⟨ cong (u · s ·_) q ⟩
u · s · (v · r'' · s') ≡⟨ ·Assoc _ _ _ ⟩
u · s · (v · r'') · s' ≡⟨ cong (_· s') (·-commAssocSwap _ _ _ _) ⟩
u · v · (s · r'') · s' ≡⟨ sym (·Assoc _ _ _) ⟩
u · v · (s · r'' · s') ≡⟨ cong (u · v ·_) (·-commAssocr2 _ _ _) ⟩
u · v · (s' · r'' · s) ≡⟨ ·Assoc _ _ _ ⟩
u · v · (s' · r'') · s ≡⟨ cong (_· s) (·Assoc _ _ _) ⟩
u · v · s' · r'' · s ∎
locIsEquivRel : isEquivRel _≈_
isEquivRel.reflexive locIsEquivRel = locRefl
isEquivRel.symmetric locIsEquivRel = locSym
isEquivRel.transitive locIsEquivRel = locTrans
_+ₗ_ : S⁻¹R → S⁻¹R → S⁻¹R
_+ₗ_ = setQuotBinOp locRefl _+ₚ_ θ
where
_+ₚ_ : R × S → R × S → R × S
(r₁ , s₁ , s₁∈S) +ₚ (r₂ , s₂ , s₂∈S) =
(r₁ · s₂ + r₂ · s₁) , (s₁ · s₂) , SMultClosedSubset .multClosed s₁∈S s₂∈S
θ : (a a' b b' : R × S) → a ≈ a' → b ≈ b' → (a +ₚ b) ≈ (a' +ₚ b')
θ (r₁ , s₁ , s₁∈S) (r'₁ , s'₁ , s'₁∈S) (r₂ , s₂ , s₂∈S) (r'₂ , s'₂ , s'₂∈S) (s , p) (s' , q) =
((fst s · fst s') , SMultClosedSubset .multClosed (s .snd) (s' .snd)) , path
where
path : fst s · fst s' · (r₁ · s₂ + r₂ · s₁) · (s'₁ · s'₂)
≡ fst s · fst s' · (r'₁ · s'₂ + r'₂ · s'₁) · (s₁ · s₂)
path = fst s · fst s' · (r₁ · s₂ + r₂ · s₁) · (s'₁ · s'₂)
≡⟨ cong (_· (s'₁ · s'₂)) (·Rdist+ _ _ _) ⟩
(fst s · fst s' · (r₁ · s₂) + fst s · fst s' · (r₂ · s₁)) · (s'₁ · s'₂)
≡⟨ ·Ldist+ _ _ _ ⟩
fst s · fst s' · (r₁ · s₂) · (s'₁ · s'₂) + fst s · fst s' · (r₂ · s₁) · (s'₁ · s'₂)
≡⟨ (λ i → ·Assoc (fst s · fst s') r₁ s₂ i · (s'₁ · s'₂)
+ ·Assoc (fst s · fst s') r₂ s₁ i · (s'₁ · s'₂)) ⟩
fst s · fst s' · r₁ · s₂ · (s'₁ · s'₂) + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → ·-comm (fst s) (fst s') i
· r₁ · s₂ · (s'₁ · s'₂) + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)) ⟩
fst s' · fst s · r₁ · s₂ · (s'₁ · s'₂) + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → ·Assoc (fst s') (fst s) r₁ (~ i)
· s₂ · (s'₁ · s'₂) + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)) ⟩
fst s' · (fst s · r₁) · s₂ · (s'₁ · s'₂) + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → ·Assoc (fst s' · (fst s · r₁) · s₂) s'₁ s'₂ i
+ fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)) ⟩
fst s' · (fst s · r₁) · s₂ · s'₁ · s'₂ + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → ·Assoc (fst s' · (fst s · r₁)) s₂ s'₁ (~ i)
· s'₂ + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)) ⟩
fst s' · (fst s · r₁) · (s₂ · s'₁) · s'₂ + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → fst s' · (fst s · r₁) · (·-comm s₂ s'₁ i) · s'₂
+ fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)) ⟩
fst s' · (fst s · r₁) · (s'₁ · s₂) · s'₂ + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → ·Assoc (fst s' · (fst s · r₁)) s'₁ s₂ i
· s'₂ + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)) ⟩
fst s' · (fst s · r₁) · s'₁ · s₂ · s'₂ + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → ·Assoc (fst s') (fst s · r₁) s'₁ (~ i)
· s₂ · s'₂ + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)) ⟩
fst s' · (fst s · r₁ · s'₁) · s₂ · s'₂ + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → fst s' · (p i) · s₂ · s'₂ + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)) ⟩
fst s' · (fst s · r'₁ · s₁) · s₂ · s'₂ + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → ·Assoc (fst s' · (fst s · r'₁ · s₁)) s₂ s'₂ (~ i)
+ fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)) ⟩
fst s' · (fst s · r'₁ · s₁) · (s₂ · s'₂) + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (·-comm s₂ s'₂ i)
+ fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · fst s' · r₂ · s₁ · (s'₁ · s'₂)
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ fst s · fst s' · r₂ · s₁ · ·-comm s'₁ s'₂ i) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · fst s' · r₂ · s₁ · (s'₂ · s'₁)
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s) (fst s') r₂ (~ i) · s₁ · (s'₂ · s'₁)) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r₂) · s₁ · (s'₂ · s'₁)
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s · (fst s' · r₂) · s₁) s'₂ s'₁ i) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r₂) · s₁ · s'₂ · s'₁
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s · (fst s' · r₂)) s₁ s'₂ (~ i) · s'₁) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r₂) · (s₁ · s'₂) · s'₁
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ fst s · (fst s' · r₂) · (·-comm s₁ s'₂ i) · s'₁) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r₂) · (s'₂ · s₁) · s'₁
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s · (fst s' · r₂)) s'₂ s₁ i · s'₁) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r₂) · s'₂ · s₁ · s'₁
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s) (fst s' · r₂) s'₂ (~ i) · s₁ · s'₁) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r₂ · s'₂) · s₁ · s'₁
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s · (fst s' · r₂ · s'₂)) s₁ s'₁ (~ i)) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r₂ · s'₂) · (s₁ · s'₁)
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ fst s · (q i) · (·-comm s₁ s'₁ i)) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r'₂ · s₂) · (s'₁ · s₁)
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s · (fst s' · r'₂ · s₂)) s'₁ s₁ i) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r'₂ · s₂) · s'₁ · s₁
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s) (fst s' · r'₂) s₂ i · s'₁ · s₁) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r'₂) · s₂ · s'₁ · s₁
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s · (fst s' · r'₂)) s₂ s'₁ (~ i) · s₁) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r'₂) · (s₂ · s'₁) · s₁
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ fst s · (fst s' · r'₂) · (·-comm s₂ s'₁ i) · s₁) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r'₂) · (s'₁ · s₂) · s₁
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s · (fst s' · r'₂)) s'₁ s₂ i · s₁) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r'₂) · s'₁ · s₂ · s₁
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s · (fst s' · r'₂) · s'₁) s₂ s₁ (~ i)) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · (fst s' · r'₂) · s'₁ · (s₂ · s₁)
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ ·Assoc (fst s) (fst s') r'₂ i · s'₁ · (s₂ · s₁)) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · fst s' · r'₂ · s'₁ · (s₂ · s₁)
≡⟨ (λ i → fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂)
+ fst s · fst s' · r'₂ · s'₁ · ·-comm s₂ s₁ i) ⟩
fst s' · (fst s · r'₁ · s₁) · (s'₂ · s₂) + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)
≡⟨ (λ i → ·Assoc (fst s' · (fst s · r'₁ · s₁)) s'₂ s₂ i
+ fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)) ⟩
fst s' · (fst s · r'₁ · s₁) · s'₂ · s₂ + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)
≡⟨ (λ i → ·Assoc (fst s') (fst s · r'₁) s₁ i
· s'₂ · s₂ + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)) ⟩
fst s' · (fst s · r'₁) · s₁ · s'₂ · s₂ + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)
≡⟨ (λ i → ·Assoc (fst s' · (fst s · r'₁)) s₁ s'₂ (~ i)
· s₂ + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)) ⟩
fst s' · (fst s · r'₁) · (s₁ · s'₂) · s₂ + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)
≡⟨ (λ i → fst s' · (fst s · r'₁) · (·-comm s₁ s'₂ i) · s₂
+ fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)) ⟩
fst s' · (fst s · r'₁) · (s'₂ · s₁) · s₂ + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)
≡⟨ (λ i → ·Assoc (fst s' · (fst s · r'₁)) s'₂ s₁ i
· s₂ + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)) ⟩
fst s' · (fst s · r'₁) · s'₂ · s₁ · s₂ + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)
≡⟨ (λ i → ·Assoc (fst s' · (fst s · r'₁) · s'₂) s₁ s₂ (~ i)
+ fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)) ⟩
fst s' · (fst s · r'₁) · s'₂ · (s₁ · s₂) + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)
≡⟨ (λ i → ·Assoc (fst s') (fst s) r'₁ i
· s'₂ · (s₁ · s₂) + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)) ⟩
fst s' · fst s · r'₁ · s'₂ · (s₁ · s₂) + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)
≡⟨ (λ i → ·-comm (fst s') (fst s) i
· r'₁ · s'₂ · (s₁ · s₂) + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)) ⟩
fst s · fst s' · r'₁ · s'₂ · (s₁ · s₂) + fst s · fst s' · r'₂ · s'₁ · (s₁ · s₂)
≡⟨ (λ i → ·Assoc (fst s · fst s') r'₁ s'₂ (~ i) · (s₁ · s₂)
+ ·Assoc (fst s · fst s') r'₂ s'₁ (~ i) · (s₁ · s₂)) ⟩
fst s · fst s' · (r'₁ · s'₂) · (s₁ · s₂) + fst s · fst s' · (r'₂ · s'₁) · (s₁ · s₂)
≡⟨ sym (·Ldist+ _ _ _) ⟩
(fst s · fst s' · (r'₁ · s'₂) + fst s · fst s' · (r'₂ · s'₁)) · (s₁ · s₂)
≡⟨ cong (_· (s₁ · s₂)) (sym (·Rdist+ _ _ _)) ⟩
fst s · fst s' · (r'₁ · s'₂ + r'₂ · s'₁) · (s₁ · s₂) ∎
-- check group-laws for addition
+ₗ-assoc : (x y z : S⁻¹R) → x +ₗ (y +ₗ z) ≡ (x +ₗ y) +ₗ z
+ₗ-assoc = SQ.elimProp3 (λ _ _ _ → squash/ _ _) +ₗ-assoc[]
where
+ₗ-assoc[] : (a b c : R × S) → [ a ] +ₗ ([ b ] +ₗ [ c ]) ≡ ([ a ] +ₗ [ b ]) +ₗ [ c ]
+ₗ-assoc[] (r , s , s∈S) (r' , s' , s'∈S) (r'' , s'' , s''∈S) =
cong [_] (ΣPathP (path , Σ≡Prop (λ x → ∈-isProp S' x) (·Assoc _ _ _)))
where
path : r · (s' · s'') + (r' · s'' + r'' · s') · s
≡ (r · s' + r' · s) · s'' + r'' · (s · s')
path = r · (s' · s'') + (r' · s'' + r'' · s') · s
≡⟨ (λ i → ·Assoc r s' s'' i + ·Ldist+ (r' · s'') (r'' · s') s i) ⟩
r · s' · s'' + (r' · s'' · s + r'' · s' · s)
≡⟨ +Assoc _ _ _ ⟩
r · s' · s'' + r' · s'' · s + r'' · s' · s
≡⟨ (λ i → r · s' · s'' + ·Assoc r' s'' s (~ i) + ·Assoc r'' s' s (~ i)) ⟩
r · s' · s'' + r' · (s'' · s) + r'' · (s' · s)
≡⟨ (λ i → r · s' · s'' + r' · (·-comm s'' s i) + r'' · (·-comm s' s i)) ⟩
r · s' · s'' + r' · (s · s'') + r'' · (s · s')
≡⟨ (λ i → r · s' · s'' + ·Assoc r' s s'' i + r'' · (s · s')) ⟩
r · s' · s'' + r' · s · s'' + r'' · (s · s')
≡⟨ (λ i → ·Ldist+ (r · s') (r' · s) s'' (~ i) + r'' · (s · s')) ⟩
(r · s' + r' · s) · s'' + r'' · (s · s') ∎
0ₗ : S⁻¹R
0ₗ = [ 0r , 1r , SMultClosedSubset .containsOne ]
+ₗ-rid : (x : S⁻¹R) → x +ₗ 0ₗ ≡ x
+ₗ-rid = SQ.elimProp (λ _ → squash/ _ _) +ₗ-rid[]
where
+ₗ-rid[] : (a : R × S) → [ a ] +ₗ 0ₗ ≡ [ a ]
+ₗ-rid[] (r , s , s∈S) = path
where
eq1 : r · 1r + 0r · s ≡ r
eq1 = cong (r · 1r +_) (0LeftAnnihilates _) ∙∙ +Rid _ ∙∙ ·Rid _
path : [ r · 1r + 0r · s , s · 1r , SMultClosedSubset .multClosed s∈S
(SMultClosedSubset .containsOne) ]
≡ [ r , s , s∈S ]
path = cong [_] (ΣPathP (eq1 , Σ≡Prop (λ x → ∈-isProp S' x) (·Rid _)))
-ₗ_ : S⁻¹R → S⁻¹R
-ₗ_ = SQ.rec squash/ -ₗ[] -ₗWellDef
where
-ₗ[] : R × S → S⁻¹R
-ₗ[] (r , s) = [ - r , s ]
-ₗWellDef : (a b : R × S) → a ≈ b → -ₗ[] a ≡ -ₗ[] b
-ₗWellDef (r , s , _) (r' , s' , _) (u , p) = eq/ _ _ (u , path)
where
path : fst u · - r · s' ≡ fst u · - r' · s
path = fst u · - r · s' ≡⟨ cong (_· s') (-DistR· _ _) ⟩
- (fst u · r) · s' ≡⟨ -DistL· _ _ ⟩
- (fst u · r · s') ≡⟨ cong -_ p ⟩
- (fst u · r' · s) ≡⟨ sym (-DistL· _ _) ⟩
- (fst u · r') · s ≡⟨ cong (_· s) (sym (-DistR· _ _)) ⟩
fst u · - r' · s ∎
+ₗ-rinv : (x : S⁻¹R) → x +ₗ (-ₗ x) ≡ 0ₗ
+ₗ-rinv = SQ.elimProp (λ _ → squash/ _ _) +ₗ-rinv[]
where
+ₗ-rinv[] : (a : R × S) → ([ a ] +ₗ (-ₗ [ a ])) ≡ 0ₗ
+ₗ-rinv[] (r , s , s∈S) = eq/ _ _ ((1r , SMultClosedSubset .containsOne) , path)
where
path : 1r · (r · s + - r · s) · 1r ≡ 1r · 0r · (s · s)
path = 1r · (r · s + - r · s) · 1r ≡⟨ cong (λ x → 1r · (r · s + x) · 1r) (-DistL· _ _) ⟩
1r · (r · s + - (r · s)) · 1r ≡⟨ cong (λ x → 1r · x · 1r) (+Rinv _) ⟩
1r · 0r · 1r ≡⟨ ·Rid _ ⟩
1r · 0r ≡⟨ ·Lid _ ⟩
0r ≡⟨ sym (0LeftAnnihilates _) ⟩
0r · (s · s) ≡⟨ cong (_· (s · s)) (sym (·Lid _)) ⟩
1r · 0r · (s · s) ∎
+ₗ-comm : (x y : S⁻¹R) → x +ₗ y ≡ y +ₗ x
+ₗ-comm = SQ.elimProp2 (λ _ _ → squash/ _ _) +ₗ-comm[]
where
+ₗ-comm[] : (a b : R × S) → ([ a ] +ₗ [ b ]) ≡ ([ b ] +ₗ [ a ])
+ₗ-comm[] (r , s , s∈S) (r' , s' , s'∈S) =
cong [_] (ΣPathP ((+Comm _ _) , Σ≡Prop (λ x → ∈-isProp S' x) (·-comm _ _)))
-- Now for multiplication
_·ₗ_ : S⁻¹R → S⁻¹R → S⁻¹R
_·ₗ_ = setQuotBinOp locRefl _·ₚ_ θ
where
_·ₚ_ : R × S → R × S → R × S
(r₁ , s₁ , s₁∈S) ·ₚ (r₂ , s₂ , s₂∈S) =
(r₁ · r₂) , ((s₁ · s₂) , SMultClosedSubset .multClosed s₁∈S s₂∈S)
θ : (a a' b b' : R × S) → a ≈ a' → b ≈ b' → (a ·ₚ b) ≈ (a' ·ₚ b')
θ (r₁ , s₁ , s₁∈S) (r'₁ , s'₁ , s'₁∈S) (r₂ , s₂ , s₂∈S) (r'₂ , s'₂ , s'₂∈S) (s , p) (s' , q) =
((fst s · fst s') , SMultClosedSubset .multClosed (s .snd) (s' .snd)) , path
where
path : fst s · fst s' · (r₁ · r₂) · (s'₁ · s'₂)
≡ fst s · fst s' · (r'₁ · r'₂) · (s₁ · s₂)
path = fst s · fst s' · (r₁ · r₂) · (s'₁ · s'₂)
≡⟨ (λ i → ·Assoc (fst s · fst s') r₁ r₂ i · (s'₁ · s'₂)) ⟩
fst s · fst s' · r₁ · r₂ · (s'₁ · s'₂)
≡⟨ (λ i → ·Assoc (fst s · fst s' · r₁ · r₂) s'₁ s'₂ i) ⟩
fst s · fst s' · r₁ · r₂ · s'₁ · s'₂
≡⟨ (λ i → ·Assoc (fst s) (fst s') r₁ (~ i) · r₂ · s'₁ · s'₂) ⟩
fst s · (fst s' · r₁) · r₂ · s'₁ · s'₂
≡⟨ (λ i → fst s · (·-comm (fst s') r₁ i) · r₂ · s'₁ · s'₂) ⟩
fst s · (r₁ · fst s') · r₂ · s'₁ · s'₂
≡⟨ (λ i → ·Assoc (fst s) r₁ (fst s') i · r₂ · s'₁ · s'₂) ⟩
fst s · r₁ · fst s' · r₂ · s'₁ · s'₂
≡⟨ (λ i → ·Assoc (fst s · r₁ · fst s') r₂ s'₁ (~ i) · s'₂) ⟩
fst s · r₁ · fst s' · (r₂ · s'₁) · s'₂
≡⟨ (λ i → fst s · r₁ · fst s' · (·-comm r₂ s'₁ i) · s'₂) ⟩
fst s · r₁ · fst s' · (s'₁ · r₂) · s'₂
≡⟨ (λ i → ·Assoc (fst s · r₁ · fst s') s'₁ r₂ i · s'₂) ⟩
fst s · r₁ · fst s' · s'₁ · r₂ · s'₂
≡⟨ (λ i → ·Assoc (fst s · r₁) (fst s') s'₁ (~ i) · r₂ · s'₂) ⟩
fst s · r₁ · (fst s' · s'₁) · r₂ · s'₂
≡⟨ (λ i → fst s · r₁ · (·-comm (fst s') s'₁ i) · r₂ · s'₂) ⟩
fst s · r₁ · (s'₁ · fst s') · r₂ · s'₂
≡⟨ (λ i → ·Assoc (fst s · r₁) s'₁ (fst s') i · r₂ · s'₂) ⟩
fst s · r₁ · s'₁ · fst s' · r₂ · s'₂
≡⟨ (λ i → ·Assoc (fst s · r₁ · s'₁) (fst s') r₂ (~ i) · s'₂) ⟩
fst s · r₁ · s'₁ · (fst s' · r₂) · s'₂
≡⟨ (λ i → ·Assoc (fst s · r₁ · s'₁) (fst s' · r₂) s'₂ (~ i)) ⟩
fst s · r₁ · s'₁ · (fst s' · r₂ · s'₂)
≡⟨ (λ i → (p i) · (q i)) ⟩
fst s · r'₁ · s₁ · (fst s' · r'₂ · s₂)
≡⟨ (λ i → ·Assoc (fst s · r'₁ · s₁) (fst s' · r'₂) s₂ i) ⟩
fst s · r'₁ · s₁ · (fst s' · r'₂) · s₂
≡⟨ (λ i → ·Assoc (fst s · r'₁ · s₁) (fst s') r'₂ i · s₂) ⟩
fst s · r'₁ · s₁ · fst s' · r'₂ · s₂
≡⟨ (λ i → ·Assoc (fst s · r'₁) s₁ (fst s') (~ i) · r'₂ · s₂) ⟩
fst s · r'₁ · (s₁ · fst s') · r'₂ · s₂
≡⟨ (λ i → fst s · r'₁ · (·-comm s₁ (fst s') i) · r'₂ · s₂) ⟩
fst s · r'₁ · (fst s' · s₁) · r'₂ · s₂
≡⟨ (λ i → ·Assoc (fst s · r'₁) (fst s') s₁ i · r'₂ · s₂) ⟩
fst s · r'₁ · fst s' · s₁ · r'₂ · s₂
≡⟨ (λ i → ·Assoc (fst s · r'₁ · fst s') s₁ r'₂ (~ i) · s₂) ⟩
fst s · r'₁ · fst s' · (s₁ · r'₂) · s₂
≡⟨ (λ i → fst s · r'₁ · fst s' · (·-comm s₁ r'₂ i) · s₂) ⟩
fst s · r'₁ · fst s' · (r'₂ · s₁) · s₂
≡⟨ (λ i → ·Assoc (fst s · r'₁ · fst s') r'₂ s₁ i · s₂) ⟩
fst s · r'₁ · fst s' · r'₂ · s₁ · s₂
≡⟨ (λ i → ·Assoc (fst s) r'₁ (fst s') (~ i) · r'₂ · s₁ · s₂) ⟩
fst s · (r'₁ · fst s') · r'₂ · s₁ · s₂
≡⟨ (λ i → fst s · (·-comm r'₁ (fst s') i) · r'₂ · s₁ · s₂) ⟩
fst s · (fst s' · r'₁) · r'₂ · s₁ · s₂
≡⟨ (λ i → ·Assoc (fst s) (fst s') r'₁ i · r'₂ · s₁ · s₂) ⟩
fst s · fst s' · r'₁ · r'₂ · s₁ · s₂
≡⟨ (λ i → ·Assoc (fst s · fst s' · r'₁ · r'₂) s₁ s₂ (~ i)) ⟩
fst s · fst s' · r'₁ · r'₂ · (s₁ · s₂)
≡⟨ (λ i → ·Assoc (fst s · fst s') r'₁ r'₂ (~ i) · (s₁ · s₂)) ⟩
fst s · fst s' · (r'₁ · r'₂) · (s₁ · s₂) ∎
-- checking laws for multiplication
1ₗ : S⁻¹R
1ₗ = [ 1r , 1r , SMultClosedSubset .containsOne ]
·ₗ-assoc : (x y z : S⁻¹R) → x ·ₗ (y ·ₗ z) ≡ (x ·ₗ y) ·ₗ z
·ₗ-assoc = SQ.elimProp3 (λ _ _ _ → squash/ _ _) ·ₗ-assoc[]
where
·ₗ-assoc[] : (a b c : R × S) → [ a ] ·ₗ ([ b ] ·ₗ [ c ]) ≡ ([ a ] ·ₗ [ b ]) ·ₗ [ c ]
·ₗ-assoc[] (r , s , s∈S) (r' , s' , s'∈S) (r'' , s'' , s''∈S) =
cong [_] (ΣPathP ((·Assoc _ _ _) , Σ≡Prop (λ x → ∈-isProp S' x) (·Assoc _ _ _)))
·ₗ-rid : (x : S⁻¹R) → x ·ₗ 1ₗ ≡ x
·ₗ-rid = SQ.elimProp (λ _ → squash/ _ _) ·ₗ-rid[]
where
·ₗ-rid[] : (a : R × S) → ([ a ] ·ₗ 1ₗ) ≡ [ a ]
·ₗ-rid[] (r , s , s∈S) = cong [_] (ΣPathP ((·Rid _) , Σ≡Prop (λ x → ∈-isProp S' x) (·Rid _)))
·ₗ-rdist-+ₗ : (x y z : S⁻¹R) → x ·ₗ (y +ₗ z) ≡ (x ·ₗ y) +ₗ (x ·ₗ z)
·ₗ-rdist-+ₗ = SQ.elimProp3 (λ _ _ _ → squash/ _ _) ·ₗ-rdist-+ₗ[]
where
·ₗ-rdist-+ₗ[] : (a b c : R × S) → [ a ] ·ₗ ([ b ] +ₗ [ c ]) ≡ ([ a ] ·ₗ [ b ]) +ₗ ([ a ] ·ₗ [ c ])
·ₗ-rdist-+ₗ[] (r , s , s∈S) (r' , s' , s'∈S) (r'' , s'' , s''∈S) =
eq/ _ _ ((1r , (SMultClosedSubset .containsOne)) , path)
where
path : 1r · (r · (r' · s'' + r'' · s')) · (s · s' · (s · s''))
≡ 1r · (r · r' · (s · s'') + r · r'' · (s · s')) · (s · (s' · s''))
path = 1r · (r · (r' · s'' + r'' · s')) · (s · s' · (s · s''))
≡⟨ (λ i → ·Lid (r · (r' · s'' + r'' · s')) i · (s · s' · (s · s''))) ⟩
r · (r' · s'' + r'' · s') · (s · s' · (s · s''))
≡⟨ (λ i → ·Rdist+ r (r' · s'') (r'' · s') i · (s · s' · (s · s''))) ⟩
(r · (r' · s'') + r · (r'' · s')) · (s · s' · (s · s''))
≡⟨ (λ i → (·Assoc r r' s'' i + ·Assoc r r'' s' i) · (s · s' · (s · s''))) ⟩
(r · r' · s'' + r · r'' · s') · (s · s' · (s · s''))
≡⟨ (λ i → (r · r' · s'' + r · r'' · s') · (·Assoc s s' (s · s'') (~ i))) ⟩
(r · r' · s'' + r · r'' · s') · (s · (s' · (s · s'')))
≡⟨ (λ i → ·Assoc (r · r' · s'' + r · r'' · s') s (s' · (s · s'')) i) ⟩
(r · r' · s'' + r · r'' · s') · s · (s' · (s · s''))
≡⟨ (λ i → ·Ldist+ (r · r' · s'') (r · r'' · s') s i · (·Assoc s' s s'' i)) ⟩
(r · r' · s'' · s + r · r'' · s' · s) · (s' · s · s'')
≡⟨ (λ i → (·Assoc (r · r') s'' s (~ i) + ·Assoc (r · r'') s' s (~ i)) · ((·-comm s' s i) · s'')) ⟩
(r · r' · (s'' · s) + r · r'' · (s' · s)) · (s · s' · s'')
≡⟨ (λ i → (r · r' · (·-comm s'' s i) + r · r'' · (·-comm s' s i)) · (·Assoc s s' s'' (~ i))) ⟩
(r · r' · (s · s'') + r · r'' · (s · s')) · (s · (s' · s''))
≡⟨ (λ i → ·Lid (r · r' · (s · s'') + r · r'' · (s · s')) (~ i) · (s · (s' · s''))) ⟩
1r · (r · r' · (s · s'') + r · r'' · (s · s')) · (s · (s' · s'')) ∎
·ₗ-comm : (x y : S⁻¹R) → x ·ₗ y ≡ y ·ₗ x
·ₗ-comm = SQ.elimProp2 (λ _ _ → squash/ _ _) ·ₗ-comm[]
where
·ₗ-comm[] : (a b : R × S) → [ a ] ·ₗ [ b ] ≡ [ b ] ·ₗ [ a ]
·ₗ-comm[] (r , s , s∈S) (r' , s' , s'∈S) =
cong [_] (ΣPathP ((·-comm _ _) , Σ≡Prop (λ x → ∈-isProp S' x) (·-comm _ _)))
-- Commutative ring structure on S⁻¹R
S⁻¹RAsCommRing : CommRing
S⁻¹RAsCommRing = S⁻¹R , S⁻¹RCommRingStr
where
open CommRingStr
S⁻¹RCommRingStr : CommRingStr S⁻¹R
0r S⁻¹RCommRingStr = 0ₗ
1r S⁻¹RCommRingStr = 1ₗ
_+_ S⁻¹RCommRingStr = _+ₗ_
_·_ S⁻¹RCommRingStr = _·ₗ_
- S⁻¹RCommRingStr = -ₗ_
isCommRing S⁻¹RCommRingStr = makeIsCommRing squash/ +ₗ-assoc +ₗ-rid +ₗ-rinv +ₗ-comm
·ₗ-assoc ·ₗ-rid ·ₗ-rdist-+ₗ ·ₗ-comm
| 52.33049
| 109
| 0.37583
|
7369a9b296ad05d90e5a68a014abf5a7a53deb9c
| 2,049
|
agda
|
Agda
|
Universe/index.agda
|
sattlerc/HoTT-Agda
|
c8fb8da3354fc9e0c430ac14160161759b4c5b37
|
[
"MIT"
] | null | null | null |
Universe/index.agda
|
sattlerc/HoTT-Agda
|
c8fb8da3354fc9e0c430ac14160161759b4c5b37
|
[
"MIT"
] | null | null | null |
Universe/index.agda
|
sattlerc/HoTT-Agda
|
c8fb8da3354fc9e0c430ac14160161759b4c5b37
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K #-}
{- *** Definition 5.3 and Lemma 5.5 are taken from the library ***
*** Corollary 6.8 is too trivial a consequence of -}
{- ConnectednessAlt and the last submodule of Connection are the
only modules importing real truncation types from the library.
Except for that, Univalence is the only additional assumption
to Agda-style MLTT we work with. -}
module Universe.index where
{- General utility funcions and type constructors for
the pseudo-universe of types of fixed truncation level. -}
import Universe.Utility.General
import Universe.Utility.TruncUniverse
{- Pointed types.
Corresponds to section 4 plus some lemmata of section 5,
which are used in multiple modules and thus belong here. -}
-- *** Definitions 4.1, 4.3, 4.5, 4.6 and Lemmata 4.5, 4.7, 5.1, 5.4 ***
import Universe.Utility.Pointed
{- Homotopically complicated types.
Corresponds to section 5 sans the initial lemma.
Concludes with the main theorem that the n-types
in the n-th universe from a strict n-type.
Hierarchy and Trunc.* are mutually independent. -}
{- *** Lemmata 5.2, 5.7, 5.8(*), Theorems 5.9, 5.11, and Corollary 5.6 ***
(*) a slightly weaker version -}
import Universe.Hierarchy
{- Connectedness constructions
Corresponds to section 6 and 7.
The first three modules develop a framework of
truncations internal to MLTT+Univalence without truncations.
Connection contains the main result of section 6.
ConnectednessAlt is independent from the first four modules
and presents a provably equivalent definition of n-connectedness
using only propositional truncation (as remarked in the article
and mentioned in an exercise in the HoTT book). -}
--- *** Definition 6.2, Lemma 6.6
import Universe.Trunc.Universal
--- *** Definition 6.4, Lemma 6.7 ***
import Universe.Trunc.Basics
--- *** Lemmata 6.9, 6.10
import Universe.Trunc.TypeConstructors
--- *** Definitions 6.11, 6.13, Lemmata 6.12, 6.14, 6.15
import Universe.Trunc.Connection
import Universe.Trunc.ConnectednessAlt
| 37.944444
| 74
| 0.735481
|
30526c6a3c2a469d2d990cffbdf8032961997fbb
| 1,523
|
agda
|
Agda
|
Definition/Typed/Consequences/NeTypeEq.agda
|
loic-p/logrel-mltt
|
2251b8da423be0c6fb916f2675d7bd8537e4cd96
|
[
"MIT"
] | null | null | null |
Definition/Typed/Consequences/NeTypeEq.agda
|
loic-p/logrel-mltt
|
2251b8da423be0c6fb916f2675d7bd8537e4cd96
|
[
"MIT"
] | null | null | null |
Definition/Typed/Consequences/NeTypeEq.agda
|
loic-p/logrel-mltt
|
2251b8da423be0c6fb916f2675d7bd8537e4cd96
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K --safe #-}
module Definition.Typed.Consequences.NeTypeEq where
open import Definition.Untyped
open import Definition.Typed
open import Definition.Typed.Consequences.Syntactic
open import Definition.Typed.Consequences.Injectivity
open import Definition.Typed.Consequences.Substitution
open import Tools.Product
import Tools.PropositionalEquality as PE
-- Helper function for the same variable instance of a context have equal types.
varTypeEq′ : ∀ {n R T Γ} → n ∷ R ∈ Γ → n ∷ T ∈ Γ → R PE.≡ T
varTypeEq′ here here = PE.refl
varTypeEq′ (there n∷R) (there n∷T) rewrite varTypeEq′ n∷R n∷T = PE.refl
-- The same variable instance of a context have equal types.
varTypeEq : ∀ {x A B Γ} → Γ ⊢ A → Γ ⊢ B → x ∷ A ∈ Γ → x ∷ B ∈ Γ → Γ ⊢ A ≡ B
varTypeEq A B x∷A x∷B rewrite varTypeEq′ x∷A x∷B = refl A
-- The same neutral term have equal types.
neTypeEq : ∀ {t A B Γ} → Neutral t → Γ ⊢ t ∷ A → Γ ⊢ t ∷ B → Γ ⊢ A ≡ B
neTypeEq (var x) (var x₁ x₂) (var x₃ x₄) =
varTypeEq (syntacticTerm (var x₃ x₂)) (syntacticTerm (var x₃ x₄)) x₂ x₄
neTypeEq (∘ₙ neT) (t∷A ∘ⱼ t∷A₁) (t∷B ∘ⱼ t∷B₁) with neTypeEq neT t∷A t∷B
... | q = let w = proj₂ (injectivity q)
in substTypeEq w (refl t∷A₁)
neTypeEq (natrecₙ neT) (natrecⱼ x t∷A t∷A₁ t∷A₂) (natrecⱼ x₁ t∷B t∷B₁ t∷B₂) =
refl (substType x₁ t∷B₂)
neTypeEq x (conv t∷A x₁) t∷B = let q = neTypeEq x t∷A t∷B
in trans (sym x₁) q
neTypeEq x t∷A (conv t∷B x₃) = let q = neTypeEq x t∷A t∷B
in trans q x₃
| 41.162162
| 80
| 0.643467
|
19c0610c5c60cdea32e4c66749d50700efae9f78
| 14,959
|
agda
|
Agda
|
README/Pointers-to-results-from-the-paper.agda
|
nad/definitional-interpreters
|
dec8cd2d2851340840de25acb0feb78f7b5ffe96
|
[
"MIT"
] | null | null | null |
README/Pointers-to-results-from-the-paper.agda
|
nad/definitional-interpreters
|
dec8cd2d2851340840de25acb0feb78f7b5ffe96
|
[
"MIT"
] | null | null | null |
README/Pointers-to-results-from-the-paper.agda
|
nad/definitional-interpreters
|
dec8cd2d2851340840de25acb0feb78f7b5ffe96
|
[
"MIT"
] | null | null | null |
------------------------------------------------------------------------
-- Pointers to results from the paper
------------------------------------------------------------------------
module README.Pointers-to-results-from-the-paper where
open import Prelude using (Type)
open import Prelude.Size using (∞)
import Colist
import Conat
import Omniscience
import Delay-monad
import Delay-monad.Bisimilarity
import Delay-monad.Monad
import Delay-monad.Quantitative-weak-bisimilarity
import Only-allocation
import Unbounded-space
import Upper-bounds
import Lambda.Compiler
import Lambda.Compiler-correctness
import Lambda.Compiler-correctness.Sizes-match
import Lambda.Compiler-correctness.Steps-match
import Lambda.Delay-crash
import Lambda.Delay-crash-trace
import Lambda.Interpreter
import Lambda.Interpreter.Stack-sizes
import Lambda.Interpreter.Stack-sizes.Counterexample
import Lambda.Interpreter.Stack-sizes.Example
import Lambda.Interpreter.Steps
import Lambda.Interpreter.Steps.Counterexample
import Lambda.Virtual-machine
import Lambda.Virtual-machine.Instructions
import Lambda.Syntax
------------------------------------------------------------------------
-- Section 2
-- Conatural numbers.
Conat = Conat.Conat
Conat′ = Conat.Conat′
-- Infinity.
infinity = Conat.infinity
-- Ordering.
[_]_≤_ = Conat.[_]_≤_
[_]_≤′_ = Conat.[_]_≤′_
-- Bisimilarity.
[_]_∼N_ = Conat.[_]_∼_
------------------------------------------------------------------------
-- Section 3
-- Programs.
Stmt = Only-allocation.Stmt
Program = Only-allocation.Program
-- Colists.
Colist = Colist.Colist
-- The interpreter.
modify = Unbounded-space.modify
⟦_⟧₁ = Unbounded-space.⟦_⟧
⟦_⟧′ = Unbounded-space.⟦_⟧′
-- Upper bounds.
[_]_⊑_ = Upper-bounds.[_]_⊑_
[_]_⊑′_ = Upper-bounds.[_]_⊑′_
-- The □ predicate.
□ = Colist.□
-- Least upper bounds.
LUB = Upper-bounds.LUB
-- Least upper bounds are unique up to bisimilarity.
lub-unique = Upper-bounds.lub-unique
-- Antisymmetry for conatural numbers.
antisymmetric = Conat.antisymmetric-≤
-- WLPO.
WLPO = Omniscience.WLPO
-- WLPO is classically valid: it follows from excluded middle and
-- extensionality for functions.
LEM→WLPO = Omniscience.LEM→WLPO
-- WLPO is logically equivalent to one formulation of "least upper
-- bounds exist for every colist".
wlpo⇔lub = Unbounded-space.wlpo⇔lub
-- Maximum heap usage.
Heap-usage = Unbounded-space.Heap-usage
-- This was not mentioned in the paper, but WLPO is also logically
-- equivalent to one formulation of "maximum heap usages exist for
-- every program".
wlpo⇔max = Unbounded-space.wlpo⇔max
-- The maximum heap usage is unique up to bisimilarity.
max-unique = Unbounded-space.max-unique
-- Some examples.
bounded = Only-allocation.bounded
bounded₂ = Only-allocation.bounded₂
unbounded = Only-allocation.unbounded
_∷′_ = Colist._∷′_
-- The example programs have infinitely long traces.
bounded-loops = Unbounded-space.bounded-loops
bounded₂-loops = Unbounded-space.bounded₂-loops
unbounded-loops = Unbounded-space.unbounded-loops
-- Properties showing that the example programs have certain maximum
-- heap usages.
max-bounded-1 = Unbounded-space.max-bounded-1
max-bounded₂-2 = Unbounded-space.max-bounded₂-2
max-unbounded-∞ = Unbounded-space.max-unbounded-∞
-- If no natural number is an upper bound of the heap usage of p, then
-- the maximum heap usage of p is infinity.
no-finite-max→infinite-max = Unbounded-space.no-finite-max→infinite-max
-- If no natural number is an upper bound of ms, but the conatural
-- number m is, then m is bisimilar to infinity.
no-finite→infinite = Upper-bounds.no-finite→infinite
------------------------------------------------------------------------
-- Section 4
-- The optimiser.
opt = Unbounded-space.opt
-- The optimiser improves the space complexity of at least one
-- program.
opt-improves = Unbounded-space.opt-improves
-- The semantics of optimise bounded-space₂ matches that of
-- bounded-space.
opt-bounded₂∼bounded = Unbounded-space.opt-bounded₂∼bounded
-- Bisimilarity of colists.
[_]_∼L_ = Colist.[_]_∼_
-- The maximum heap usage of an optimised program is at most as high
-- as that of the original program (assuming that these maximums
-- exist).
opt-correct = Unbounded-space.opt-correct
-- The [_]_≲_ relation.
[_]_≲_ = Upper-bounds.[_]_≲_
[_]_≲′_ = Upper-bounds.[_]_≲′_
-- If ms has the least upper bound m, and ns has the least upper bound
-- n, then ms is bounded by ns if and only if m is bounded by n.
≲⇔least-upper-bounds-≤ = Upper-bounds.≲⇔least-upper-bounds-≤
-- Four combinators that can be used to prove that one colist is
-- bounded by another.
[]≲ = Upper-bounds.[]≲
consʳ-≲ = Upper-bounds.consʳ-≲
consˡ-≲ = Upper-bounds.consˡ-≲
cons′-≲ = Upper-bounds.cons′-≲
Bounded = Upper-bounds.Bounded
-- If consʳ-≲ had taken the primed variant of the relation as an
-- argument instead, then one could have proved that any colist was
-- bounded by any infinite colist, and this leads to a contradiction.
consʳ-≲′→≲-infinite = Upper-bounds.consʳ-≲′→≲-infinite
¬-consʳ-≲′ = Upper-bounds.¬-consʳ-≲′
-- The [_]_≲_ relation is a preorder. (The transitivity result has a
-- type signature that differs slightly from that given in the paper.)
reflexive-≲ = Upper-bounds._□≲
transitive-≲ = Upper-bounds.step-≲
-- Transitivity cannot be made size-preserving in the second argument.
¬-transitivity-size-preservingʳ =
Upper-bounds.¬-transitivity-size-preservingʳ
-- A size-preserving variant of transitivity. (This result has a
-- type signature that differs slightly from that given in the paper.)
transitive-∼≲ = Upper-bounds.step-∼≲
-- The main lemma used to prove that the maximum heap usage of an
-- optimised program is at most as high as that of the original
-- program (assuming that these maximums exist).
opt-correct-≲ = Unbounded-space.opt-correct-≲
------------------------------------------------------------------------
-- Section 5
-- The delay monad.
Delay = Delay-monad.Delay
-- The non-terminating computation never.
never = Delay-monad.never
-- Monad instance.
monad-instance₁ = Delay-monad.Monad.delay-raw-monad
-- Strong bisimilarity.
[_]_∼D_ = Delay-monad.Bisimilarity.[_]_∼_
-- Monad laws.
left-identity₁ = Delay-monad.Monad.left-identity′
right-identity₁ = Delay-monad.Monad.right-identity′
associativity₁ = Delay-monad.Monad.associativity′
-- Weak bisimilarity. (This relation is not defined in exactly the
-- same way as in the paper.)
[_]_≈D_ = Delay-monad.Bisimilarity.[_]_≈_
------------------------------------------------------------------------
-- Section 6
-- Terms.
Tm = Lambda.Syntax.Tm
-- Environments and values. (The code uses a definition which is
-- parametrised by the type of terms. The same definition is used also
-- for virtual machine environments and values.)
Env = Lambda.Syntax.Closure.Env
Value = Lambda.Syntax.Closure.Value
-- DelayC (called Delay-crash in the code) and crash.
DelayC = Lambda.Delay-crash.Delay-crash
crash : {A : Type} → DelayC A ∞
crash = Lambda.Delay-crash.crash
-- The computation crash (in fact, any computation of the form now x)
-- is not weakly bisimilar to never.
now≉never = Delay-monad.Bisimilarity.now≉never
-- The interpreter.
_∙_ = Lambda.Interpreter._∙_
⟦_⟧₂ = Lambda.Interpreter.⟦_⟧
⟦if⟧ = Lambda.Interpreter.⟦if⟧
------------------------------------------------------------------------
-- Section 7
-- DelayCT (called Delay-crash-trace in the code).
DelayCT = Lambda.Delay-crash-trace.Delay-crash-trace
trace = Lambda.Delay-crash-trace.trace
delayC = Lambda.Delay-crash-trace.delay-crash
-- Monad instance.
monad-instance₂ = Lambda.Delay-crash-trace.raw-monad
-- Strong bisimilarity.
[_]_∼DCT_ = Lambda.Delay-crash-trace.[_]_∼_
-- Monad laws.
left-identity₂ = Lambda.Delay-crash-trace.left-identity
right-identity₂ = Lambda.Delay-crash-trace.right-identity
associativity₂ = Lambda.Delay-crash-trace.associativity
-- Instructions and code.
Instr = Lambda.Virtual-machine.Instructions.Instr
Code = Lambda.Virtual-machine.Instructions.Code
-- Environments and values. (The code uses a definition which is
-- parametrised by the type of terms. The same definition is used also
-- for the interpreter's environments and values.)
VM-Env = Lambda.Syntax.Closure.Env
VM-Value = Lambda.Syntax.Closure.Value
-- Stack elements and stacks.
Stack-element = Lambda.Virtual-machine.Instructions.Stack-element
Stack = Lambda.Virtual-machine.Instructions.Stack
-- States.
State = Lambda.Virtual-machine.Instructions.State
-- The virtual machine.
Result = Lambda.Virtual-machine.Instructions.Result
step = Lambda.Virtual-machine.step
exec⁺ = Lambda.Virtual-machine.exec⁺
exec⁺′ = Lambda.Virtual-machine.exec⁺′
exec = Lambda.Virtual-machine.exec
stack-sizes = Lambda.Virtual-machine.stack-sizes
------------------------------------------------------------------------
-- Section 8
-- Tail context information.
In-tail-context = Lambda.Compiler.In-tail-context
-- The compilation functions.
comp = Lambda.Compiler.comp
comp-body = Lambda.Compiler.comp-body
comp-name = Lambda.Compiler.comp-name
comp-env = Lambda.Compiler.comp-env
comp-val = Lambda.Compiler.comp-val
comp₀ = Lambda.Compiler.comp₀
-- Compiler correctness.
compiler-correct = Lambda.Compiler-correctness.correct
-- The key lemma used to prove compiler correctness.
key-lemma₁ = Lambda.Compiler-correctness.⟦⟧-correct
Cont-OK = Lambda.Compiler-correctness.Cont-OK
Stack-OK = Lambda.Compiler-correctness.Stack-OK
------------------------------------------------------------------------
-- Section 9
-- The instrumented interpreter.
[_,_]_∙S_ = Lambda.Interpreter.Stack-sizes.[_,_]_∙_
⟦_⟧S = Lambda.Interpreter.Stack-sizes.⟦_⟧
δ = Lambda.Interpreter.Stack-sizes.δ
⟦if⟧S = Lambda.Interpreter.Stack-sizes.⟦if⟧
scanl = Colist.scanl
numbers = Lambda.Interpreter.Stack-sizes.numbers
stack-sizesS = Lambda.Interpreter.Stack-sizes.stack-sizes
-- The instrumented semantics produces computations that are strongly
-- bisimilar to those produced by the other semantics.
⟦⟧∼⟦⟧ = Lambda.Interpreter.Stack-sizes.⟦⟧∼⟦⟧
-- If the trace of stack sizes produced by the instrumented semantics
-- has the least upper bound i, and the corresponding trace produced
-- by the virtual machine has the least upper bound v, then i and v
-- are bisimilar.
maximum-stack-sizes-match =
Lambda.Compiler-correctness.Sizes-match.maximum-stack-sizes-match
-- The trace of stack sizes produced by the virtual machine is not
-- necessarily bisimilar to that produced by the instrumented
-- interpreter.
stack-sizes-not-bisimilar =
Lambda.Interpreter.Stack-sizes.Counterexample.stack-sizes-not-bisimilar
-- The trace of stack sizes produced by the virtual machine and that
-- produced by the instrumented interpreter are upper bounds of each
-- other.
stack-sizes-related =
Lambda.Compiler-correctness.Sizes-match.stack-sizes-related
-- The [_]_≂_ relation.
[_]_≂_ = Upper-bounds.[_]_≂_
[_]_≂′_ = Upper-bounds.[_]_≂′_
-- Colists that are related by this relation have the same least upper
-- bounds (if any).
LUB-cong = Upper-bounds.LUB-cong
-- Some combinators that can be used to prove that two colists are
-- bounded by each other.
consʳ-≂ = Upper-bounds.consʳ-≂
consˡ-≂ = Upper-bounds.consˡ-≂
cons-≂ = Upper-bounds.cons-≂
cons′-≂ = Upper-bounds.cons′-≂
-- The [_]_≂_ relation is an equivalence relation. (The
-- transitivity-like results have type signatures that differ slightly
-- from those given in the paper.)
reflexive-≂ = Upper-bounds._□≂
symmetric-≂ = Upper-bounds.symmetric-≂
transitive-≂ = Upper-bounds.step-≂
transitive-∼≂ = Upper-bounds.step-∼≂
transitive-≂∼ = Upper-bounds.step-≂∼
-- The [_]_≂″_ relation.
[_]_≂″_ = Upper-bounds.[_]_≂″_
-- [_]_≂′_ and [_]_≂″_ are pointwise logically equivalent.
≂′⇔≂″ = Upper-bounds.≂′⇔≂″
-- This was not mentioned in the paper, but a corresponding relation
-- can also be defined for [_]_≲′_.
[_]_≲″_ = Upper-bounds.[_]_≲″_
≲′⇔≲″ = Upper-bounds.≲′⇔≲″
-- The key lemma used to prove correctness.
key-lemma₂ = Lambda.Compiler-correctness.Sizes-match.⟦⟧-correct
-- A non-terminating program that requires unbounded stack space.
Ω = Lambda.Syntax.Ω
Ω-loops = Lambda.Interpreter.Ω-loops′
Ω-requires-unbounded-space =
Lambda.Interpreter.Stack-sizes.Ω-requires-unbounded-space
-- A non-terminating program that runs in bounded stack space.
go = Lambda.Interpreter.Stack-sizes.Example.go
go-loops = Lambda.Interpreter.Stack-sizes.Example.go-loops
go-bounded-stack =
Lambda.Interpreter.Stack-sizes.Example.go-bounded-stack
------------------------------------------------------------------------
-- Section 10
-- The uninstrumented interpreter does not provide a suitable cost
-- measure, in the sense that there is a family of programs for which
-- the running "time" (number of steps) of the corresponding compiled
-- programs on the virtual machine is not linear in the running time
-- on the interpreter.
not-suitable-cost-measure =
Lambda.Interpreter.Steps.Counterexample.not-suitable-cost-measure
-- The instrumented interpreter.
✓_ = Lambda.Interpreter.Steps.✓_
_∙T_ = Lambda.Interpreter.Steps._∙_
⟦_⟧T = Lambda.Interpreter.Steps.⟦_⟧
⟦if⟧T = Lambda.Interpreter.Steps.⟦if⟧
-- The cost measure provided by the instrumented interpreter is
-- "suitable", in the sense that the cost of running a compiled
-- program on the virtual machine is linear in the cost of running the
-- corresponding source program on the interpreter, and vice versa.
the-cost-measure-is-suitable =
Lambda.Compiler-correctness.Steps-match.steps-match
-- Quantitative weak bisimilarity.
[_∣_∣_∣_∣_]_≈D_ =
Delay-monad.Quantitative-weak-bisimilarity.[_∣_∣_∣_∣_]_≈_
-- A characterisation of quantitative weak bisimilarity.
≈⇔≈×steps≤steps² =
Delay-monad.Quantitative-weak-bisimilarity.≈⇔≈×steps≤steps²
-- The left-to-right direction of the characterisation can be made
-- size-preserving.
≈→≈×steps≤steps² =
Delay-monad.Quantitative-weak-bisimilarity.≈→≈×steps≤steps²
-- The right-to-left direction of the characterisation can be made
-- size-preserving if and only if the carrier type is uninhabited
-- (assuming that Agda is not buggy).
≈×steps≤steps²→≈⇔uninhabited =
Delay-monad.Quantitative-weak-bisimilarity.≈×steps≤steps²→≈⇔uninhabited
-- Weakening.
weaken = Delay-monad.Quantitative-weak-bisimilarity.weaken
-- Two transitivity-like results.
transitive-≳∼ = Delay-monad.Quantitative-weak-bisimilarity.transitive-≳∼
transitive-≈∼ = Delay-monad.Quantitative-weak-bisimilarity.transitive-≈∼
transitive-∼≈ = Delay-monad.Quantitative-weak-bisimilarity.transitive-∼≈
-- The key lemma used to prove that the cost measure is "suitable".
key-lemma₃ = Lambda.Compiler-correctness.Steps-match.⟦⟧-correct
| 27.908582
| 73
| 0.699913
|
fd742115f00651c6698f9ffb0f5c695b867c1abb
| 8,418
|
agda
|
Agda
|
OTTTests/Tests.agda
|
hbasold/Sandbox
|
8fc7a6cd878f37f9595124ee8dea62258da28aa4
|
[
"MIT"
] | null | null | null |
OTTTests/Tests.agda
|
hbasold/Sandbox
|
8fc7a6cd878f37f9595124ee8dea62258da28aa4
|
[
"MIT"
] | null | null | null |
OTTTests/Tests.agda
|
hbasold/Sandbox
|
8fc7a6cd878f37f9595124ee8dea62258da28aa4
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --copatterns --sized-types #-}
{- | The purpose of this module is to demonstrate how observational type theory
can be implemented for arbitrary types in Agda through the use of tests
and a corresponding bisimulation proof method.
To use the equivalence for a type A, the type has to be made _testable_ by
creating an instance of Testable for it, see the accompanying module
TestsInstances. Such an instance effectively encodes A as inductive or
coinductive type, by giving an observation map to a coproduct of product
of components of A. For now, we do not pose any restrictions on this encoding,
hence it can be used to induce trivial equivalences.
Using such an instance of Testable for A, we can define _tests_ and
_observational equivalence_ for A. Moreover, we give a bisimulation proof
method and prove its soundness.
-}
module Tests where
open import Size
open import Level
open import Data.Product
open import Data.Bool
open import Function
open import Relation.Binary.PropositionalEquality as P
open ≡-Reasoning
open import Relation.Binary
open import Isomorphisms
-- | Write dependent functions as Π-type to make duality between
-- inductive and coinducitve types clearer.
record Π {a b} (A : Set a) (B : A → Set b) : Set (a ⊔ b) where
field
app : (x : A) → B x
open Π public
-- | Generalised copairing for coproducts:
-- Turn an I-indexed tuple of maps fᵢ : Bᵢ → C into a map Σ I B → C.
cotuple : {I C : Set} → {B : I → Set} → ((i : I) → B i → C) → (Σ I B → C)
cotuple f x = f (proj₁ x) (proj₂ x)
-- | Distinguish inductive and coinductive types
data Kind : Set where
ind : Kind
coind : Kind
--- | Make a type observable. An inductive type shall be represented by
--- a coproduct, whereas a coinductive type is represented by a product.
ObsTy : (I : Set) (B : I → Set) → Kind → Set
ObsTy I B ind = Σ I B
ObsTy I B coind = Π I B
-- | Make a type testable
record Testable (A : Set) : Set₁ where
coinductive
field
index : Set
parts : index → Set
kind : Kind
obs : A → ObsTy index parts kind
partsTestable : (i : index) → Testable (parts i)
open Testable public
record IsoTestable (A : Set) : Set₁ where
field
testable : Testable A
obsIso : IsIso (obs testable)
open IsoTestable public
SubTests : {l : Size} → {A : Set} → Testable A → Kind → Set
-- | Test formulae
data Test {i : Size} {A : Set} (T : Testable A) : Set where
⊤ : Test T
⊥ : Test T
nonTriv : {j : Size< i} → SubTests {j} T (kind T) → Test {i} {A} T
SubTests {l} T ind = Π (index T) (λ i → Test {l} (partsTestable T i))
SubTests {l} T coind = Σ (index T) (λ i → Test {l} (partsTestable T i))
-- | Satisfaction of subtests.
sat : {A : Set} {T : Testable A} {l : Size} →
(k : Kind) → SubTests {l} T k → ObsTy (index T) (parts T) k → Bool
-- | Test satisfaction
_⊨_ : {A : Set} {T : Testable A} → A → Test T → Bool
x ⊨ ⊤ = true
x ⊨ ⊥ = false
_⊨_ {A} {T} x (nonTriv nt) = sat (kind T) nt (obs T x)
sat ind φs o = cotuple (λ i y → y ⊨ app φs i) o
sat coind (i , φ) o = app o i ⊨ φ
-- | Observational equivalence: terms are equal if they satisfy the same tests.
record _≃⟨_⟩_ {A : Set} (x : A) (T : Testable A) (y : A) : Set₁ where
field
eqProof : (φ : Test T) → (x ⊨ φ ≡ y ⊨ φ)
open _≃⟨_⟩_ public
≡→≃ : {A : Set} → {T : Testable A} →
{a b : A} → a ≡ b → a ≃⟨ T ⟩ b
≡→≃ p = record { eqProof = λ φ → cong (λ x → x ⊨ φ) p }
≃-refl : {A : Set} → (T : Testable A) →
{a : A} → a ≃⟨ T ⟩ a
≃-refl T = record { eqProof = λ φ → refl }
≃-sym : {A : Set} → (T : Testable A) →
{a b : A} → a ≃⟨ T ⟩ b → b ≃⟨ T ⟩ a
≃-sym T p = record { eqProof = sym ∘ (eqProof p) }
≃-trans : {A : Set} → (T : Testable A) →
{a b c : A} → a ≃⟨ T ⟩ b → b ≃⟨ T ⟩ c → a ≃⟨ T ⟩ c
≃-trans T p₁ p₂ =
record { eqProof = λ φ → trans (eqProof p₁ φ) (eqProof p₂ φ) }
≃-setoid : {A : Set} → (T : Testable A) → Setoid _ _
≃-setoid {A} T = record
{ Carrier = A
;_≈_ = λ x y → x ≃⟨ T ⟩ y
; isEquivalence = record
{ refl = ≃-refl T
; sym = ≃-sym T
; trans = ≃-trans T }
}
-- Most likely impossible to prove within Agda.
-- Is it consistent with the system to postulate this for _IsoTestable_ ?
-- ≃-cong : {A B : Set} → {T₁ : Testable A} → {T₂ : Testable B} → {a b : A} →
-- (f : A → B) → a ≃⟨ T₁ ⟩ b → f a ≃⟨ T₂ ⟩ f b
-- If A is testable and there is a map B → A, then B is also testable.
comap-testable : {A B : Set} → (B → A) → Testable A → Testable B
comap-testable {A} {B} f T =
record
{ index = index T
; parts = parts T
; kind = kind T
; obs = (obs T) ∘ f
; partsTestable = partsTestable T
}
-- | If A is testable and A ≅ B, then B is iso-testable as well.
iso-testable : {A B : Set} → Iso B A → IsoTestable A → IsoTestable B
iso-testable {A} {B} I T =
record
{ testable = comap-testable (Iso.iso I) (testable T)
; obsIso = iso-comp (Iso.indeedIso I) (obsIso T)
}
-- | Heterogeneous
record _~⟨_∥_⟩_ {A B : Set}
(x : A) (T : Testable A) (I : Iso B A) (y : B) : Set₁ where
field
eqProofH : (φ : Test T) → (x ⊨ φ ≡ (Iso.iso I y) ⊨ φ)
open _~⟨_∥_⟩_ public
-- | Helper to match on Kind in construction of ≈.
≈-Proof : {A : Set} →
(k : Kind) →
(T : Testable A) →
(A → ObsTy (index T) (parts T) k) →
A → A → Set
-- | Bisimilarity induced from testable types.
record _≈⟨_⟩_ {A : Set} (x : A) (T : Testable A) (y : A) : Set where
coinductive
field
proof : ≈-Proof (kind T) T (obs T) x y
open _≈⟨_⟩_ public
-- | Helper to fiddle around with index in construction of IndProof.
ResolveIdx : {A : Set} → (T : Testable A) →
(i : index T) → (r s : ObsTy (index T) (parts T) ind) →
proj₁ r ≡ i → proj₁ s ≡ i → Set
ResolveIdx T i (.i , x') (.i , y') refl refl = x' ≈⟨ partsTestable T i ⟩ y'
-- | Proofs of bisimilarity on inductive types.
record IndProof {A : Set}
(T : Testable A)
(o : A → ObsTy (index T) (parts T) ind)
(x y : A) : Set where
coinductive
field
which : index T
eqIndex₁ : proj₁ (o x) ≡ which
eqIndex₂ : proj₁ (o y) ≡ which
eqTrans : ResolveIdx T which (o x) (o y) eqIndex₁ eqIndex₂
open IndProof public
-- | Proofs of bisimilarity on coinductive types.
record CoindProof {A : Set}
(T : Testable A)
(o : A → ObsTy (index T) (parts T) coind)
(x y : A) : Set where
coinductive
field
eqStep : (i : index T) → app (o x) i ≈⟨ partsTestable T i ⟩ app (o y) i
open CoindProof public
≈-Proof ind = IndProof
≈-Proof coind = CoindProof
-- | Lemma for induction to prove soundness of bisimilarity
lem-≈→≃-testInduct : {j : Size} {A : Set} → (T : Testable A) → (x y : A) →
x ≈⟨ T ⟩ y → (φ : Test {j} T) → x ⊨ φ ≡ y ⊨ φ
lem-≈→≃-testInduct _ _ _ _ ⊤ = refl
lem-≈→≃-testInduct _ _ _ _ ⊥ = refl
lem-≈→≃-testInduct {j} {A} T x y x≈y (nonTriv {l} nt)
= matchKind (kind T) nt (obs T) (proof x≈y)
where
matchKind : (k : Kind) →
(nt : SubTests {l} T k) →
(o : A → ObsTy (index T) (parts T) k) →
≈-Proof k T o x y →
sat k nt (o x) ≡ sat k nt (o y)
matchKind ind nt o p
= refine (which p) (o x) (o y) (eqIndex₁ p) (eqIndex₂ p) (eqTrans p)
where
--| Do pattern matching on IndProof
refine : (i : index T) → (r s : ObsTy (index T) (parts T) ind) →
(eqP₁ : proj₁ r ≡ i) → (eqP₂ : proj₁ s ≡ i) →
ResolveIdx T i r s eqP₁ eqP₂ →
(proj₂ r) ⊨ app nt (proj₁ r) ≡ (proj₂ s) ⊨ app nt (proj₁ s)
refine i (.i , x') (.i , y') refl refl p'
= lem-≈→≃-testInduct (partsTestable T i) x' y' p' (app nt i)
matchKind coind nt o p
= lem-≈→≃-testInduct (partsTestable T i) x' y' (eqStep p i) ψ
where
i : index T
i = proj₁ nt
ψ = proj₂ nt
x' = app (o x) i
y' = app (o y) i
-- | Bisimulation proofs are sound for observational equivalence.
≈→≃ : {A : Set} → (T : Testable A) → (x y : A) →
x ≈⟨ T ⟩ y → x ≃⟨ T ⟩ y
≈→≃ T x y x≈y = record { eqProof = lem-≈→≃-testInduct T x y x≈y }
{-
≃→≈ : {A : Set} → (T : Testable A) → (x y : A) →
x ≃⟨ T ⟩ y → x ≈⟨ T ⟩ y
≃→≈ {A} T x y x≃y = record { proof = matchKind (kind T) (obs T) }
where
matchKind : (k : Kind) →
(o : A → ObsTy (index T) (parts T) k) →
≈-Proof k T o x y
matchKind ind o = {!!}
matchKind coind o = {!!}
-}
| 32.501931
| 80
| 0.570088
|
0d6ea65c112e5fabc9ba24fc3ad37caeda33f696
| 728
|
agda
|
Agda
|
test/Fail/Issue1375-2.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/Issue1375-2.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/Issue1375-2.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
-- Andreas, 2014-12-02, issue reported by Jesper Cockx
{-# OPTIONS --no-guardedness #-}
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
subst : ∀ (A : Set)(P : A → Set)(x y : A) → x ≡ y → P x → P y
subst A P x .x refl t = t
mutual
Type : Set
postulate
type : Type
Term : Type → Set
Type = Term type
mutual
weakenType : Type → Type → Type
weaken : (ty ty' : Type) → Term ty → Term (weakenType ty' ty)
weakenType ty ty' =
let X : Type
X = {!!}
in subst Type Term (weakenType X type) type {!!} (weaken type X ty)
weaken ty ty' t = {!!}
data Test : Type → Set where
test : Test (weakenType type type)
-- Checking the constructor declaration was looping
-- should work now.
| 22.060606
| 72
| 0.587912
|
032b45bdd2bd28a740e94c7aeee78fa902481476
| 12,239
|
agda
|
Agda
|
guarded-recursion/embedding.agda
|
np/guarded-recursion
|
9fba7d89d8b27e9bb08c27df802608b5fff769e0
|
[
"BSD-3-Clause"
] | 1
|
2016-12-06T23:04:56.000Z
|
2016-12-06T23:04:56.000Z
|
guarded-recursion/embedding.agda
|
np/guarded-recursion
|
9fba7d89d8b27e9bb08c27df802608b5fff769e0
|
[
"BSD-3-Clause"
] | null | null | null |
guarded-recursion/embedding.agda
|
np/guarded-recursion
|
9fba7d89d8b27e9bb08c27df802608b5fff769e0
|
[
"BSD-3-Clause"
] | 2
|
2015-08-19T12:37:53.000Z
|
2021-11-16T16:21:54.000Z
|
-- Axiomatic embedding of guarded recursion in Agda
module guarded-recursion.embedding where
open import guarded-recursion.prelude
renaming (O to zero; S to suc)
open Coe
module M
(▹_ : ∀ {a} → Type_ a → Type_ a)
(▸ : ∀ {a} → ▹ (Type_ a) → Type_ a)
(next : ∀ {a} {A : Type_ a} → A → ▹ A)
(▸-rule : ∀ {a} {A : Type_ a} → ▸ (next A) ≡ ▹ A)
(fix : ∀ {a} {A : Type_ a} → (▹ A → A) → A)
(fix-rule : ∀ {a} {A : Type_ a} {f : ▹ A → A} → fix f ≡ f (next (fix f)))
(_⊛′_ : ∀ {a b} {A : Type_ a} {B : Type_ b} → ▹ (A → B) → ▹ A → ▹ B)
(_⊛_ : ∀ {a b} {A : Type_ a} {B : A → Type_ b}
→ ▹ ((x : A) → B x) → (x : ▹ A) → ▸ (next B ⊛′ x))
(fix-uniq : ∀ {a} {A : Type_ a} (u : A) f → u ≡ f (next u) → u ≡ fix f)
(next⊛next : ∀ {a b} {A : Type_ a} {B : Type_ b} (f : A → B) (x : A)
→ next f ⊛′ next x ≡ next (f x))
where
roll▸ : ∀ {a} {A : Type_ a} → ▹ A → ▸ (next A)
roll▸ = coe! ▸-rule
un▸ : ∀ {a} {A : Type_ a} → ▸ (next A) → ▹ A
un▸ = coe ▸-rule
▹Fix : ∀ {a} → Type_ a → Type_ a
▹Fix X = (▹ X → X) → X
▹Endo : ∀ {a} → Type_ a → Type_ a
▹Endo X = ▹ X → X
μ : ∀ {a} → Fix (Type_ a)
μ F = fix (F ∘ ▸)
un : ∀ {a f} → fix {A = Type_ a} f → f (next (fix f))
un = coe fix-rule
unμ : ∀ {a} f → μ {a} f → f (▹ μ f)
unμ {a} f x rewrite ! (▸-rule {A = μ f}) = un x
roll : ∀ {a f} → f (next (fix f)) → fix {A = Type_ a} f
roll = coe! fix-rule
μ-rule : ∀ {a} f → μ {a} f ≡ f (▹ μ f)
μ-rule f = fix-rule ∙ ap f (▸-rule {A = μ f})
rollμ : ∀ {a} f → f (▹ μ f) → μ {a} f
rollμ f = coe! (μ-rule f)
un₁ : ∀ {a b} {A : Type_ a} {f x} → fix {A = A → Type_ b} f x → f (next (fix f)) x
un₁ = coe₁ fix-rule
roll₁ : ∀ {a b} {A : Type_ a} {f x} → f (next (fix f)) x → fix {A = A → Type_ b} f x
roll₁ = coe₁! fix-rule
un₂ : ∀ {a b} {A : Type_ a} {B : Type_ b} {c f x y} → fix {A = A → B → Type_ c} f x y → f (next (fix f)) x y
un₂ = coe₂ fix-rule
roll₂ : ∀ {a b} {A : Type_ a} {B : Type_ b} {c f x y} → f (next (fix f)) x y → fix {A = A → B → Type_ c} f x y
roll₂ = coe₂! fix-rule
map▹ : ∀ {a b} {A : Type_ a} {B : Type_ b} → (A → B) → ▹ A → ▹ B
map▹ f ▹x = next f ⊛′ ▹x
{-
alternatively
_⊛′′_ : ∀ {a b} {A : Type_ a} {B : A → Type_ b} → ▹ ((x : A) → B x) → (x : A) → ▹ (B x)
▹f ⊛′′ x = map▹ (λ f → f x) ▹f
-}
{-
alternatively
_$_ : ∀ {a b} {A : Type_ a} (B : A → Type_ b) → ▹ A → ▹ (Type_ b)
f $ ▹x = map▹ f ▹x
-}
▹^ : ∀ {a} → ℕ → Type_ a → Type_ a
▹^ zero A = A
▹^ (suc n) A = ▹ ▹^ n A
next^ : ∀ {a} {A : Type_ a} n → A → ▹^ n A
next^ zero x = x
next^ (suc n) x = next (next^ n x)
map▹^ : ∀ {a b} {A : Type_ a} {B : Type_ b} n → (A → B) → ▹^ n A → ▹^ n B
map▹^ zero f = f
map▹^ (suc n) f = map▹ (map▹^ n f)
module SimpleStream where
F : Type → Type → Type
F A X = A × X
S : Type → Type
S A = μ (F A)
μ₁F' : ∀ {a} {A : Type_ a} → ((A → ▹ Type) → A → Type) → (▹(A → Type) → A → Type)
μ₁F' F self = F (λ x → (self ⊛′ next x))
μ₁F : ∀ {a} {A : Type_ a} → ((A → Type) → A → Type) → (▹(A → Type) → A → Type)
μ₁F F self = F (λ x → ▸ (self ⊛′ next x))
μ₁ : ∀ {a} {A : Type_ a} → ((A → Type) → A → Type) → A → Type
μ₁ F = fix (μ₁F F)
module μId where
μid : Type
μid = μ id
μid-rule : μid ≡ ▹ μid
μid-rule = fix-rule ∙ ▸-rule {A = μ id}
ω : μid
ω = fix (rollμ id)
module CoNat where
Coℕ : Type
Coℕ = μ Maybe
rollNat : Maybe (▹ Coℕ) → Coℕ
rollNat = rollμ Maybe
ze : Coℕ
ze = rollNat nothing
su : ▹ Coℕ → Coℕ
su x = rollNat (just x)
su′ : Coℕ → Coℕ
su′ = su ∘ next
ω : Coℕ
ω = fix su
module Neg where
{- data X : Type where
rollX : Fix X
: (X → X) → X
-}
X : Type
X = μ Endo
rollX : Endo (▹ X) → X
-- : (▹ X → ▹ X) → X
rollX = rollμ Endo
rollX′ : ▹(Endo X) → X
-- : ▹(X → X) → X
rollX′ = rollX ∘ _⊛′_
unX : X → Endo (▹ X)
unX = unμ Endo
-- δ = λ x → x x
δ : X → ▹ X
δ = λ x → (unX x) (next x)
module Neg' where
{- data X : Type where
c : Fix X
: ((X → X) → X) → X
-}
X : Type
X = μ Fix
rollX : Fix (▹ X) → X
rollX = rollμ Fix
unX : X → Fix (▹ X)
unX = unμ Fix
module μ₁Id where
-- μ₁id = ▹∘▹∘…∘▹
-- μ₁id A = ▹ (▹ … (▹ A))
μ₁id : Type → Type
μ₁id = μ₁ id
betterfix₁ : ∀ {a} {A : Type_ a} {x : A} (F : Endo (A → Type)) → (▹ μ₁ F x → μ₁F F (next (μ₁ F)) x) → μ₁ F x
betterfix₁ {a} {A} {x} F f = fix helper
where helper : _ → _
helper self = roll₁ (f self)
▹ω-inh' : ∀ {A : Type} {x : A} (F : Endo (A → Type)) → (▸ (next (μ₁ F) ⊛′ next x) → μ₁F F (next (μ₁ F)) x) → μ₁ F x
▹ω-inh' {A} {x} F f = fix helper
where helper : _ → _
helper self = roll₁ (f (coe! (ap ▸ (next⊛next (μ₁ F) x)) (roll▸ self)))
▹ω-inh : ∀ {A} → μ₁id A
-- ▹ω-inh {A} = fix λ self → roll₁ (coe! (ap ▸ (next⊛next μ₁id A)) (roll▸ self))
▹ω-inh {A} = betterfix₁ id (λ self → coe! (ap ▸ (next⊛next μ₁id A)) (roll▸ self))
-- ▹ω-inh {A} = fix λ self → {!!} -- (coe! (ap ▸ (next⊛next μ₁idω A)) (roll▸ self))
fix2 : ∀ {a} {A : Type_ a} → (▹ A → A) → A
fix2 f = fix (f ∘ next ∘ f)
fix≡fix2 : ∀ {a} {A : Type_ a} (f : ▹ A → A) → fix f ≡ fix2 f
fix≡fix2 f = fix-uniq (fix f) (f ∘ next ∘ f) (fix-rule ∙ ap (f ∘ next) fix-rule)
module Streams where
F : Type → Type → Type
F A X = A × X
-- S : Type → Type
-- S A = μ (F A)
F^ : ℕ → Type → Type → Type
F^ n A X = A × ▹^ n X
S^ : ℕ → Type → Type
S^ n A = μ (F^ n A)
S : Type → Type
S = S^ 0
S₂ = S^ 1
unS : ∀ {A} → S A → F A (▹ S A)
unS = unμ (F _)
rollS : ∀ {A} → F A (▹ S A) → S A
rollS = rollμ (F _)
unS^ : ∀ {A} n → S^ n A → F^ n A (▹ S^ n A)
unS^ n = unμ (F^ n _)
rollS^ : ∀ {A} n → F^ n A (▹ S^ n A) → S^ n A
rollS^ n = rollμ (F^ n _)
hd : ∀ {A} → S A → A
hd = fst ∘ unS
tl : ∀ {A} → S A → ▹ S A
tl = snd ∘ unS
cons : ∀ {A} n → A → ▹^ n (▹ (S^ n A)) → S^ n A
cons n x xs = rollS^ n (x , xs)
infixr 4 _∷_
_∷_ : ∀ {A} → A → ▹ (S A) → S A
_∷_ = cons 0
infixr 4 _∷₂_
_∷₂_ : ∀ {A} → A → ▹^ 2 (S₂ A) → S₂ A
x ∷₂ xs = roll (x , map▹ roll▸ xs)
repeatS : ∀ {A} → A → S A
repeatS x = fix λ x… → x ∷ x…
module MapS {A B : Type} (f : A → B) where
mapSf : ▹(S A → S B) → S A → S B
mapSf self s = f (hd s) ∷ self ⊛′ tl s
mapS : S A → S B
mapS = fix mapSf
mapS2f : ▹(S A → S B) → S A → S B
mapS2f self s = f (hd s) ∷ map▹ (λ s' → f (hd s') ∷ self ⊛′ tl s') (tl s)
mapS2f' : ▹(S A → S B) → S A → S B
mapS2f' self = mapSf (next (mapSf self))
mapS2f≡mapS2f' : mapS2f ≡ mapS2f'
mapS2f≡mapS2f' = idp
mapS2 : S A → S B
mapS2 = fix mapS2f
mapS2' : S A → S B
mapS2' = fix mapS2f'
mapS2≡mapS2' : mapS2 ≡ mapS2'
mapS2≡mapS2' = idp
mapS2'' : S A → S B
mapS2'' = fix2 mapSf
mapS2≡mapS2'' : mapS2 ≡ mapS2''
mapS2≡mapS2'' = idp
mapS≡mapS2 : mapS ≡ mapS2
mapS≡mapS2 = fix≡fix2 mapSf
open MapS
group2 : S ℕ → ▹ S₂ ℕ²
group2 = fix λ self s → map▹ (λ tls → (hd s , hd tls) ∷₂ self ⊛′ tl tls) (tl s)
‼ : ∀ {A} → (n : ℕ) → S A → ▹^ n A
‼ zero = hd
‼ (suc n) = map▹ (‼ n) ∘ tl
toFun : ∀ {A} → S A → (n : ℕ) → ▹^ n A
toFun s n = ‼ n s
fromFun : ∀ {A} → (ℕ → A) → S A
fromFun {A} = fix λ self (f : ℕ → A) → f 0 ∷ self ⊛′ next (f ∘ suc)
nats : S ℕ
nats = fix λ self → 0 ∷ map▹ (mapS suc) self
nats2 : S ℕ
nats2 = fix λ self → 0 ∷ map▹ (mapS2 suc) self
nats≡nats2 : nats ≡ nats2
nats≡nats2 rewrite mapS≡mapS2 suc = idp
arrow : ▹ ℕ
arrow = ‼ 1 nats
module Sim
{A : Type}
(ℛ : A → A → Type)
(ℛ-refl : Reflexive ℛ)
where
≈F : ▹(S A × S A → Type) → S A × S A → Type
≈F X (xs , ys) = ℛ (hd xs) (hd ys) × ▸ ((map▹ curry X ⊛′ (tl xs)) ⊛′ tl ys)
_≈_ : S A × S A → Type
_≈_ = fix ≈F
≈-tail : ∀ {xs ys : S A} → _≈_ (xs , ys) → ▸ ((map▹ curry (next _≈_) ⊛′ tl xs) ⊛′ tl ys)
≈-tail pf = snd (un₁ pf)
{- Does not work yet
≈-refl : Reflexive (curry _≈_)
≈-refl {x} = (fix λ pf x → roll₁ {f = ≈F} (ℛ-refl , helper pf x)) x
where helper' : _ → _ → _
helper' pf x = map▹ (λ f → f x) pf
helper : _ → _ → _
helper pf x = let r = helper' pf x in {!roll▸ r!}
-}
module DelayedStreams where
data F (A : Type) (X : Type) : Type where
done : F A X
skip : X → F A X
yield : A → X → F A X
mapF : ∀ {A B X Y} → (A → B) → (X → Y) → F A X → F B Y
mapF f g done = done
mapF f g (skip x) = skip (g x)
mapF f g (yield a x) = yield (f a) (g x)
S : Type → Type
S A = μ (F A)
unS : ∀ {A} → S A → F A (▹ S A)
unS = mapF id un▸ ∘ un
rollS : ∀ {A} → F A (▹ S A) → S A
rollS = roll ∘ mapF id roll▸
unfoldS : ∀ {A X} → (X → F A (▹ X)) → X → S A
unfoldS coalg = fix λ self x → rollS (mapF id (λ x′ → self ⊛′ x′) (coalg x))
repeatS : ∀ {A} → A → S A
repeatS x = fix λ self → rollS (yield x self)
neverS : ∀ {A} → S A
neverS = fix λ self → rollS (skip self)
-- Co-algebra style...
mapS : ∀ {A B} → (A → B) → S A → S B
mapS {A} {B} f = unfoldS (mapF f id ∘ unS)
filterF : ∀ {A X} → (A → 𝟚) → F A X → F A X
filterF f done = done
filterF f (skip xs) = skip xs
filterF f (yield x xs) = if f x then yield x xs
else skip xs
filterS : ∀ {A} → (A → 𝟚) → S A → S A
filterS f = unfoldS (filterF f ∘ unS)
module FuelBased where
fix : ∀ {a} {A : Type_ a} → ℕ → (A → A) → A
fix zero f = STUCK where postulate STUCK : _
fix (suc n) f = f (fix n f)
fix-rule : ∀ {a} {A : Type_ a} (n : ℕ) {f : A → A} → fix n f ≡ f (fix n f)
fix-rule zero = ThisIsUnsafeButPlease.trustMe
fix-rule (suc n) {f} = ap f (fix-rule n)
fix-uniq : ∀ {a} {A : Type_ a} (n : ℕ) (u : A) f → u ≡ f u → u ≡ fix n f
fix-uniq zero u f pf = ThisIsUnsafeButPlease.trustMe
fix-uniq (suc n) u f pf = pf ∙ ap f (fix-uniq n u f pf)
module I (n : ℕ) = M id id id idp (fix n) (fix-rule n) id id
(fix-uniq n) (λ _ _ → idp)
module HiddenFix {a} {A : Type_ a} (f : A → A) where
-- This definition is not intended to termination-check.
-- Use with care it's really easy to make the type-checker loop.
{-# TERMINATING #-}
fix : Hidden A
fix = hide f (reveal fix)
fix-rule : reveal fix ≡ f (reveal fix)
fix-rule = idp {a} {A} {reveal fix}
-- This definition is not intended to termination-check.
-- Use with care it's really easy to make the type-checker loop.
{-# TERMINATING #-}
fix-uniq : (u : A) → u ≡ f u → u ≡ reveal fix
fix-uniq u pf = pf ∙ ap f (fix-uniq u pf) ∙ ! fix-rule
module Test where
open HiddenFix
open M id id id idp (reveal ∘ fix) (λ {_} {_} {f} → fix-rule f) id id
(λ {_} {_} u f → fix-uniq f u) (λ _ _ → idp) public
open Streams
two : map▹ hd (tl nats) ≡ 1
two = idp
-- -}
-- -}
-- -}
| 28.462791
| 123
| 0.407468
|
4ef8b582acde03a61a68e7b5b46b91175011b639
| 10,701
|
agda
|
Agda
|
complexity-drafts/Source-lang.agda
|
benhuds/Agda
|
2404a6ef2688f879bda89860bb22f77664ad813e
|
[
"MIT"
] | 2
|
2016-04-26T20:22:22.000Z
|
2019-08-08T12:27:18.000Z
|
complexity-drafts/Source-lang.agda
|
benhuds/Agda
|
2404a6ef2688f879bda89860bb22f77664ad813e
|
[
"MIT"
] | 1
|
2020-03-23T08:39:04.000Z
|
2020-05-12T00:32:45.000Z
|
complexity-drafts/Source-lang.agda
|
benhuds/Agda
|
2404a6ef2688f879bda89860bb22f77664ad813e
|
[
"MIT"
] | null | null | null |
{- Name: Bowornmet (Ben) Hudson
-- define the source language from the paper
-}
open import Preliminaries
open import Preorder-withmax
module Source-lang where
-- define the source language from the paper
-- we want to focus on arrow, cross, and nat types
data Tp : Set where
unit : Tp
nat : Tp
susp : Tp → Tp
_->s_ : Tp → Tp → Tp
_×s_ : Tp → Tp → Tp
data Cost : Set where
0c : Cost
1c : Cost
_+c_ : Cost → Cost → Cost
data Equals0c : Cost → Set where
Eq0-0c : Equals0c 0c
Eq0-+c : ∀ {c c'} → Equals0c c → Equals0c c' → Equals0c (c +c c')
-- represent a context as a list of types
Ctx = List Tp
-- de Bruijn indices (for free variables)
data _∈_ : Tp → Ctx → Set where
i0 : ∀ {Γ τ}
→ τ ∈ (τ :: Γ)
iS : ∀ {Γ τ τ1}
→ τ ∈ Γ
→ τ ∈ (τ1 :: Γ)
data _|-_ : Ctx → Tp → Set where
unit : ∀ {Γ}
→ Γ |- unit
var : ∀ {Γ τ}
→ τ ∈ Γ
→ Γ |- τ
z : ∀ {Γ}
→ Γ |- nat
suc : ∀ {Γ}
→ (e : Γ |- nat)
→ Γ |- nat
rec : ∀ {Γ τ}
→ Γ |- nat
→ Γ |- τ
→ (nat :: (susp τ :: Γ)) |- τ
→ Γ |- τ
lam : ∀ {Γ τ ρ}
→ (ρ :: Γ) |- τ
→ Γ |- (ρ ->s τ)
app : ∀ {Γ τ1 τ2}
→ Γ |- (τ2 ->s τ1)
→ Γ |- τ2
→ Γ |- τ1
prod : ∀ {Γ τ1 τ2}
→ Γ |- τ1
→ Γ |- τ2
→ Γ |- (τ1 ×s τ2)
l-proj : ∀ {Γ τ1 τ2}
→ Γ |- (τ1 ×s τ2)
→ Γ |- τ1
r-proj : ∀ {Γ τ1 τ2}
→ Γ |- (τ1 ×s τ2)
→ Γ |- τ2
-- include split, delay/susp/force instead of usual elim rules for products
delay : ∀ {Γ τ}
→ Γ |- τ
→ Γ |- susp τ
force : ∀ {Γ τ}
→ Γ |- susp τ
→ Γ |- τ
split : ∀ {Γ τ τ1 τ2}
→ Γ |- (τ1 ×s τ2)
→ (τ1 :: (τ2 :: Γ)) |- τ
→ Γ |- τ
------weakening and substitution lemmas
-- renaming function
rctx : Ctx → Ctx → Set
rctx Γ Γ' = ∀ {τ} → τ ∈ Γ' → τ ∈ Γ
-- re: transferring variables in contexts
lem1 : ∀ {Γ Γ' τ} → rctx Γ Γ' → rctx (τ :: Γ) (τ :: Γ')
lem1 d i0 = i0
lem1 d (iS x) = iS (d x)
-- renaming lemma
ren : ∀ {Γ Γ' τ} → Γ' |- τ → rctx Γ Γ' → Γ |- τ
ren unit d = unit
ren (var x) d = var (d x)
ren z d = z
ren (suc e) d = suc (ren e d)
ren (rec e e0 e1) d = rec (ren e d) (ren e0 d) (ren e1 (lem1 (lem1 d)))
ren (lam e) d = lam (ren e (lem1 d))
ren (app e1 e2) d = app (ren e1 d) (ren e2 d)
ren (prod e1 e2) d = prod (ren e1 d) (ren e2 d)
ren (l-proj e) d = l-proj (ren e d)
ren (r-proj e) d = r-proj (ren e d)
ren (delay e) d = delay (ren e d)
ren (force e) d = force (ren e d)
ren (split e e1) d = split (ren e d) (ren e1 (lem1 (lem1 d)))
-- substitution
sctx : Ctx → Ctx → Set
sctx Γ Γ' = ∀ {τ} → τ ∈ Γ' → Γ |- τ
-- weakening a context
wkn : ∀ {Γ τ1 τ2} → Γ |- τ2 → (τ1 :: Γ) |- τ2
wkn e = ren e iS
-- weakening also works with substitution
wkn-s : ∀ {Γ τ1 Γ'} → sctx Γ Γ' → sctx (τ1 :: Γ) Γ'
wkn-s d = λ f → wkn (d f)
wkn-r : ∀ {Γ τ1 Γ'} → rctx Γ Γ' → rctx (τ1 :: Γ) Γ'
wkn-r d = λ x → iS (d x)
-- lem2 (need a lemma for subst like we did for renaming)
lem2 : ∀ {Γ Γ' τ} → sctx Γ Γ' → sctx (τ :: Γ) (τ :: Γ')
lem2 d i0 = var i0
lem2 d (iS i) = wkn (d i)
-- another substitution lemma
lem3 : ∀ {Γ τ} → Γ |- τ → sctx Γ (τ :: Γ)
lem3 e i0 = e
lem3 e (iS i) = var i
lem3' : ∀ {Γ Γ' τ} → sctx Γ Γ' → Γ |- τ → sctx Γ (τ :: Γ')
lem3' Θ e i0 = e
lem3' Θ e (iS i) = Θ i
-- one final lemma needed for the last stepping rule. Thank you Professor Licata!
lem4 : ∀ {Γ τ1 τ2} → Γ |- τ1 → Γ |- τ2 → sctx Γ (τ1 :: (τ2 :: Γ))
lem4 e1 e2 i0 = e1
lem4 e1 e2 (iS i0) = e2
lem4 e1 e2 (iS (iS i)) = var i
lem4' : ∀ {Γ Γ' τ1 τ2} → sctx Γ Γ' → Γ |- τ1 → Γ |- τ2 → sctx Γ (τ1 :: (τ2 :: Γ'))
lem4' Θ a b i0 = a
lem4' Θ a b (iS i0) = b
lem4' Θ a b (iS (iS i)) = Θ i
lem5 : ∀ {Γ τ1 τ2} → Γ |- (τ1 ×s τ2) → sctx Γ ((τ1 ×s τ2) :: (τ1 :: (τ2 :: Γ)))
lem5 e i0 = e
lem5 e (iS i0) = l-proj e
lem5 e (iS (iS i0)) = r-proj e
lem5 e (iS (iS (iS i))) = var i
ids-2 : ∀ {Γ τ} → Γ |- τ → sctx Γ Γ → Γ |- τ
ids-2 e Θ = e
-- the 'real' substitution lemma (if (x : τ') :: Γ |- (e : τ) and Γ |- (e : τ') , then Γ |- e[x -> e'] : τ)
subst : ∀ {Γ Γ' τ} → sctx Γ Γ' → Γ' |- τ → Γ |- τ
subst d unit = unit
subst d (var x) = d x
subst d z = z
subst d (suc x) = suc (subst d x)
subst d (rec e e0 e1) = rec (subst d e) (subst d e0) (subst (lem2 (lem2 d)) e1)
subst d (lam e) = lam (subst (lem2 d) e)
subst d (app e1 e2) = app (subst d e1) (subst d e2)
subst d (prod e1 e2) = prod (subst d e1) (subst d e2)
subst d (l-proj e) = l-proj (subst d e)
subst d (r-proj e) = r-proj (subst d e)
subst d (delay e) = delay (subst d e)
subst d (force e) = force (subst d e)
subst d (split e e1) = split (subst d e) (subst (lem2 (lem2 d)) e1)
s-comp1 : ∀ {Γ Γ' Γ''} → sctx Γ Γ' → sctx Γ'' Γ → sctx Γ'' Γ'
s-comp1 Θ Θ' = subst Θ' o Θ
postulate
subst-compose : ∀ {Γ Γ' τ τ1} (Θ : sctx Γ Γ') (v : Γ |- τ) (e : (τ :: Γ' |- τ1) )
→ subst (lem3 v) (subst (lem2 Θ) e) == subst (lem3' Θ v) e
--subst-compose {Γ} {_} Θ v e = {!!}
postulate
subst-compose2 : ∀ {Γ Γ' τ} (Θ : sctx Γ Γ') (n : Γ |- nat) (e1 : Γ' |- τ) (e2 : (nat :: (susp τ :: Γ')) |- τ)
→ subst (lem4 n (delay (rec n (subst Θ e1) (subst (lem2 (lem2 Θ)) e2)))) (subst (lem2 (lem2 Θ)) e2) ==
subst (lem4' Θ n (delay (rec n (subst Θ e1) (subst (lem2 (lem2 Θ)) e2)))) e2
postulate
subst-compose3 : ∀ {Γ Γ' τ τ1 τ2} (Θ : sctx Γ Γ') (e1 : (τ1 :: (τ2 :: Γ')) |- τ) (v1 : Γ |- τ1) (v2 : Γ |- τ2)
→ subst (lem4 v1 v2) (subst (lem2 (lem2 Θ)) e1) == subst (lem4' Θ v1 v2) e1
postulate
subst-compose4 : ∀ {Γ Γ' τ} (Θ : sctx Γ Γ') (v' : Γ |- nat) (r : Γ |- susp τ) (e2 : (nat :: (susp τ :: Γ')) |- τ)
→ subst (lem4 v' r) (subst (lem2 (lem2 Θ)) e2) == subst (lem4' Θ v' r) e2
-------
data val : ∀ {τ} → [] |- τ → Set where
z-isval : val z
suc-isval : (e : [] |- nat) → (val e)
→ val (suc e)
pair-isval : ∀ {τ1 τ2} (e1 : [] |- τ1) → (e2 : [] |- τ2)
→ val e1 → val e2
→ val (prod e1 e2)
lam-isval : ∀ {ρ τ} (e : (ρ :: []) |- τ)
→ val (lam e)
unit-isval : val unit
delay-isval : ∀ {τ} (e : [] |- τ) → val (delay e)
mutual
-- define evals (e : source exp) (v : value) (c : nat)
-- analogous to "e evaluates to v in c steps"
-- see figure 4 of paper
data evals : {τ : Tp} → [] |- τ → [] |- τ → Cost → Set where
pair-evals : ∀ {n1 n2}
→ {τ1 τ2 : Tp} {e1 v1 : [] |- τ1} {e2 v2 : [] |- τ2}
→ evals e1 v1 n1
→ evals e2 v2 n2
→ evals (prod e1 e2) (prod v1 v2) (n1 +c n2)
lam-evals : ∀ {ρ τ} {e : (ρ :: []) |- τ}
→ evals (lam e) (lam e) 0c
app-evals : ∀ {n0 n1 n}
→ {τ1 τ2 : Tp} {e0 : [] |- (τ1 ->s τ2)} {e0' : (τ1 :: []) |- τ2} {e1 v1 : [] |- τ1} {v : [] |- τ2}
→ evals e0 (lam e0') n0
→ evals e1 v1 n1
→ evals (subst (lem3 v1) e0') v n
→ evals (app e0 e1) v ((n0 +c n1) +c n)
z-evals : evals z z 0c
s-evals : ∀ {n}
→ {e v : [] |- nat}
→ evals e v n
→ evals (suc e) (suc v) n
unit-evals : evals unit unit 0c
rec-evals : ∀ {n1 n2}
→ {τ : Tp} {e v : [] |- nat} {e0 v' : [] |- τ} {e1 : (nat :: (susp τ :: [])) |- τ}
→ evals e v n1
→ evals-rec-branch e0 e1 v v' n2
→ evals (rec e e0 e1) v' (n1 +c (1c +c n2))
-- adding some new rules to the mix
delay-evals : {τ : Tp} {e : [] |- τ}
→ evals (delay e) (delay e) 0c
force-evals : ∀ {n1 n2}
→ {τ : Tp} {e' v : [] |- τ} {e : [] |- susp τ}
→ evals e (delay e') n1
→ evals e' v n2
→ evals (force e) v (n1 +c n2)
split-evals : ∀ {n1 n2}
→ {τ τ1 τ2 : Tp} {e0 : [] |- (τ1 ×s τ2)} {v1 : [] |- τ1} {v2 : [] |- τ2} {e1 : (τ1 :: (τ2 :: [])) |- τ} {v : [] |- τ}
→ evals e0 (prod v1 v2) n1
→ evals (subst (lem4 v1 v2) e1) v n2
→ evals (split e0 e1) v (n1 +c n2)
-- means evals (rec v e0 e1) v' n
-- but helpful to have a separate type for this
data evals-rec-branch {τ : Tp} (e0 : [] |- τ) (e1 : (nat :: (susp τ :: [])) |- τ) : (e : [] |- nat) (v : [] |- τ) → Cost → Set where
evals-rec-z : ∀ {v n} → evals e0 v n → evals-rec-branch e0 e1 z v n
evals-rec-s : ∀ {v v' n} → evals (subst (lem4 v (delay (rec v e0 e1))) e1) v' n
→ evals-rec-branch e0 e1 (suc v) v' n
evals-val : {τ : Tp} {e : [] |- τ} {v : [] |- τ} {n : Cost} → evals e v n → val v
evals-val (pair-evals D D₁) = pair-isval _ _ (evals-val D) (evals-val D₁)
evals-val lam-evals = lam-isval _
evals-val (app-evals D D₁ D₂) = evals-val D₂
evals-val z-evals = z-isval
evals-val (s-evals D) = suc-isval _ (evals-val D)
evals-val unit-evals = unit-isval
evals-val (rec-evals x (evals-rec-z D)) = evals-val D
evals-val (rec-evals x (evals-rec-s D)) = evals-val D
evals-val delay-evals = delay-isval _
evals-val (force-evals D D₁) = evals-val D₁
evals-val (split-evals D D₁) = evals-val D₁
val-evals-inversion : {τ : Tp} {v v' : [] |- τ} {n : Cost} → val v → evals v v' n → (v == v') × Equals0c n
val-evals-inversion z-isval z-evals = Refl , Eq0-0c
val-evals-inversion (suc-isval e valv) (s-evals evv) = ap suc (fst IH) , snd IH where
IH = val-evals-inversion valv evv
val-evals-inversion (pair-isval e1 e2 valv valv₁) (pair-evals evv evv₁) = ap2 prod (fst IH1) (fst IH2) , Eq0-+c (snd IH1) (snd IH2) where
IH1 = val-evals-inversion valv evv
IH2 = val-evals-inversion valv₁ evv₁
val-evals-inversion (lam-isval e) lam-evals = Refl , Eq0-0c
val-evals-inversion unit-isval unit-evals = Refl , Eq0-0c
val-evals-inversion (delay-isval e) delay-evals = Refl , Eq0-0c
---------- some sample programs in the source language
--dbl(n : nat) = 2*n
dbl : ∀ {Γ} → Γ |- (nat ->s nat)
dbl = lam (rec (var i0) z (suc (suc (force (var (iS i0))))))
--add(x : nat , y : nat) = x+y
add : ∀ {Γ} → Γ |- (nat ->s (nat ->s nat))
add = lam (lam (rec (var (iS i0)) (var i0) (suc (force (var (iS i0))))))
--mult(x : nat , y : nat) = x*y
mult : ∀ {Γ} → Γ |- (nat ->s (nat ->s nat))
mult = lam (lam (rec (var (iS i0)) z (app (app add (var (iS (iS i0)))) (force (var (iS i0))))))
| 35.551495
| 139
| 0.461359
|
cc66312c98f9dc7d53889f8acad5392b1f7bf98f
| 200
|
agda
|
Agda
|
data/test-files/VecAppend.agda
|
carlostome/martin
|
baf979ef78b5ec0f4783240b03f9547490bc5d42
|
[
"BSD-3-Clause"
] | null | null | null |
data/test-files/VecAppend.agda
|
carlostome/martin
|
baf979ef78b5ec0f4783240b03f9547490bc5d42
|
[
"BSD-3-Clause"
] | null | null | null |
data/test-files/VecAppend.agda
|
carlostome/martin
|
baf979ef78b5ec0f4783240b03f9547490bc5d42
|
[
"BSD-3-Clause"
] | null | null | null |
module VecAppend where
open import Prelude
add : Nat -> Nat -> Nat
add zero y = y
add (suc x) y = suc (add x y)
append : forall {A m n} -> Vec A m -> Vec A n -> Vec A (add m n)
append xs ys = {!!}
| 18.181818
| 64
| 0.59
|
14ca8c18331ac2c52cc7a675024673ecf7a86e4c
| 4,580
|
agda
|
Agda
|
Cubical/Data/Group/Base.agda
|
limemloh/cubical
|
df4ef7edffd1c1deb3d4ff342c7178e9901c44f1
|
[
"MIT"
] | null | null | null |
Cubical/Data/Group/Base.agda
|
limemloh/cubical
|
df4ef7edffd1c1deb3d4ff342c7178e9901c44f1
|
[
"MIT"
] | null | null | null |
Cubical/Data/Group/Base.agda
|
limemloh/cubical
|
df4ef7edffd1c1deb3d4ff342c7178e9901c44f1
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --cubical --safe #-}
module Cubical.Data.Group.Base where
open import Cubical.Foundations.Prelude hiding ( comp )
import Cubical.Foundations.Isomorphism as I
import Cubical.Foundations.Equiv as E
import Cubical.Foundations.HAEquiv as HAE
record isGroup {ℓ} (A : Type ℓ) : Type ℓ where
constructor group-struct
field
id : A
inv : A → A
comp : A → A → A
lUnit : ∀ a → comp id a ≡ a
rUnit : ∀ a → comp a id ≡ a
assoc : ∀ a b c → comp (comp a b) c ≡ comp a (comp b c)
lCancel : ∀ a → comp (inv a) a ≡ id
rCancel : ∀ a → comp a (inv a) ≡ id
record Group ℓ : Type (ℓ-suc ℓ) where
constructor group
field
type : Type ℓ
setStruc : isSet type
groupStruc : isGroup type
isMorph : ∀ {ℓ ℓ'} (G : Group ℓ) (H : Group ℓ') → (f : (Group.type G → Group.type H)) → Type (ℓ-max ℓ ℓ')
isMorph (group G Gset (group-struct _ _ _⊙_ _ _ _ _ _))
(group H Hset (group-struct _ _ _∘_ _ _ _ _ _)) f
= (g0 g1 : G) → f (g0 ⊙ g1) ≡ (f g0) ∘ (f g1)
morph : ∀ {ℓ ℓ'} (G : Group ℓ) (H : Group ℓ') → Type (ℓ-max ℓ ℓ')
morph G H = Σ (Group.type G → Group.type H) (isMorph G H)
record Iso {ℓ ℓ'} (G : Group ℓ) (H : Group ℓ') : Type (ℓ-max ℓ ℓ') where
constructor iso
field
fun : morph G H
inv : morph H G
rightInv : I.section (fun .fst) (inv .fst)
leftInv : I.retract (fun .fst) (inv .fst)
record Iso' {ℓ ℓ'} (G : Group ℓ) (H : Group ℓ') : Type (ℓ-max ℓ ℓ') where
constructor iso'
field
isoSet : I.Iso (Group.type G) (Group.type H)
isoSetMorph : isMorph G H (I.Iso.fun isoSet)
_≃_ : ∀ {ℓ ℓ'} (A : Group ℓ) (B : Group ℓ') → Type (ℓ-max ℓ ℓ')
A ≃ B = Σ (morph A B) \ f → (E.isEquiv (f .fst))
Iso'→Iso : ∀ {ℓ ℓ'} {G : Group ℓ} {H : Group ℓ'} → Iso' G H → Iso G H
Iso'→Iso {G = group G Gset Ggroup} {H = group H Hset Hgroup} i = iso (fun , funMorph) (inv , invMorph) rightInv leftInv
where
G_ : Group _
G_ = (group G Gset Ggroup)
H_ : Group _
H_ = (group H Hset Hgroup)
open Iso'
fun : G → H
fun = I.Iso.fun (isoSet i)
inv : H → G
inv = I.Iso.inv (isoSet i)
rightInv : I.section fun inv
rightInv = I.Iso.rightInv (isoSet i)
leftInv : I.retract fun inv
leftInv = I.Iso.leftInv (isoSet i)
e' : G E.≃ H
e' = E.isoToEquiv (I.iso fun inv rightInv leftInv)
funMorph : isMorph G_ H_ fun
funMorph = isoSetMorph i
_∘_ : H → H → H
_∘_ = isGroup.comp Hgroup
_⊙_ : G → G → G
_⊙_ = isGroup.comp Ggroup
invMorph : isMorph H_ G_ inv
invMorph h0 h1 = E.invEq (HAE.congEquiv e')
(fun (inv (h0 ∘ h1)) ≡⟨ rightInv (h0 ∘ h1) ⟩
h0 ∘ h1 ≡⟨ cong (λ x → x ∘ h1) (sym (rightInv h0)) ⟩
(fun (inv h0)) ∘ h1 ≡⟨ cong (λ x → fun (inv h0) ∘ x) (sym (rightInv h1)) ⟩
(fun (inv h0)) ∘ (fun (inv h1)) ≡⟨ sym (funMorph (inv h0) (inv h1)) ⟩
fun ((inv h0) ⊙ (inv h1)) ∎ )
Equiv→Iso' : ∀ {ℓ ℓ'} {G : Group ℓ} {H : Group ℓ'} → G ≃ H → Iso' G H
Equiv→Iso' {G = group G Gset Ggroup}
{H = group H Hset Hgroup}
e = iso' i' (e .fst .snd)
where
e' : G E.≃ H
e' = (e .fst .fst) , (e .snd)
i' : I.Iso G H
i' = E.equivToIso e'
compMorph : ∀ {ℓ} {F G H : Group ℓ} (I : morph F G) (J : morph G H) → morph F H
compMorph {ℓ} {group F Fset (group-struct _ _ _⊙_ _ _ _ _ _)}
{group G Gset (group-struct _ _ _∙_ _ _ _ _ _)}
{group H Hset (group-struct _ _ _∘_ _ _ _ _ _)}
(i , ic) (j , jc) = k , kc
where
k : F → H
k f = j (i f)
kc : (g0 g1 : F) → k (g0 ⊙ g1) ≡ (k g0) ∘ (k g1)
kc g0 g1 = j (i (g0 ⊙ g1)) ≡⟨ cong j (ic _ _) ⟩
j (i g0 ∙ i g1) ≡⟨ jc _ _ ⟩
j (i g0) ∘ j (i g1) ∎
compIso : ∀ {ℓ} {F G H : Group ℓ} (I : Iso F G) (J : Iso G H) → Iso F H
compIso {ℓ} {F} {G} {H}
(iso F→G G→F fg gf) (iso G→H H→G gh hg ) = iso F→H H→F sec ret
where
F→H : morph F H
F→H = compMorph {ℓ} {F} {G} {H} F→G G→H
H→F : morph H F
H→F = compMorph {ℓ} {H} {G} {F} H→G G→F
open Group
f→h : F .type → H .type
f→h = F→H .fst
f→g : F .type → G .type
f→g = F→G .fst
g→h : G .type → H .type
g→h = G→H .fst
h→f : H .type → F .type
h→f = H→F .fst
h→g : H .type → G .type
h→g = H→G .fst
g→f : G .type → F .type
g→f = G→F .fst
sec : I.section f→h h→f
sec h = f→h (h→f h) ≡⟨ cong g→h (fg (h→g h)) ⟩
g→h (h→g h) ≡⟨ gh _ ⟩
h ∎
ret : I.retract f→h h→f
ret f = h→f (f→h f) ≡⟨ cong g→f (hg (f→g f)) ⟩
g→f (f→g f) ≡⟨ gf _ ⟩
f ∎
| 28.09816
| 119
| 0.504585
|
21a5308d2f0637281af5900a0f5339424f1c86f4
| 1,315
|
agda
|
Agda
|
agda-stdlib-0.9/src/Category/Applicative/Predicate.agda
|
qwe2/try-agda
|
9d4c43b1609d3f085636376fdca73093481ab882
|
[
"Apache-2.0"
] | 1
|
2016-10-20T15:52:05.000Z
|
2016-10-20T15:52:05.000Z
|
agda-stdlib-0.9/src/Category/Applicative/Predicate.agda
|
qwe2/try-agda
|
9d4c43b1609d3f085636376fdca73093481ab882
|
[
"Apache-2.0"
] | null | null | null |
agda-stdlib-0.9/src/Category/Applicative/Predicate.agda
|
qwe2/try-agda
|
9d4c43b1609d3f085636376fdca73093481ab882
|
[
"Apache-2.0"
] | null | null | null |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Applicative functors on indexed sets (predicates)
------------------------------------------------------------------------
-- Note that currently the applicative functor laws are not included
-- here.
module Category.Applicative.Predicate where
open import Category.Functor.Predicate
open import Data.Product
open import Function
open import Level
open import Relation.Unary
open import Relation.Unary.PredicateTransformer using (Pt)
------------------------------------------------------------------------
record RawPApplicative {i ℓ} {I : Set i} (F : Pt I ℓ) :
Set (i ⊔ suc ℓ) where
infixl 4 _⊛_ _<⊛_ _⊛>_
infix 4 _⊗_
field
pure : ∀ {P} → P ⊆ F P
_⊛_ : ∀ {P Q} → F (P ⇒ Q) ⊆ F P ⇒ F Q
rawPFunctor : RawPFunctor F
rawPFunctor = record
{ _<$>_ = λ g x → pure g ⊛ x
}
private
open module RF = RawPFunctor rawPFunctor public
_<⊛_ : ∀ {P Q} → F P ⊆ const (∀ {j} → F Q j) ⇒ F P
x <⊛ y = const <$> x ⊛ y
_⊛>_ : ∀ {P Q} → const (∀ {i} → F P i) ⊆ F Q ⇒ F Q
x ⊛> y = flip const <$> x ⊛ y
_⊗_ : ∀ {P Q} → F P ⊆ F Q ⇒ F (P ∩ Q)
x ⊗ y = (_,_) <$> x ⊛ y
zipWith : ∀ {P Q R} → (P ⊆ Q ⇒ R) → F P ⊆ F Q ⇒ F R
zipWith f x y = f <$> x ⊛ y
| 26.836735
| 72
| 0.469962
|
1b396aefcda2e04fe6bbc5a71140cb3c753e1f6e
| 29,801
|
agda
|
Agda
|
src/DualContractive.agda
|
peterthiemann/dual-session
|
7a8bc1f6b2f808bd2a22c592bd482dbcc271979c
|
[
"BSD-2-Clause"
] | 1
|
2022-02-13T05:43:25.000Z
|
2022-02-13T05:43:25.000Z
|
src/DualContractive.agda
|
peterthiemann/dual-session
|
7a8bc1f6b2f808bd2a22c592bd482dbcc271979c
|
[
"BSD-2-Clause"
] | null | null | null |
src/DualContractive.agda
|
peterthiemann/dual-session
|
7a8bc1f6b2f808bd2a22c592bd482dbcc271979c
|
[
"BSD-2-Clause"
] | 1
|
2019-12-07T16:12:50.000Z
|
2019-12-07T16:12:50.000Z
|
{-# OPTIONS --rewriting #-}
module DualContractive where
open import Data.Fin
open import Data.Maybe
open import Data.Nat hiding (_≤_ ; compare) renaming (_+_ to _+ℕ_)
open import Data.Nat.Properties
open import Data.Sum hiding (map)
open import Data.Product
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality hiding (Extensionality)
open import Function
open import Types.Direction
open import Auxiliary.Extensionality
open import Max hiding (n)
----------------------------------------------------------------------
-- see also https://github.com/zmthy/recursive-types/tree/ftfjp16
-- for encoding of recursive types
variable
m n : ℕ
i i' j : Fin n
----------------------------------------------------------------------
-- lemmas for rewriting
n+1=suc-n : n +ℕ 1 ≡ suc n
n+1=suc-n {zero} = refl
n+1=suc-n {suc n} = cong suc (n+1=suc-n {n})
n+0=n : n +ℕ 0 ≡ n
n+0=n {zero} = refl
n+0=n {suc n} = cong suc (n+0=n {n})
n+sucm=sucn+m : ∀ n m → n +ℕ suc m ≡ suc (n +ℕ m)
n+sucm=sucn+m zero m = refl
n+sucm=sucn+m (suc n) m = cong suc (n+sucm=sucn+m n m)
{-# REWRITE n+sucm=sucn+m #-}
open import Agda.Builtin.Equality.Rewrite
----------------------------------------------------------------------
-- auxiliaries for automatic rewriting
{- REWRITE n+1=suc-n #-}
{-# REWRITE n+0=n #-}
-- inject+0-x=x : {x : Fin m} → inject+ 0 x ≡ x
-- inject+0-x=x {x = zero} = refl
-- inject+0-x=x {x = suc x} = cong suc inject+0-x=x
{- REWRITE inject+0-x=x #-}
----------------------------------------------------------------------
-- types and session types
data TType (n : ℕ) : Set
data SType (n : ℕ) : Set
data TType n where
TInt : TType n
TChn : (S : SType n) → TType n
data SType n where
xmt : (d : Dir) (T : TType n) (S : SType n) → SType n
end : SType n
rec : (S : SType (suc n)) → SType n
var : (x : Fin n) → SType n
variable
t T : TType n
s s₀ S S₀ : SType n
----------------------------------------------------------------------
module Examples-Types where
sint : SType n → SType n
sint = xmt SND TInt
-- μ X. !Int. X
s1 : SType 0
s1 = rec (sint (var zero))
-- μ X. μ Y. !Int. Y
s2 : SType 0
s2 = rec (rec (sint (var zero)))
-- μ X. μ Y. !Int. X
s2a : SType 0
s2a = rec (rec (sint (var (suc zero))))
-- μ X. !Int. μ Y. X
s3 : SType 0
s3 = rec (sint (rec (var (suc zero))))
module Alternative-Substitution where
-- analogous to https://plfa.github.io/DeBruijn/
-- extending a map by an identity segment
extV : (Fin m → Fin n) → (Fin (suc m) → Fin (suc n))
extV ρ zero = zero
extV ρ (suc i) = suc (ρ i)
-- renaming / can be used for weakening one binding as @rename suc@
renameT : (Fin m → Fin n) → TType m → TType n
renameS : (Fin m → Fin n) → SType m → SType n
renameT ρ TInt = TInt
renameT ρ (TChn S) = TChn (renameS ρ S)
renameS ρ (xmt d T S) = xmt d (renameT ρ T) (renameS ρ S)
renameS ρ end = end
renameS ρ (rec S) = rec (renameS (extV ρ) S)
renameS ρ (var x) = var (ρ x)
-- extending a map from variables to terms
extS : (Fin m → SType n) → (Fin (suc m) → SType (suc n))
extS σ zero = var zero
extS σ (suc i) = renameS suc (σ i)
-- simultaneous substitution
substT : (Fin m → SType n) → TType m → TType n
substS : (Fin m → SType n) → SType m → SType n
substT σ TInt = TInt
substT σ (TChn S) = TChn (substS σ S)
substS σ (xmt d T S) = xmt d (substT σ T) (substS σ S)
substS σ end = end
substS σ (rec S) = rec (substS (extS σ) S)
substS σ (var x) = σ x
-- single substitution
mk-σ : SType n → Fin (suc n) → SType n
mk-σ S' zero = S'
mk-σ S' (suc x) = var x
substT1 : SType n → TType (suc n) → TType n
substT1 S' T = substT (mk-σ S') T
substS1 : SType n → SType (suc n) → SType n
substS1 S' S = substS (mk-σ S') S
----------------------------------------------------------------------
-- weakening
increase : ∀ m → (x : Fin n) → Fin (n +ℕ m)
increase zero x = x
increase (suc m) x = suc (increase m x)
increaseS : ∀ m → SType n → SType (n +ℕ m)
increaseT : ∀ m → TType n → TType (n +ℕ m)
increaseS m (xmt d t s) = xmt d (increaseT m t) (increaseS m s)
increaseS m (rec s) = rec (increaseS m s)
increaseS m (var x) = var (inject+ m x) -- should say increase here
increaseS m end = end
increaseT m TInt = TInt
increaseT m (TChn s) = TChn (increaseS m s)
-- weaken m is used to push a (closed) term under m new binders
weakenS : ∀ m → SType n → SType (n +ℕ m)
weakenT : ∀ m → TType n → TType (n +ℕ m)
weakenS m (xmt d t s) = xmt d (weakenT m t) (weakenS m s)
weakenS m (rec s) = rec (weakenS m s)
weakenS m (var x) = var (inject+ m x)
weakenS m end = end
weakenT m TInt = TInt
weakenT m (TChn s) = TChn (weakenS m s)
weaken1S : SType n → SType (suc n)
weaken1S s = weakenS 1 s
-- this one behaves correctly
weaken'S : ∀ m → Fin (suc n) → SType n → SType (n +ℕ m)
weaken'T : ∀ m → Fin (suc n) → TType n → TType (n +ℕ m)
weaken'S m i (xmt d T S) = xmt d (weaken'T m i T) (weaken'S m i S)
weaken'S m i end = end
weaken'S m i (rec S) = rec (weaken'S m (suc i) S)
weaken'S {suc n} m zero (var x) = var (increase m x)
weaken'S {suc n} m (suc i) (var x)
with compare i x
weaken'S {suc n} m (suc .(inject least)) (var x) | less .x least = var (increase m x)
weaken'S {suc n} m (suc i) (var .i) | equal .i = var (inject+ m i)
weaken'S {suc n} m (suc i) (var .(inject least)) | greater .i least = var (inject+ m (inject least))
weaken'T m i TInt = TInt
weaken'T m i (TChn S) = TChn (weaken'S m i S)
weaken'S0 : ∀ m → SType n → SType (n +ℕ m)
weaken'S0 m S = weaken'S m (fromℕ _) S
----------------------------------------------------------------------
-- examples
module Examples-Weakening where
sv0 sv1 : SType 1
sv0 = rec (var zero)
sv1 = rec (var (suc zero))
sv0-w : SType 2
sv0-w = weaken'S 1 zero sv0
step0 : weaken'S{2} 1 zero (var zero) ≡ var (suc zero)
× weaken'S{2} 1 zero (var (suc zero)) ≡ var (suc (suc zero))
step0 = refl , refl
step1 : weaken'S{2} 1 (suc zero) (var zero) ≡ var zero
× weaken'S{2} 1 (suc zero) (var (suc zero)) ≡ var (suc (suc zero))
step1 = refl , refl
stepr1 : weaken'S 1 zero sv0 ≡ rec (var zero)
× weaken'S 1 zero sv1 ≡ rec (var (suc (suc zero)))
stepr1 = refl , refl
stepr2 : weaken'S{3} 1 zero (rec (rec (var zero))) ≡ rec (rec (var zero))
× weaken'S{3} 1 zero (rec (rec (var (suc zero)))) ≡ rec (rec (var (suc zero)))
× weaken'S{3} 1 zero (rec (rec (var (suc (suc zero))))) ≡ rec (rec (var (suc (suc (suc zero)))))
stepr2 = refl , refl , refl
sx1 : SType 0
sx1 = rec (xmt SND TInt (var zero))
sx1-w : SType 1
sx1-w = rec (xmt SND TInt (var zero))
sx1=sx1-w : sx1-w ≡ weaken'S 1 zero sx1
sx1=sx1-w = refl
sx2 : SType 1
sx2 = xmt SND TInt (var zero)
sx2-w1 : SType 2
sx2-w1 = xmt SND TInt (var (suc zero))
sx2-w0 : SType 2
sx2-w0 = xmt SND TInt (var zero)
sx2=w : sx2-w1 ≡ weaken'S 1 zero sx2
× sx2-w0 ≡ weaken'S 1 (suc zero) sx2
sx2=w = refl , refl
open Alternative-Substitution
step0-r : renameS suc sv0 ≡ rec (var zero)
× renameS suc sv1 ≡ rec (var (suc (suc zero)))
step0-r = refl , refl
step1-r : renameS{1} suc (rec (rec (var zero))) ≡ (rec (rec (var zero)))
× renameS{1} suc (rec (rec (var (suc zero)))) ≡ (rec (rec (var (suc zero))))
× renameS{1} suc (rec (rec (var (suc (suc zero))))) ≡ (rec (rec (var (suc (suc (suc zero))))))
step1-r = refl , refl , refl
----------------------------------------------------------------------
-- contractivity
mutual
data ContractiveT {n} : TType n → Set where
con-int : ContractiveT TInt
con-chn : Contractive zero S → ContractiveT (TChn S)
data Contractive (i : Fin (suc n)) : SType n → Set where
con-xmt : ContractiveT t → Contractive zero s → Contractive i (xmt d t s)
con-end : Contractive i end
con-rec : Contractive (suc i) S → Contractive i (rec S)
con-var : i ≤ inject₁ j → Contractive i (var j)
----------------------------------------------------------------------
module Examples-Contractivity where
open Examples-Types
cn1 : ¬ Contractive {2} (suc zero) (var zero)
cn1 (con-var ())
cp1 : Contractive {2} zero (var (suc zero))
cp1 = con-var z≤n
cp0 : Contractive {2} zero (var zero)
cp0 = con-var z≤n
cs1 : Contractive zero s1
cs1 = con-rec (con-xmt con-int (con-var z≤n))
cs2 : Contractive zero s2
cs2 = con-rec (con-rec (con-xmt con-int (con-var z≤n)))
cs2a : Contractive zero s2a
cs2a = con-rec (con-rec (con-xmt con-int (con-var z≤n)))
sp2 : SType 0
sp2 = s3
cp2 : Contractive zero sp2
cp2 = con-rec (con-xmt con-int (con-rec (con-var (s≤s z≤n))))
sn2 : SType 0
sn2 = (rec (xmt SND TInt (rec (var zero))))
cn2 : ¬ Contractive zero sn2
cn2 (con-rec (con-xmt con-int (con-rec (con-var ()))))
module Alternative-Unfolding where
open Alternative-Substitution
-- one top-level unfolding if possible
unfold₁ : SType n → SType n
unfold₁ (rec S) = substS1 (rec S) S
unfold₁ S@(xmt d T x) = S
unfold₁ S@end = S
unfold₁ S@(var x) = S
-- unfold all the way
unfold : (S : SType n) (σ : SType n → SType m) → SType m
unfold S@(xmt d T S') σ = σ S
unfold end σ = end
unfold (rec S) σ = unfold S (σ ∘ substS1 (rec S))
unfold S@(var x) σ = σ S
unfold₀ : SType n → SType n
unfold₀ S = unfold S id
----------------------------------------------------------------------
-- substitution
ssubst : SType (suc n) → Fin (suc n) → SType 0 → SType n
tsubst : TType (suc n) → Fin (suc n) → SType 0 → TType n
ssubst (xmt d t s) i s0 = xmt d (tsubst t i s0) (ssubst s i s0)
ssubst (rec s) i s0 = rec (ssubst s (suc i) s0)
ssubst {n} (var zero) zero s0 = increaseS n s0
ssubst {suc n} (var zero) (suc i) s0 = var zero
ssubst (var (suc x)) zero s0 = var x
ssubst {suc n} (var (suc x)) (suc i) s0 = increaseS 1 (ssubst (var x) i s0)
ssubst end i s0 = end
tsubst TInt i s₀ = TInt
tsubst (TChn s) i s₀ = TChn (ssubst s i s₀)
----------------------------------------------------------------------
-- unfolding to first non-rec constructor
unfold : (s : SType n) (c : Contractive i s) (σ : SType n → SType 0) → SType 0
unfold (xmt d t s) (con-xmt ct c) σ = σ (xmt d t s)
unfold end con-end σ = end
unfold (rec s) (con-rec c) σ = unfold s c (σ ∘ λ sn' → ssubst sn' zero (σ (rec s)))
unfold {i = zero} (var x) (con-var z≤n) σ = σ (var x)
unfold {i = suc i} (var zero) (con-var ()) σ
unfold {i = suc i} (var (suc x)) (con-var (s≤s x₁)) σ = unfold (var x) (con-var x₁) (σ ∘ increaseS 1)
unfold₀ : (S : SType 0) (c : Contractive zero S) → SType 0
unfold₀ S c = unfold S c id
----------------------------------------------------------------------
module Examples-Unfold where
open Examples-Types
c1 : Contractive zero s1
c1 = con-rec (con-xmt con-int (con-var z≤n))
s11 : SType 0
s11 = xmt SND TInt s1
u-s1=s11 : unfold s1 c1 id ≡ s11
u-s1=s11 = refl
c2 : Contractive zero s2
c2 = con-rec (con-rec (con-xmt con-int (con-var z≤n)))
u-s2=s11 : unfold s2 c2 id ≡ s11
u-s2=s11 = cong (xmt SND TInt) (cong rec (cong (xmt SND TInt) refl))
----------------------------------------------------------------------
-- contractivity is decidable
infer-contractiveT : (t : TType n) → Dec (ContractiveT t)
infer-contractive : (s : SType n) (i : Fin (suc n)) → Dec (Contractive i s)
infer-contractiveT TInt = yes con-int
infer-contractiveT (TChn s)
with infer-contractive s zero
infer-contractiveT (TChn s) | yes p = yes (con-chn p)
infer-contractiveT (TChn s) | no ¬p = no (λ { (con-chn cs) → ¬p cs })
infer-contractive (xmt d t s) i
with infer-contractiveT t | infer-contractive s zero
infer-contractive (xmt d t s) i | yes p | yes p₁ = yes (con-xmt p p₁)
infer-contractive (xmt d t s) i | yes p | no ¬p = no (λ { (con-xmt ct cs) → ¬p cs })
infer-contractive (xmt d t s) i | no ¬p | yes p = no (λ { (con-xmt ct cs) → ¬p ct })
infer-contractive (xmt d t s) i | no ¬p | no ¬p₁ = no (λ { (con-xmt ct cs) → ¬p₁ cs})
infer-contractive end i = yes con-end
infer-contractive (rec s) i
with infer-contractive s (suc i)
infer-contractive (rec s) i | yes p = yes (con-rec p)
infer-contractive (rec s) i | no ¬p = no (λ { (con-rec c) → ¬p c })
infer-contractive (var x) zero = yes (con-var z≤n)
infer-contractive (var zero) (suc i) = no (λ { (con-var ()) })
infer-contractive (var (suc x)) (suc i)
with infer-contractive (var x) i
infer-contractive (var (suc x)) (suc i) | yes (con-var x₁) = yes (con-var (s≤s x₁))
infer-contractive (var (suc x)) (suc i) | no ¬p = no (λ { (con-var (s≤s y)) → ¬p (con-var y) })
----------------------------------------------------------------------
module Examples-Inference where
open Examples-Contractivity
infer-p2 : infer-contractive sp2 zero ≡ yes cp2
infer-p2 = refl
infer-n2 : infer-contractive sn2 zero ≡ no cn2
infer-n2 = cong no (ext (λ { (con-rec (con-xmt con-int (con-rec (con-var ())))) }))
----------------------------------------------------------------------
-- RT: if a type is contractive at level i, then it is also contractive at any smaller level
c-weakenS : {S : SType n} (i' : Fin′ i) → Contractive i S → Contractive (inject i') S
c-weakenS i' (con-rec cis) = con-rec (c-weakenS (suc i') cis)
c-weakenS i' (con-xmt x cis) = con-xmt x cis
c-weakenS i' con-end = con-end
c-weakenS {i = suc i} i' (con-var {zero} ())
c-weakenS {i = suc i} zero (con-var {suc n} (s≤s x)) = con-var z≤n
c-weakenS {i = suc i} (suc i') (con-var {suc n} (s≤s x)) = con-var (s≤s (trans-< x))
c-weakenS₁ : {S : SType n} → Contractive (suc i) S → Contractive (inject₁ i) S
c-weakenS₁ (con-rec cis) = con-rec (c-weakenS₁ cis)
c-weakenS₁ (con-xmt x cis) = con-xmt x cis
c-weakenS₁ con-end = con-end
c-weakenS₁ {zero} {()} (con-var x)
c-weakenS₁ {suc n} {zero} (con-var x) = con-var z≤n
c-weakenS₁ {suc n} {suc i} (con-var x) = con-var (pred-≤ x)
c-weakenS! : {S : SType n} → Contractive i S → Contractive zero S
c-weakenS! {i = zero} (con-rec cis) = con-rec cis
c-weakenS! {i = suc i} (con-rec cis) = con-rec (c-weakenS (suc zero) cis)
c-weakenS! {n} {i} (con-xmt x cis) = con-xmt x cis
c-weakenS! {n} {i} con-end = con-end
c-weakenS! {n} {i} (con-var x) = con-var z≤n
ct-weaken+ : {T : TType n} → ContractiveT T → ContractiveT (weaken'T 1 zero T)
c-weaken+ : {S : SType n} → Contractive i S → Contractive (suc i) (weaken'S 1 zero S)
ct-weaken+ con-int = con-int
ct-weaken+ (con-chn x) = con-chn (c-weakenS! (c-weaken+ x))
c-weaken+ (con-xmt x cis) = con-xmt (ct-weaken+ x) (c-weakenS! (c-weaken+ cis))
c-weaken+ con-end = con-end
c-weaken+ (con-rec cis) = con-rec {!!} -- gives a problem: (c-weaken+ {!cis!})
c-weaken+ {suc n} {i} {var j} (con-var i≤j) = con-var (s≤s i≤j)
module Alternative-Multiple-Substitution-Preserves where
open Alternative-Substitution
subst-contr-T :
{T : TType m}
(σ : Fin m → SType n)
(γ : (j : Fin m) → Contractive i (σ j))
(ct : ContractiveT T)
→ ContractiveT (substT σ T)
subst-contr-S : ∀ {k} →
(σ : Fin m → SType n)
(γ : (j : Fin m) → Contractive k (σ j))
(c : Contractive zero S)
→ Contractive k (substS σ S)
subst-contr-T σ γ con-int = con-int
subst-contr-T σ γ (con-chn cs) = con-chn (subst-contr-S σ (c-weakenS! ∘ γ) cs)
subst-contr-S σ γ (con-xmt ct cs) =
con-xmt (subst-contr-T σ γ ct) (subst-contr-S σ (c-weakenS! ∘ γ) cs)
subst-contr-S σ γ con-end = con-end
subst-contr-S σ γ (con-rec cs) = con-rec (subst-contr-S (extS σ) {!extS!} (c-weakenS₁ cs))
subst-contr-S σ γ (con-var{j} x) = γ j
module Alternative-Substitution-Preserves where
open Alternative-Substitution
subst-contr-T :
{S' : SType n} (c' : Contractive i S')
{T : TType (suc n)} (c : ContractiveT T)
→ ContractiveT (substT1 S' T)
subst-contr-S :
{S' : SType n} (c' : Contractive i S')
{S : SType (suc n)} (c : Contractive (inject₁ i) S)
→ Contractive i (substS1 S' S)
subst-contr-T c' con-int = con-int
subst-contr-T c' (con-chn x) = con-chn (subst-contr-S (c-weakenS! c') x)
subst-contr-S c' (con-xmt ct cs) =
con-xmt (subst-contr-T c' ct) (subst-contr-S (c-weakenS! c') cs)
subst-contr-S c' con-end = con-end
subst-contr-S c' (con-rec c) = con-rec {!!} -- (subst-contr-S {!!} {!c!})
subst-contr-S c' (con-var x) = {!!}
module Alternative-SingleSubstitution where
----------------------------------------------------------------------
-- single substitution of j ↦ Sj
subst1T : (T : TType (suc n)) (j : Fin (suc n)) (Sj : SType n) → TType n
subst1S : (S : SType (suc n)) (j : Fin (suc n)) (Sj : SType n) → SType n
subst1T TInt j Sj = TInt
subst1T (TChn S) j Sj = TChn (subst1S S j Sj)
subst1S (xmt d T S) j Sj = xmt d (subst1T T j Sj) (subst1S S j Sj)
subst1S end j Sj = end
subst1S (rec S) j Sj = rec (subst1S S (suc j) (weaken'S 1 zero Sj))
subst1S (var x) j Sj
with compare x j
subst1S (var .(inject least)) j Sj | less .j least = var (inject! least)
subst1S (var x) .x Sj | equal .x = Sj
subst1S (var (suc x)) .(inject least) Sj | greater .(suc x) least = var x
{- the termination checker doesnt like this:
subst1S (var zero) zero Sj = Sj
subst1S {suc n} (var zero) (suc j) Sj = var zero
subst1S (var (suc x)) zero Sj = var x
subst1S (var (suc x)) (suc j) Sj = subst1S (var (inject₁ x)) (inject₁ j) Sj
-}
unfold1S : (S : SType 0) → SType 0
unfold1S (xmt d T S) = xmt d T S
unfold1S end = end
unfold1S (rec S) = subst1S S zero (rec S)
unfoldSS : (S : SType n) → SType n
unfoldSS (xmt d T S) = xmt d T S
unfoldSS end = end
unfoldSS (rec S)
with unfoldSS S
... | ih = subst1S ih zero (rec ih)
unfoldSS (var x) = var x
----------------------------------------------------------------------
-- max index substitution
subst-maxT : (Sm : SType n) (T : TType (suc n)) → TType n
subst-maxS : (Sm : SType n) (S : SType (suc n)) → SType n
subst-maxT Sm TInt = TInt
subst-maxT Sm (TChn S) = TChn (subst-maxS Sm S)
subst-maxS Sm (xmt d T S) = xmt d (subst-maxT Sm T) (subst-maxS Sm S)
subst-maxS Sm end = end
subst-maxS Sm (rec S) = rec (subst-maxS (weaken'S 1 zero Sm) S)
subst-maxS Sm (var x)
with max? x
subst-maxS Sm (var x) | yes p = Sm
subst-maxS Sm (var x) | no ¬p = var (reduce ¬p)
unfoldmS : (S : SType n) → SType n
unfoldmS (xmt d T S) = xmt d T S
unfoldmS end = end
unfoldmS (rec S) = subst-maxS (rec S) S
unfoldmS {suc n} (var x) = var x
----------------------------------------------------------------------
-- max substitution preserves contractivity
subst-contr-mT :
{T : TType (suc n)} (c : ContractiveT T)
{S' : SType n} (c' : Contractive i S')
→ ContractiveT (subst-maxT S' T)
subst-contr-mS :
-- {i : Fin (suc (suc n))}
{S : SType (suc n)} (c : Contractive (inject₁ i) S)
{S' : SType n} (c' : Contractive i S')
→ Contractive i (subst-maxS S' S)
subst-contr-mT con-int csm = con-int
subst-contr-mT (con-chn x) csm = con-chn (c-weakenS! (subst-contr-mS x (c-weakenS! csm)))
subst-contr-mS (con-xmt x cs) csm = con-xmt (subst-contr-mT x csm) (subst-contr-mS cs (c-weakenS! csm))
subst-contr-mS con-end csm = con-end
subst-contr-mS (con-rec cs) csm = con-rec (subst-contr-mS cs (c-weaken+ csm))
subst-contr-mS {S = var j} (con-var x) csm
with max? j
subst-contr-mS {i = _} {var j} (con-var x) csm | yes p = csm
subst-contr-mS {i = _} {var j} (con-var x) csm | no ¬p = con-var (lemma-reduce x ¬p)
-- one step unfolding preserves contractivity
unfold-contr : Contractive i S → Contractive i (unfoldmS S)
unfold-contr (con-xmt x c) = con-xmt x c
unfold-contr con-end = con-end
unfold-contr (con-rec c) = subst-contr-mS (c-weakenS₁ c) (con-rec c)
unfold-contr (con-var x) = {!!}
-- multiple unfolding
-- terminates even for non-contractive types because it delays the substitution
unfold! : (S : SType n) (σ : SType n → SType 0) → SType 0
unfold! (xmt d T S) σ = σ (xmt d T S)
unfold! end σ = end
unfold! (rec S) σ = unfold! S (σ ∘ subst-maxS (rec S))
unfold! (var x) σ = σ (var x)
-- unclear how this could be completed
-- unfold!-contr : Contractive i S → Contractive i (unfold! S id)
-- unfold!-contr (con-xmt x cs) = con-xmt x cs
-- unfold!-contr con-end = con-end
-- unfold!-contr (con-rec cs) = {!!}
-- multiple unfolding preserves contractivity
TCType : (n : ℕ) → Set
TCType n = Σ (TType n) ContractiveT
SCType : (n : ℕ) → Fin (suc n) → Set
SCType n i = Σ (SType n) (Contractive i)
unfold!! : (SC : SCType n i) → (SCType n i → SCType 0 zero) → SCType 0 zero
unfold!! SC@(xmt d T S , con-xmt x cs) σ = σ SC
unfold!! (end , con-end) σ = end , con-end
unfold!! (rec S , con-rec cs) σ =
unfold!! (S , cs) (σ ∘ λ{ (S' , c') → (subst-maxS (rec S) S') , (subst-contr-mS (c-weakenS₁ c') (con-rec cs)) })
unfold!! SC@(var x , con-var x₁) σ = σ SC
{-# TERMINATING #-}
unfold!!! : ∀ {m n : ℕ} → SCType (n +ℕ m) zero → (SCType (n +ℕ m) zero → SCType m zero) → SCType m zero
unfold!!! SC@(xmt d T S , con-xmt x cs) σ = σ SC
unfold!!! (end , con-end) σ = end , con-end
unfold!!! (rec S , con-rec cs) σ =
unfold!!! (S , c-weakenS₁ cs) (σ ∘ λ SC → (subst-maxS (rec S) (proj₁ SC)) , (subst-contr-mS (proj₂ SC) (con-rec cs)))
unfold!!! SC@(var x , con-var x₁) σ = σ SC
----------------------------------------------------------------------
-- equivalence requires multiple unfolding
variable
T₁ T₂ : TCType n
S₁ S₂ : SCType n i
data EquivT (R : SCType n zero → SCType n zero → Set) : TCType n → TCType n → Set where
eq-int : EquivT R (TInt , con-int) (TInt , con-int)
eq-chn : R S₁ S₂ →
EquivT R (TChn (proj₁ S₁) , con-chn (proj₂ S₁))
(TChn (proj₁ S₂) , con-chn (proj₂ S₂))
data EquivS (R : SCType n zero → SCType n zero → Set) :
(S₁ S₂ : SCType n zero) → Set where
eq-end :
EquivS R (end , con-end) (end , con-end)
eq-xmt : (d : Dir) →
EquivT R T₁ T₂ →
R S₁ S₂ →
EquivS R (xmt d (proj₁ T₁) (proj₁ S₁) , con-xmt (proj₂ T₁) (proj₂ S₁))
(xmt d (proj₁ T₂) (proj₁ S₂) , con-xmt (proj₂ T₂) (proj₂ S₂))
eq-rec-l :
let S = proj₁ S₁ in
let cs = proj₂ S₁ in
EquivS R (subst-maxS (rec S) S , subst-contr-mS (c-weakenS₁ cs) (con-rec cs)) S₂ →
EquivS R (rec S , con-rec cs) S₂
eq-rec-r :
let S = proj₁ S₂ in
let cs = proj₂ S₂ in
EquivS R S₁ (subst-maxS (rec S) S , subst-contr-mS (c-weakenS₁ cs) (con-rec cs)) →
EquivS R S₁ (rec S , con-rec cs)
record Equiv (S₁ S₂ : SCType 0 zero) : Set where
coinductive
field force : EquivS Equiv (unfold!! S₁ id) (unfold!! S₂ id)
record Equiv' (S₁ S₂ : SCType n zero) : Set where
coinductive
field force : EquivS Equiv' (unfold!!!{n = 0} S₁ id) (unfold!!!{n = 0} S₂ id)
{-# TERMINATING #-}
equivt-refl : ∀ T → EquivT Equiv T T
equivs-refl : ∀ S → EquivS Equiv S S
equiv-refl : ∀ S → Equiv S S
equivt-refl (TInt , con-int) = eq-int
equivt-refl (TChn S , con-chn x) = eq-chn (equiv-refl (S , x))
equivs-refl (xmt d t s , con-xmt ct cs) = eq-xmt d (equivt-refl (t , ct)) (equiv-refl (s , cs))
equivs-refl (end , con-end) = eq-end
equivs-refl (rec s , con-rec cs) = eq-rec-l (eq-rec-r (equivs-refl ((subst-maxS (rec s) s) , (subst-contr-mS (c-weakenS₁ cs) (con-rec cs)))))
Equiv.force (equiv-refl S) = equivs-refl (unfold!! S id)
----------------------------------------------------------------------
-- prove equivalence of one-level unrolling
-- μX S ≈ S [μX S / X]
module μ-unrolling where
unfold-≡ : ∀ S cs →
unfold!! (S , cs) (λ { (S' , c') → (subst-maxS (rec S) S') , (subst-contr-mS (c-weakenS₁ c') (con-rec cs)) })
≡
(unfold!!
(subst-maxS (rec S) S ,
subst-contr-mS (c-weakenS₁ cs) (con-rec cs))
id)
unfold-≡ (xmt d T S) (con-xmt x cs) = refl
unfold-≡ end con-end = refl
unfold-≡ (rec S) (con-rec cs) = {!!}
unfold-≡ (var x) (con-var x₁)
with max? x
unfold-≡ (var x) (con-var x₁) | yes p = {!!}
unfold-≡ (var x) (con-var x₁) | no ¬p = refl
unroll : SCType n i → SCType n i
unroll SC@(xmt d T S , con-xmt x cs) = SC
unroll SC@(end , con-end) = SC
unroll (rec S , cs@(con-rec cs')) = (subst-maxS (rec S) S) , (subst-contr-mS (c-weakenS₁ cs') cs)
unroll SC@(var x , con-var x₁) = SC
unroll-equiv : (SC : SCType 0 zero) → Equiv SC (unroll SC)
Equiv.force (unroll-equiv SC@(xmt d T S , con-xmt x cs))
with unroll SC
... | SC' = equivs-refl SC'
Equiv.force (unroll-equiv (end , con-end)) = eq-end
Equiv.force (unroll-equiv (rec S , con-rec cs))
rewrite unfold-≡ S cs =
let S₁ = unfold!! (S , cs) (λ { (S' , c') → (subst-maxS (rec S) S') , (subst-contr-mS (c-weakenS₁ c') (con-rec cs)) }) in
let eqx = equivs-refl S₁ in
{!S₁!}
----------------------------------------------------------------------
-- prove the folk theorem
-- μX μY S = μY [Y/X]S
module μ-examples where
r1 : SType 0
r1 = rec (rec (xmt SND (TChn (var zero)) (var (suc zero))))
r2 : SType n
r2 = rec (xmt SND (TChn (var zero)) (var zero))
r2a : SType 0
r2a = rec r2
r2b : SType n
r2b = rec (rec (xmt SND (TChn (var zero)) (var (suc zero))))
r2-unfolded : SType 0
r2-unfolded = xmt SND (TChn r2) r2
r2-unf : SType 0
r2-unf = rec (xmt SND (TChn (var zero)) r2b)
rc2-unf : SCType 0 zero
rc2-unf = r2-unf , (con-rec (con-xmt (con-chn (con-var z≤n)) (con-rec (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n))))))
rc1 : SCType 0 zero
rc1 = r1 , (con-rec (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n))))
rc2 : SCType n zero
rc2 = r2 , (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n)))
rc2a : SCType 0 zero
rc2a = r2a , con-rec (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n)))
rc2b : SCType n zero
rc2b = r2b , con-rec (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n)))
rc2-unfolded : SCType 0 zero
rc2-unfolded = r2-unfolded , (con-xmt (con-chn (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n)))) (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n))))
rc2=rc2 : Equiv rc2 rc2
Equiv.force rc2=rc2 = eq-xmt SND (eq-chn rc2=rc2) rc2=rc2
rc2=rc2-unfolded : Equiv rc2 rc2-unfolded
Equiv.force rc2=rc2-unfolded = eq-xmt SND (eq-chn rc2=rc2) rc2=rc2
weak-r2 : SType 0
weak-r2 = rec (weaken'S 1 zero r2)
weak-rc2 : SCType 0 zero
weak-rc2 = weak-r2 , (con-rec (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n))))
r2-weak : SType n
r2-weak = rec (xmt SND ((TChn (weaken'S 1 zero (rec (rec (xmt SND (TChn (var (suc zero))) (var (suc zero)))))))) ((weaken'S 1 zero (rec (rec (xmt SND (TChn (var (suc zero))) (var (suc zero))))))))
rc2-weak : SCType 0 zero
rc2-weak = r2-weak , con-rec (con-xmt (con-chn (con-rec (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n))))) (con-rec (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n)))))
rc2=rc2a : Equiv rc2 rc2a
Equiv.force rc2=rc2a = eq-xmt SND (eq-chn rc2=rc2a) rc2=rc2a
rc2=xxxrc2b : Equiv' rc2 rc2-unf
rc2=rc2b : Equiv' rc2 rc2b
Equiv'.force rc2=xxxrc2b = eq-xmt SND (eq-chn rc2=xxxrc2b) rc2=rc2b
Equiv'.force rc2=rc2b = eq-xmt SND (eq-chn rc2=rc2b) rc2=xxxrc2b
rc2=rc2-weak : Equiv' rc2 rc2-weak
Equiv'.force rc2=rc2-weak = eq-xmt SND (eq-chn {!rc2=rc2b!}) {!!}
rc2=weak-rc2 : Equiv rc2 weak-rc2
Equiv.force rc2=weak-rc2 = eq-xmt SND (eq-chn rc2=rc2a) rc2=rc2a
r3 : SType 0
r3 = rec (xmt SND (TChn (var zero)) (weaken'S 1 zero r1))
rc3 : SCType 0 zero
rc3 = r3 , con-rec (con-xmt (con-chn (con-var z≤n)) (con-rec (con-rec (con-xmt (con-chn (con-var z≤n)) (con-var z≤n)))))
rc1=rc2 : Equiv rc1 rc2
rc3=rc2 : Equiv rc3 rc2
Equiv.force rc1=rc2 = eq-xmt SND (eq-chn rc1=rc2) rc3=rc2
Equiv.force rc3=rc2 = eq-xmt SND (eq-chn rc3=rc2) rc1=rc2
-- end examples
----------------------------------------------------------------------
recrec : SType 2 → SType 0 × SType 0
recrec S = rec (rec S) , rec (subst-maxS (var zero) S)
recrec2 : SType 2 → SType 1
recrec2 S = rec S
conrr1 : {S : SType 2} → Contractive (suc (suc zero)) S → Contractive zero (rec (rec S))
conrr1 cs = con-rec (con-rec cs)
conrr2 : {S : SType 2} → Contractive (suc (suc zero)) S → Contractive (suc zero) (subst-maxS (var zero) S)
conrr2 cs = subst-contr-mS {!subst-contr-mS!} (con-var (s≤s z≤n))
sc-rec : SCType (suc n) (suc i) → SCType n i
sc-rec (S , cs) = (rec S , con-rec cs)
¬fromN≤x : (x : Fin n) → ¬ (fromℕ n ≤ inject₁ x)
¬fromN≤x {suc n} zero ()
¬fromN≤x {suc n} (suc x) (s≤s n≤x) = ¬fromN≤x x n≤x
μμ-lem-gen : {n : ℕ}
→ (S : SType (suc (suc n)))
→ Contractive (suc (suc (fromℕ n))) S
→ Contractive (suc (fromℕ n)) (subst-maxS (var (fromℕ n)) S)
μμ-lem-gen (xmt d T S) (con-xmt x cs) = con-xmt (subst-contr-mT x (con-var z≤n)) (subst-contr-mS cs (con-var z≤n))
μμ-lem-gen end con-end = con-end
μμ-lem-gen (rec S) (con-rec cs) = con-rec (μμ-lem-gen S cs)
μμ-lem-gen (var zero) (con-var ())
μμ-lem-gen (var (suc zero)) (con-var (s≤s ()))
μμ-lem-gen (var (suc (suc x))) (con-var (s≤s (s≤s x₁)))
with ¬fromN≤x x x₁
μμ-lem-gen (var (suc (suc x))) (con-var (s≤s (s≤s x₁))) | ()
μμ-lemma : (S : SType 2) → Contractive (suc (suc zero)) S → Contractive (suc zero) (subst-maxS (var zero) S)
μμ-lemma S cs = μμ-lem-gen S cs
μμ-gen : (S : SType (suc (suc n))) (cs : Contractive (suc (suc (fromℕ n))) S) →
Equiv' (sc-rec (sc-rec (S , {!!})))
(sc-rec ((subst-maxS (var zero) S) , {!!}))
μμ-gen S cs = {!!}
μμ1 : (S : SType 2) (cs : Contractive (suc (suc zero)) S) →
Equiv (sc-rec (sc-rec (S , cs)))
(sc-rec ((subst-maxS (var zero) S) , μμ-lemma S cs))
Equiv.force (μμ1 (xmt d T S) (con-xmt x cs)) = {!!}
Equiv.force (μμ1 end con-end) = eq-end
Equiv.force (μμ1 (rec S) (con-rec cs)) = {!!}
Equiv.force (μμ1 (var x) (con-var x₁)) = {!!}
-- or μX μY S = μX [X/Y]S
μμ2 : (S : SType 2) (cs : Contractive (suc (suc zero)) S) →
Equiv (sc-rec (sc-rec (S , cs)))
let xxx = subst-maxS {!sc-rec!} (rec S) in (sc-rec ((subst-maxS (var zero) S) , (subst-contr-mS (c-weakenS₁ cs) (con-var {!!}))))
μμ2 S cs = {!!}
| 33.297207
| 198
| 0.574578
|
21b1a3a7999a8965cce6d614174043adfc9f9f63
| 5,113
|
agda
|
Agda
|
src/Web/Semantic/DL/Category/Properties/Tensor/SymmNatural.agda
|
bblfish/agda-web-semantic
|
38fbc3af7062ba5c3d7d289b2b4bcfb995d99057
|
[
"MIT"
] | 1
|
2022-02-22T09:43:23.000Z
|
2022-02-22T09:43:23.000Z
|
src/Web/Semantic/DL/Category/Properties/Tensor/SymmNatural.agda
|
bblfish/agda-web-semantic
|
38fbc3af7062ba5c3d7d289b2b4bcfb995d99057
|
[
"MIT"
] | null | null | null |
src/Web/Semantic/DL/Category/Properties/Tensor/SymmNatural.agda
|
bblfish/agda-web-semantic
|
38fbc3af7062ba5c3d7d289b2b4bcfb995d99057
|
[
"MIT"
] | null | null | null |
open import Data.Product using ( proj₁ ; proj₂ )
open import Data.Sum using ( _⊎_ ; inj₁ ; inj₂ )
open import Relation.Binary.PropositionalEquality using ( refl )
open import Web.Semantic.DL.ABox.Interp using ( ⌊_⌋ ; ind ; _*_ )
open import Web.Semantic.DL.ABox.Interp.Morphism using ( _,_ )
open import Web.Semantic.DL.ABox.Model using
( _⊨a_ ; on-bnode ; bnodes ; _,_ ; ⊨a-resp-≲ )
open import Web.Semantic.DL.Category.Composition using ( _∙_ )
open import Web.Semantic.DL.Category.Properties.Composition.Lemmas using
( compose-left ; compose-right ; compose-resp-⊨a )
open import Web.Semantic.DL.Category.Properties.Tensor.Lemmas using
( tensor-up ; tensor-down ; tensor-resp-⊨a )
open import Web.Semantic.DL.Category.Object using ( Object ; IN ; fin )
open import Web.Semantic.DL.Category.Morphism using
( _⇒_ ; BN ; impl ; _⊑_ ; _≣_ ; _,_ )
open import Web.Semantic.DL.Category.Tensor using ( _⊗_ ; _⟨⊗⟩_ )
open import Web.Semantic.DL.Category.Unit using ( I )
open import Web.Semantic.DL.Category.Wiring using
( wires-≈ ; wires-≈⁻¹ ; symm )
open import Web.Semantic.DL.Signature using ( Signature )
open import Web.Semantic.DL.TBox using ( TBox )
open import Web.Semantic.DL.TBox.Interp using ( Δ ; _⊨_≈_ ; ≈-refl ; ≈-sym )
open import Web.Semantic.DL.TBox.Interp.Morphism using ( ≲-refl )
open import Web.Semantic.Util using
( _∘_ ; False ; ⊎-swap
; _⊕_⊕_ ; inode ; bnode ; enode ; left ; right ; up ; down )
module Web.Semantic.DL.Category.Properties.Tensor.SymmNatural
{Σ : Signature} {S T : TBox Σ} where
symm-natural : ∀ {A₁ A₂ B₁ B₂ : Object S T} (F₁ : A₁ ⇒ B₁) (F₂ : A₂ ⇒ B₂) →
((F₁ ⟨⊗⟩ F₂) ∙ symm B₁ B₂ ≣ symm A₁ A₂ ∙ (F₂ ⟨⊗⟩ F₁))
symm-natural {A₁} {A₂} {B₁} {B₂} F₁ F₂ = (LHS⊑RHS , RHS⊑LHS) where
LHS⊑RHS : (F₁ ⟨⊗⟩ F₂) ∙ symm B₁ B₂ ⊑ symm A₁ A₂ ∙ (F₂ ⟨⊗⟩ F₁)
LHS⊑RHS J J⊨STA J⊨LHS = (f , J⊨RHS) where
f : False ⊕ (IN A₂ ⊎ IN A₁) ⊕ (BN F₂ ⊎ BN F₁) → Δ ⌊ J ⌋
f (inode ())
f (bnode (inj₁ x)) = ind J (inode (inj₂ x))
f (bnode (inj₂ x)) = ind J (inode (inj₁ x))
f (enode (inj₁ v)) = ind J (bnode (inode (inj₂ v)))
f (enode (inj₂ v)) = ind J (bnode (inode (inj₁ v)))
lemma₀ : ∀ x →
⌊ J ⌋ ⊨ ind J (inode (⊎-swap x)) ≈ f (bnode x)
lemma₀ (inj₁ x) = ≈-refl ⌊ J ⌋
lemma₀ (inj₂ y) = ≈-refl ⌊ J ⌋
lemma₁ : ∀ x →
⌊ J ⌋ ⊨ ind J (left (up x)) ≈ on-bnode {Σ} f (ind J) (right (down x))
lemma₁ (inode x) = ≈-refl ⌊ J ⌋
lemma₁ (bnode v) = ≈-refl ⌊ J ⌋
lemma₁ (enode y) = wires-≈ ⊎-swap (proj₂ (fin (B₂ ⊗ B₁)) (inj₂ y))
(compose-right (F₁ ⟨⊗⟩ F₂) (symm B₁ B₂) J J⊨LHS)
lemma₂ : ∀ x →
⌊ J ⌋ ⊨ ind J (left (down x)) ≈ on-bnode {Σ} f (ind J) (right (up x))
lemma₂ (inode x) = ≈-refl ⌊ J ⌋
lemma₂ (bnode v) = ≈-refl ⌊ J ⌋
lemma₂ (enode y) = wires-≈ ⊎-swap (proj₂ (fin (B₂ ⊗ B₁)) (inj₁ y))
(compose-right (F₁ ⟨⊗⟩ F₂) (symm B₁ B₂) J J⊨LHS)
J⊨RHS : bnodes J f ⊨a impl (symm A₁ A₂ ∙ (F₂ ⟨⊗⟩ F₁))
J⊨RHS = compose-resp-⊨a (symm A₁ A₂) (F₂ ⟨⊗⟩ F₁) (bnodes J f)
(wires-≈⁻¹ ⊎-swap lemma₀ (proj₁ (fin (A₂ ⊗ A₁))))
(tensor-resp-⊨a F₂ F₁ (right * bnodes J f)
(⊨a-resp-≲ (≲-refl ⌊ J ⌋ , lemma₂) (impl F₂)
(tensor-down F₁ F₂ (left * J)
(compose-left (F₁ ⟨⊗⟩ F₂) (symm B₁ B₂) J J⊨LHS)))
(⊨a-resp-≲ (≲-refl ⌊ J ⌋ , lemma₁) (impl F₁)
(tensor-up F₁ F₂ (left * J)
(compose-left (F₁ ⟨⊗⟩ F₂) (symm B₁ B₂) J J⊨LHS))))
RHS⊑LHS : symm A₁ A₂ ∙ (F₂ ⟨⊗⟩ F₁) ⊑ (F₁ ⟨⊗⟩ F₂) ∙ symm B₁ B₂
RHS⊑LHS J J⊨STA J⊨RHS = (f , J⊨LHS) where
f : ((BN F₁ ⊎ BN F₂) ⊕ (IN B₁ ⊎ IN B₂) ⊕ False) → Δ ⌊ J ⌋
f (inode (inj₁ v)) = ind J (bnode (enode (inj₂ v)))
f (inode (inj₂ v)) = ind J (bnode (enode (inj₁ v)))
f (bnode (inj₁ y)) = ind J (enode (inj₂ y))
f (bnode (inj₂ y)) = ind J (enode (inj₁ y))
f (enode ())
lemma₀ : ∀ x → ⌊ J ⌋ ⊨ f (bnode (⊎-swap x)) ≈ ind J (enode x)
lemma₀ (inj₁ y) = ≈-refl ⌊ J ⌋
lemma₀ (inj₂ y) = ≈-refl ⌊ J ⌋
lemma₁ : ∀ x →
⌊ J ⌋ ⊨ ind J (right (down x)) ≈ on-bnode {Σ} f (ind J) (left (up x))
lemma₁ (inode x) = ≈-sym ⌊ J ⌋
(wires-≈ ⊎-swap (proj₂ (fin (A₂ ⊗ A₁)) (inj₂ x))
(compose-left (symm A₁ A₂) (F₂ ⟨⊗⟩ F₁) J J⊨RHS))
lemma₁ (bnode v) = ≈-refl ⌊ J ⌋
lemma₁ (enode y) = ≈-refl ⌊ J ⌋
lemma₂ : ∀ x →
⌊ J ⌋ ⊨ ind J (right (up x)) ≈ on-bnode {Σ} f (ind J) (left (down x))
lemma₂ (inode x) = ≈-sym ⌊ J ⌋
(wires-≈ ⊎-swap (proj₂ (fin (A₂ ⊗ A₁)) (inj₁ x))
(compose-left (symm A₁ A₂) (F₂ ⟨⊗⟩ F₁) J J⊨RHS))
lemma₂ (bnode v) = ≈-refl ⌊ J ⌋
lemma₂ (enode y) = ≈-refl ⌊ J ⌋
J⊨LHS : bnodes J f ⊨a impl ((F₁ ⟨⊗⟩ F₂) ∙ symm B₁ B₂)
J⊨LHS = compose-resp-⊨a (F₁ ⟨⊗⟩ F₂) (symm B₁ B₂) (bnodes J f)
(tensor-resp-⊨a F₁ F₂ (left * bnodes J f)
(⊨a-resp-≲ (≲-refl ⌊ J ⌋ , lemma₁) (impl F₁)
(tensor-down F₂ F₁ (right * J)
(compose-right (symm A₁ A₂) (F₂ ⟨⊗⟩ F₁) J J⊨RHS)))
(⊨a-resp-≲ (≲-refl ⌊ J ⌋ , lemma₂) (impl F₂)
(tensor-up F₂ F₁ (right * J)
(compose-right (symm A₁ A₂) (F₂ ⟨⊗⟩ F₁) J J⊨RHS))))
(wires-≈⁻¹ ⊎-swap lemma₀ (proj₁ (fin (B₂ ⊗ B₁))))
| 44.46087
| 76
| 0.548406
|
1993c5dab5ff9c3a79fda2529ef442e0c04b4df4
| 4,849
|
agda
|
Agda
|
src/ctxt-types.agda
|
CarlOlson/cedille
|
f5ce42258b7d9bc66f75cd679c785d6133b82b58
|
[
"MIT"
] | null | null | null |
src/ctxt-types.agda
|
CarlOlson/cedille
|
f5ce42258b7d9bc66f75cd679c785d6133b82b58
|
[
"MIT"
] | null | null | null |
src/ctxt-types.agda
|
CarlOlson/cedille
|
f5ce42258b7d9bc66f75cd679c785d6133b82b58
|
[
"MIT"
] | null | null | null |
module ctxt-types where
open import lib
open import cedille-types
open import general-util
open import syntax-util
location : Set
location = string × posinfo -- file path and starting position in the file
-- file path and starting / ending position in file
span-location = string × posinfo × posinfo
-- missing locations
missing-location : location
missing-location = ("missing" , "missing")
missing-span-location : span-location
missing-span-location = ("missing" , "missing" , "missing")
{- we will generally keep classifiers of variables in hnf in the ctxt, although
we will not necessarily unfold recursive type definitions. -}
defScope : Set
defScope = 𝔹
pattern localScope = tt
pattern globalScope = ff
pattern concrete-datatype = globalScope
pattern abstract-datatype = localScope
defParams : Set
defParams = maybe params
data ctxt-info : Set where
-- for defining a datatype
-- datatype-def : defParams → (ind reg : kind) → ctrs → ctxt-info
-- for defining a datatype constructor
ctr-def : params → type → (ctrs-length ctr-index ctr-unerased-arrows : ℕ) → ctxt-info
-- for declaring the type that proves a type is a datatype (X/Mu)
-- mu-def : defParams → var → kind → ctxt-info
-- for declaring a variable to have a given type (with no definition)
term-decl : type → ctxt-info
-- for defining a variable to equal a term with a given type
-- maybe term, because datatype X/Mu and X/mu have params, etc... but no def
term-def : defParams → opacity → maybe term → type → ctxt-info
-- for untyped term definitions
term-udef : defParams → opacity → term → ctxt-info
-- for declaring a variable to have a given kind (with no definition)
type-decl : kind → ctxt-info
-- for defining a variable to equal a type with a given kind
type-def : defParams → opacity → maybe type → kind → ctxt-info
-- for defining a variable to equal a kind
kind-def : params → kind → ctxt-info
-- to rename a variable at any level to another
rename-def : var → ctxt-info
-- representing a declaration of a variable with no other information about it
var-decl : ctxt-info
sym-info : Set
sym-info = ctxt-info × location
-- module filename, name, parameters, and qualifying substitution
mod-info : Set
mod-info = string × string × params × qualif
is-term-level : ctxt-info → 𝔹
is-term-level (term-decl _) = tt
is-term-level (term-def _ _ _ _) = tt
is-term-level (term-udef _ _ _) = tt
is-term-level (ctr-def _ _ _ _ _ ) = tt
is-term-level _ = ff
data ctxt : Set where
mk-ctxt : (mod : mod-info) → -- current module
(syms : trie (string × 𝕃 string) × trie string × trie params × trie ℕ × Σ ℕ (𝕍 string)) → -- map each filename to its module name and the symbols declared in that file, map each module name to its filename and params, and file ID's for use in to-string.agda
(i : trie sym-info) → -- map symbols (from Cedille files) to their ctxt-info and location
(sym-occurrences : trie (𝕃 (var × posinfo × string))) → -- map symbols to a list of definitions they occur in (and relevant file info)
(Δ : trie (params × kind × kind × ctrs) × trie (var × var × args) × trie var) → -- datatype info: (concrete/global datatypes × abstract/local datatypes × datatype/Mu map)
ctxt
ctxt-binds-var : ctxt → var → 𝔹
ctxt-binds-var (mk-ctxt (_ , _ , _ , q) _ i _ _) x = trie-contains q x || trie-contains i x
ctxt-var-decl : var → ctxt → ctxt
ctxt-var-decl v (mk-ctxt (fn , mn , ps , q) syms i symb-occs Δ) =
mk-ctxt (fn , mn , ps , (trie-insert q v (v , []))) syms (trie-insert i v (var-decl , "missing" , "missing")) symb-occs Δ
ctxt-var-decl-loc : posinfo → var → ctxt → ctxt
ctxt-var-decl-loc pi v (mk-ctxt (fn , mn , ps , q) syms i symb-occs Δ) =
mk-ctxt (fn , mn , ps , (trie-insert q v (v , []))) syms (trie-insert i v (var-decl , fn , pi)) symb-occs Δ
qualif-var : ctxt → var → var
qualif-var (mk-ctxt (_ , _ , _ , q) _ _ _ _) v with trie-lookup q v
...| just (v' , _) = v'
...| nothing = v
start-modname : start → string
start-modname (File _ _ _ mn _ _ _) = mn
ctxt-get-current-filename : ctxt → string
ctxt-get-current-filename (mk-ctxt (fn , _) _ _ _ _) = fn
ctxt-get-current-mod : ctxt → mod-info
ctxt-get-current-mod (mk-ctxt m _ _ _ _) = m
ctxt-get-current-modname : ctxt → string
ctxt-get-current-modname (mk-ctxt (_ , mn , _ , _) _ _ _ _) = mn
ctxt-get-current-params : ctxt → params
ctxt-get-current-params (mk-ctxt (_ , _ , ps , _) _ _ _ _) = ps
ctxt-get-symbol-occurrences : ctxt → trie (𝕃 (var × posinfo × string))
ctxt-get-symbol-occurrences (mk-ctxt _ _ _ symb-occs _) = symb-occs
ctxt-set-symbol-occurrences : ctxt → trie (𝕃 (var × posinfo × string)) → ctxt
ctxt-set-symbol-occurrences (mk-ctxt fn syms i symb-occs Δ) new-symb-occs = mk-ctxt fn syms i new-symb-occs Δ
| 37.589147
| 272
| 0.67086
|
fd7ee97284ac039f15340129af2eb0c02061b4de
| 1,886
|
agda
|
Agda
|
Definition/Typed/Consequences/Reduction.agda
|
loic-p/logrel-mltt
|
2251b8da423be0c6fb916f2675d7bd8537e4cd96
|
[
"MIT"
] | null | null | null |
Definition/Typed/Consequences/Reduction.agda
|
loic-p/logrel-mltt
|
2251b8da423be0c6fb916f2675d7bd8537e4cd96
|
[
"MIT"
] | null | null | null |
Definition/Typed/Consequences/Reduction.agda
|
loic-p/logrel-mltt
|
2251b8da423be0c6fb916f2675d7bd8537e4cd96
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K --safe #-}
module Definition.Typed.Consequences.Reduction where
open import Definition.Untyped
open import Definition.Typed
open import Definition.Typed.Properties
open import Definition.Typed.EqRelInstance
open import Definition.LogicalRelation
open import Definition.LogicalRelation.Properties
open import Definition.LogicalRelation.Fundamental.Reducibility
open import Tools.Embedding
open import Tools.Product
-- Helper function where all reducible types can be reduced to WHNF.
whNorm′ : ∀ {A Γ l} ([A] : Γ ⊩⟨ l ⟩ A)
→ ∃ λ B → Whnf B × Γ ⊢ A :⇒*: B
whNorm′ (Uᵣ′ .⁰ 0<1 ⊢Γ) = U , Uₙ , idRed:*: (Uⱼ ⊢Γ)
whNorm′ (ℕᵣ D) = ℕ , ℕₙ , D
whNorm′ (ne′ K D neK K≡K) = K , ne neK , D
whNorm′ (Πᵣ′ F G D ⊢F ⊢G A≡A [F] [G] G-ext) = Π F ▹ G , Πₙ , D
whNorm′ (emb′ 0<1 [A]) = whNorm′ [A]
-- Well-formed types can all be reduced to WHNF.
whNorm : ∀ {A Γ} → Γ ⊢ A → ∃ λ B → Whnf B × Γ ⊢ A :⇒*: B
whNorm A = whNorm′ (reducible A)
-- Helper function where reducible all terms can be reduced to WHNF.
whNormTerm′ : ∀ {a A Γ l} ([A] : Γ ⊩⟨ l ⟩ A) → Γ ⊩⟨ l ⟩ a ∷ A / [A]
→ ∃ λ b → Whnf b × Γ ⊢ a :⇒*: b ∷ A
whNormTerm′ (Uᵣ′ a b c) (Uₜ A d typeA A≡A [t]) = A , typeWhnf typeA , d
whNormTerm′ (ℕᵣ x) (ιx (ℕₜ n d n≡n prop)) =
let natN = natural prop
in n , naturalWhnf natN , convRed:*: d (sym (subset* (red x)))
whNormTerm′ (ne′ K D neK K≡K) (ιx (neₜ k d (neNfₜ neK₁ ⊢k k≡k))) =
k , ne neK₁ , convRed:*: d (sym (subset* (red D)))
whNormTerm′ (Πᵣ′ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Πₜ f d funcF f≡f [f] [f]₁) =
f , functionWhnf funcF , convRed:*: d (sym (subset* (red D)))
whNormTerm′ (emb′ 0<1 [A]) (ιx [a]) = whNormTerm′ [A] [a]
-- Well-formed terms can all be reduced to WHNF.
whNormTerm : ∀ {a A Γ} → Γ ⊢ a ∷ A → ∃ λ b → Whnf b × Γ ⊢ a :⇒*: b ∷ A
whNormTerm {a} {A} ⊢a =
let [A] , [a] = reducibleTerm ⊢a
in whNormTerm′ [A] [a]
| 39.291667
| 77
| 0.599682
|
11c2dcc76a211ba1df61a16756f31267f9b7e86c
| 459
|
agda
|
Agda
|
test/Fail/ExactSplitParity.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/ExactSplitParity.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/ExactSplitParity.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
{-# OPTIONS --exact-split -Werror #-}
module ExactSplitParity where
data Bool : Set where
true false : Bool
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
parity : ℕ → ℕ → Bool
parity zero zero = true
parity zero (suc zero) = false
parity zero (suc (suc n)) = parity zero n
parity (suc zero) zero = false
parity (suc (suc m)) zero = parity m zero
parity (suc m) (suc n) = parity m n
| 24.157895
| 50
| 0.553377
|
1b57b2289bf5504aeb7b3da9e6b7776f211b5bf9
| 1,280
|
agda
|
Agda
|
test/succeed/PruningNonMillerPattern.agda
|
asr/agda-kanso
|
aa10ae6a29dc79964fe9dec2de07b9df28b61ed5
|
[
"MIT"
] | null | null | null |
test/succeed/PruningNonMillerPattern.agda
|
asr/agda-kanso
|
aa10ae6a29dc79964fe9dec2de07b9df28b61ed5
|
[
"MIT"
] | null | null | null |
test/succeed/PruningNonMillerPattern.agda
|
asr/agda-kanso
|
aa10ae6a29dc79964fe9dec2de07b9df28b61ed5
|
[
"MIT"
] | null | null | null |
-- {-# OPTIONS -v tc.meta:100 #-}
-- Andreas, 2011-04-20
-- see Abel Pientka TLCA 2011
module PruningNonMillerPattern where
data _≡_ {A : Set}(a : A) : A -> Set where
refl : a ≡ a
data Nat : Set where
zero : Nat
suc : Nat -> Nat
test : let X : Nat -> Nat -> Nat
X = _
Y : Nat -> Nat -> Nat
Y = _
in (C : Set) ->
(({x y : Nat} -> X x x ≡ suc (Y x y)) ->
({x y : Nat} -> Y x x ≡ x) ->
({x y : Nat} -> X (Y x y) y ≡ X x x) -> C) -> C
test C k = k refl refl refl
{- none of these equations is immediately solvable. However,
from 1. we deduce that Y does not depend on its second argument, thus
from 2. we solve Y x y = x, and then
eqn. 3. simplifies to X x y = X x x, thus, X does not depend on its second arg,
we can then solve using 1. X x y = suc x
-}
-- a variant, where pruning is even triggered from a non-pattern
test' : let X : Nat -> Nat -> Nat
X = _
Y : Nat -> Nat -> Nat
Y = _
in (C : Set) ->
(({x y : Nat} -> X x (suc x) ≡ suc (Y x y)) -> -- non-pattern lhs
({x y : Nat} -> Y x x ≡ x) ->
({x y : Nat} -> X (Y x y) y ≡ X x x) -> C) -> C
test' C k = k refl refl refl
| 32.820513
| 82
| 0.473438
|
ad604965295406f9762b27ded9700990ec52f9fb
| 4,426
|
agda
|
Agda
|
theorems/cohomology/ProductRepr.agda
|
cmknapp/HoTT-Agda
|
bc849346a17b33e2679a5b3f2b8efbe7835dc4b6
|
[
"MIT"
] | 1
|
2021-06-30T00:17:55.000Z
|
2021-06-30T00:17:55.000Z
|
theorems/cohomology/ProductRepr.agda
|
cmknapp/HoTT-Agda
|
bc849346a17b33e2679a5b3f2b8efbe7835dc4b6
|
[
"MIT"
] | null | null | null |
theorems/cohomology/ProductRepr.agda
|
cmknapp/HoTT-Agda
|
bc849346a17b33e2679a5b3f2b8efbe7835dc4b6
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K #-}
open import HoTT
open import cohomology.Exactness
open import cohomology.FunctionOver
module cohomology.ProductRepr where
{- Given the following commutative diagram of homomorphisms,
H₁ i₁ i₂ H₂
↘ ↙
id ↓ G ↓ id
↙ ↘
H₁ j₁ j₂ H₂
- assuming i₁,j₂ and i₂,j₁ are exact sequences,
- there exists an isomorphism G == H₁ × H₂ such that i₁,i₂ correspond
- to the natural injections and j₁,j₂ correspond to the natural
- projections. -}
module ProductRepr {i j}
{G : Group (lmax i j)} {H₁ : Group i} {H₂ : Group j}
(i₁ : H₁ →ᴳ G) (i₂ : H₂ →ᴳ G) (j₁ : G →ᴳ H₁) (j₂ : G →ᴳ H₂)
(p₁ : ∀ h₁ → GroupHom.f j₁ (GroupHom.f i₁ h₁) == h₁)
(p₂ : ∀ h₂ → GroupHom.f j₂ (GroupHom.f i₂ h₂) == h₂)
(ex₁ : is-exact i₁ j₂) (ex₂ : is-exact i₂ j₁)
where
zero-ker : (g : Group.El G)
→ GroupHom.f (×ᴳ-hom-in j₁ j₂) g == Group.ident (H₁ ×ᴳ H₂)
→ g == Group.ident G
zero-ker g q = Trunc-rec (Group.El-level G _ _)
(lemma g (fst×= q))
(ktoi ex₁ g (snd×= q))
where
lemma : (g : Group.El G) (r : GroupHom.f j₁ g == Group.ident H₁)
→ Σ (Group.El H₁) (λ h → GroupHom.f i₁ h == g)
→ g == Group.ident G
lemma ._ r (h , idp) =
ap (GroupHom.f i₁) (! (p₁ h) ∙ r) ∙ GroupHom.pres-ident i₁
β₁ : (h₁ : Group.El H₁) (h₂ : Group.El H₂)
→ GroupHom.f j₁ (Group.comp G (GroupHom.f i₁ h₁) (GroupHom.f i₂ h₂)) == h₁
β₁ h₁ h₂ =
GroupHom.pres-comp j₁ (GroupHom.f i₁ h₁) (GroupHom.f i₂ h₂)
∙ ap2 (Group.comp H₁) (p₁ h₁) (itok ex₂ _ [ h₂ , idp ])
∙ Group.unitr H₁ h₁
β₂ : (h₁ : Group.El H₁) (h₂ : Group.El H₂)
→ GroupHom.f j₂ (Group.comp G (GroupHom.f i₁ h₁) (GroupHom.f i₂ h₂)) == h₂
β₂ h₁ h₂ =
GroupHom.pres-comp j₂ (GroupHom.f i₁ h₁) (GroupHom.f i₂ h₂)
∙ ap2 (Group.comp H₂) (itok ex₁ _ [ h₁ , idp ]) (p₂ h₂)
∙ Group.unitl H₂ h₂
iso : G ≃ᴳ (H₁ ×ᴳ H₂)
iso = surj-inj-iso (×ᴳ-hom-in j₁ j₂)
(zero-kernel-injective (×ᴳ-hom-in j₁ j₂) zero-ker)
(λ {(h₁ , h₂) → [ Group.comp G (GroupHom.f i₁ h₁) (GroupHom.f i₂ h₂) ,
pair×= (β₁ h₁ h₂) (β₂ h₁ h₂) ]})
path : G == H₁ ×ᴳ H₂
path = group-ua iso
fst-over : j₁ == ×ᴳ-fst [ (λ U → U →ᴳ H₁) ↓ path ]
fst-over = domain-over-iso $ domain-over-equiv fst _
snd-over : j₂ == ×ᴳ-snd {G = H₁} [ (λ U → U →ᴳ H₂) ↓ path ]
snd-over = domain-over-iso $ domain-over-equiv snd _
inl-over : i₁ == ×ᴳ-inl [ (λ V → H₁ →ᴳ V) ↓ path ]
inl-over = codomain-over-iso $
codomain-over-equiv (GroupHom.f i₁) _
▹ λ= (λ h₁ → pair×= (p₁ h₁) (itok ex₁ _ [ h₁ , idp ]))
inr-over : i₂ == ×ᴳ-inr {G = H₁} [ (λ V → H₂ →ᴳ V) ↓ path ]
inr-over = codomain-over-iso $
codomain-over-equiv (GroupHom.f i₂) _
▹ λ= (λ h₂ → pair×= (itok ex₂ _ [ h₂ , idp ]) (p₂ h₂))
{- Given additionally maps
i₀ j₀
K –––→ G ––→ L
- such that j₀∘i₀ = 0, we have j₀(i₁(j₁(i₀ k)))⁻¹ = j₀(i₂(j₂(i₀ k))).
- (This is called the hexagon lemma in Eilenberg & Steenrod's book.
- The hexagon is not visible in this presentation.)
-}
module HexagonLemma {k l}
{K : Group k} {L : Group l}
(i₀ : K →ᴳ G) (j₀ : G →ᴳ L)
(ex₀ : ∀ g → GroupHom.f j₀ (GroupHom.f i₀ g) == Group.ident L)
where
decomp : ∀ g → Group.comp G (GroupHom.f i₁ (GroupHom.f j₁ g))
(GroupHom.f i₂ (GroupHom.f j₂ g))
== g
decomp = transport
(λ {(G' , i₁' , i₂' , j₁' , j₂') → ∀ g →
Group.comp G' (GroupHom.f i₁' (GroupHom.f j₁' g))
(GroupHom.f i₂' (GroupHom.f j₂' g))
== g})
(! (pair= path (↓-×-in inl-over (↓-×-in inr-over
(↓-×-in fst-over snd-over)))))
(λ {(h₁ , h₂) → pair×= (Group.unitr H₁ h₁) (Group.unitl H₂ h₂)})
cancel : ∀ k →
Group.comp L (GroupHom.f (j₀ ∘ᴳ i₁ ∘ᴳ j₁ ∘ᴳ i₀) k)
(GroupHom.f (j₀ ∘ᴳ i₂ ∘ᴳ j₂ ∘ᴳ i₀) k)
== Group.ident L
cancel k = ! (GroupHom.pres-comp j₀ _ _)
∙ ap (GroupHom.f j₀) (decomp (GroupHom.f i₀ k))
∙ ex₀ k
inv₁ : ∀ k → Group.inv L (GroupHom.f (j₀ ∘ᴳ i₁ ∘ᴳ j₁ ∘ᴳ i₀) k)
== GroupHom.f (j₀ ∘ᴳ i₂ ∘ᴳ j₂ ∘ᴳ i₀) k
inv₁ k = group-inv-unique-r L _ _ (cancel k)
inv₂ : ∀ k → Group.inv L (GroupHom.f (j₀ ∘ᴳ i₂ ∘ᴳ j₂ ∘ᴳ i₀) k)
== GroupHom.f (j₀ ∘ᴳ i₁ ∘ᴳ j₁ ∘ᴳ i₀) k
inv₂ k = group-inv-unique-l L _ _ (cancel k)
| 35.126984
| 78
| 0.528468
|
4e6418adb454b55ce849243a3c635fb0d2af934d
| 4,717
|
agda
|
Agda
|
Data/BinaryTree.agda
|
Lolirofle/stuff-in-agda
|
70f4fba849f2fd779c5aaa5af122ccb6a5b271ba
|
[
"MIT"
] | 6
|
2020-04-07T17:58:13.000Z
|
2022-02-05T06:53:22.000Z
|
Data/BinaryTree.agda
|
Lolirofle/stuff-in-agda
|
70f4fba849f2fd779c5aaa5af122ccb6a5b271ba
|
[
"MIT"
] | null | null | null |
Data/BinaryTree.agda
|
Lolirofle/stuff-in-agda
|
70f4fba849f2fd779c5aaa5af122ccb6a5b271ba
|
[
"MIT"
] | null | null | null |
module Data.BinaryTree where
import Lvl
open import Type
private variable ℓ ℓᵢ ℓₗ ℓₙ ℓₒ : Lvl.Level
private variable N N₁ N₂ L T A B : Type{ℓ}
data BinaryTree (L : Type{ℓₗ}) (N : Type{ℓₙ}) : Type{ℓₗ Lvl.⊔ ℓₙ} where
Leaf : L → BinaryTree L N
Node : N → BinaryTree L N → BinaryTree L N → BinaryTree L N
elim : (P : BinaryTree L N → Type{ℓ}) → ((l : L) → P(Leaf l)) → (∀{tl tr} → (n : N) → (pl : P(tl)) → (pr : P(tr)) → P(Node n tl tr)) → ((t : BinaryTree L N) → P(t))
elim P pl pn (Leaf l) = pl l
elim P pl pn (Node n l r) = pn n (elim P pl pn l) (elim P pl pn r)
open import Data using (Unit ; <>)
open import Data.Boolean
open import Data.Option
open import Data.Tuple using (_⨯_ ; _,_)
open import Functional as Fn using (_$_)
open import Numeral.Natural
open import Numeral.Natural.Function
open import Numeral.Natural.Oper hiding (_^_)
emptyTree : BinaryTree{ℓₗ} Unit N
emptyTree = Leaf <>
singleton : N → BinaryTree{ℓₗ} Unit N
singleton a = Node a emptyTree emptyTree
isLeaf : BinaryTree L N → Bool
isLeaf (Leaf _) = 𝑇
isLeaf (Node _ _ _) = 𝐹
isNode : BinaryTree L N → Bool
isNode (Leaf _) = 𝐹
isNode (Node _ _ _) = 𝑇
root : BinaryTree L N → Option(N)
root (Leaf _) = None
root (Node a _ _) = Some a
flip : BinaryTree L N → BinaryTree L N
flip (Leaf l) = Leaf l
flip (Node n l r) = Node n (flip r) (flip l)
foldPreOrderDepthFirst : (L → T → T) → (N → T → T) → T → BinaryTree L N → T
foldPreOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Leaf a) = a ▫ₗ id
foldPreOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Node a l r) =
a ▫ₙ_ $
Fn.swap(foldPreOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) l $
Fn.swap(foldPreOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) r $
id
foldInOrderDepthFirst : (L → T → T) → (N → T → T) → T → BinaryTree L N → T
foldInOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Leaf a) = a ▫ₗ id
foldInOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Node a l r) =
Fn.swap(foldInOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) l $
a ▫ₙ_ $
Fn.swap(foldInOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) r $
id
foldPostOrderDepthFirst : (L → T → T) → (N → T → T) → T → BinaryTree L N → T
foldPostOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Leaf a) = a ▫ₗ id
foldPostOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Node a l r) =
Fn.swap(foldPostOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) l $
Fn.swap(foldPostOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) r $
a ▫ₙ_ $
id
foldReversedPreOrderDepthFirst : (L → T → T) → (N → T → T) → T → BinaryTree L N → T
foldReversedPreOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Leaf a) = a ▫ₗ id
foldReversedPreOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Node a l r) =
a ▫ₙ_ $
Fn.swap(foldReversedPreOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) r $
Fn.swap(foldReversedPreOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) l $
id
foldReversedInOrderDepthFirst : (L → T → T) → (N → T → T) → T → BinaryTree L N → T
foldReversedInOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Leaf a) = a ▫ₗ id
foldReversedInOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Node a l r) =
Fn.swap(foldReversedInOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) r $
a ▫ₙ_ $
Fn.swap(foldReversedInOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) l $
id
foldReversedPostOrderDepthFirst : (L → T → T) → (N → T → T) → T → BinaryTree L N → T
foldReversedPostOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Leaf a) = a ▫ₗ id
foldReversedPostOrderDepthFirst(_▫ₗ_)(_▫ₙ_) id (Node a l r) =
Fn.swap(foldReversedPostOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) r $
Fn.swap(foldReversedPostOrderDepthFirst(_▫ₗ_)(_▫ₙ_)) l $
a ▫ₙ_ $
id
-- The size is the number of nodes in the tree.
size : BinaryTree L N → ℕ
size (Leaf _) = 𝟎
size (Node _ l r) = 𝐒(size(l) + size(r))
-- The number of leaves in the tree.
numberOfLeaves : BinaryTree L N → ℕ
numberOfLeaves (Leaf _) = 1
numberOfLeaves (Node _ l r) = numberOfLeaves(l) + numberOfLeaves(r)
-- The height is the length of the longest path from the root.
height : BinaryTree L N → ℕ
height (Leaf _) = 𝟎
height (Node _ l r) = 𝐒(max (height l) (height r))
open import Data.Boolean.Operators
open Data.Boolean.Operators.Programming
isFull : BinaryTree L N → Bool
isFull (Leaf _) = 𝑇
isFull (Node _ (Leaf _) (Leaf _)) = 𝑇
isFull (Node _ (Node _ _ _) (Leaf _)) = 𝐹
isFull (Node _ (Leaf _) (Node _ _ _)) = 𝐹
isFull (Node _ l@(Node _ _ _) r@(Node _ _ _)) = isFull l && isFull r
open import Data.List
import Data.List.Functions as List
treesOfDepth : ℕ → BinaryTree L N → List(BinaryTree L N)
treesOfDepth 𝟎 tree = tree ⊰ ∅
treesOfDepth (𝐒(_)) (Leaf _) = ∅
treesOfDepth (𝐒(n)) (Node _ l r) = (treesOfDepth n l) List.++ (treesOfDepth n r)
| 36.851563
| 164
| 0.604834
|
3647eab7dde91524eb741868eda16d2afadef950
| 769
|
agda
|
Agda
|
test/Compiler/simple/VecReverse.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 2
|
2019-10-29T09:40:30.000Z
|
2020-09-20T00:28:57.000Z
|
test/Compiler/simple/VecReverse.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 3
|
2018-11-14T15:31:44.000Z
|
2019-04-01T19:39:26.000Z
|
test/Compiler/simple/VecReverse.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1
|
2015-09-15T14:36:15.000Z
|
2015-09-15T14:36:15.000Z
|
module _ where
open import Common.Prelude
open import Lib.Vec
_∘_ : ∀ {a b c} {A : Set a} {B : A → Set b} {C : ∀ x → B x → Set c}
(f : ∀ {x} (y : B x) → C x y)
(g : ∀ x → B x)
→ ∀ x → C x (g x)
(f ∘ g) x = f (g x)
sum : ∀ {n} → Vec Nat n → Nat
sum (x ∷ xs) = x + sum xs
sum [] = 0
foldl : ∀ {A} (B : Nat → Set)
→ (∀ {n} → B n → A → B (suc n))
→ B 0
→ ∀ {n} → Vec A n → B n
foldl B f z (x ∷ xs) = foldl (λ n → B (suc n)) f (f z x) xs
foldl B f z [] = z
reverse : ∀ {A n} → Vec A n → Vec A n
reverse = foldl (Vec _) (λ xs x → x ∷ xs) []
downFrom : ∀ n → Vec Nat n
downFrom zero = []
downFrom (suc n) = n ∷ downFrom n
main : IO Unit
main = printNat (sum (reverse (downFrom 600))) -- 10000 gives a stack overflow on JS
| 23.30303
| 85
| 0.469441
|
3527ed5c4b7ff032d5a92936ca2b8f59060c4f24
| 1,017
|
agda
|
Agda
|
test/Fail/Issue1228b.agda
|
vlopezj/agda
|
ff4d89e75970cf27599fb9f572bd43c9455cbb56
|
[
"BSD-3-Clause"
] | 3
|
2015-03-28T14:51:03.000Z
|
2015-12-07T20:14:00.000Z
|
test/Fail/Issue1228b.agda
|
vikfret/agda
|
49ad0b3f0d39c01bc35123478b857e702b29fb9d
|
[
"BSD-3-Clause"
] | 3
|
2018-11-14T15:31:44.000Z
|
2019-04-01T19:39:26.000Z
|
test/Fail/Issue1228b.agda
|
vikfret/agda
|
49ad0b3f0d39c01bc35123478b857e702b29fb9d
|
[
"BSD-3-Clause"
] | 1
|
2015-09-15T14:36:15.000Z
|
2015-09-15T14:36:15.000Z
|
open import Common.Prelude hiding (tt)
open import Common.Reflection
open import Common.Equality
tt : ⊤
tt = record{}
NoConf : Nat → Nat → Set
NoConf zero zero = ⊤
NoConf zero (suc n) = ⊥
NoConf (suc m) zero = ⊥
NoConf (suc m) (suc n) = m ≡ n
pattern `Nat = def (quote Nat) []
infixr 0 Π
syntax Π x a b = [ x ∈ a ]→ b
Π : String → Type → Type → Type
Π x a b = pi (vArg a) (abs x b)
-- noConf : (m n : ℕ) → m ≡ n → NoConfusion-ℕ m n
-- noConf zero .zero refl = tt
-- noConf (suc m) .(suc m) refl = refl
noConf : FunDef
noConf = funDef
([ "A" ∈ `Nat ]→ [ "B" ∈ `Nat ]→
[ "C" ∈ def (quote _≡_) (vArg (var 1 []) ∷ vArg (var 0 []) ∷ []) ]→
def (quote NoConf) (vArg (var 2 []) ∷ vArg (var 1 []) ∷ []))
( clause (vArg (con (quote zero) []) ∷ vArg dot ∷ vArg (con (quote refl) []) ∷ [])
(def (quote tt) [])
∷ clause (vArg (con (quote suc) (vArg (var "m") ∷ [])) ∷ vArg dot ∷ vArg (con (quote refl) []) ∷ [])
(def (quote refl) [])
∷ [])
unquoteDecl test = define (vArg test) noConf
| 26.763158
| 102
| 0.54179
|
4e35fd84d204159bae2f6cc8b924311e27314951
| 1,199
|
agda
|
Agda
|
data/test-files/ListMember.agda
|
carlostome/martin
|
baf979ef78b5ec0f4783240b03f9547490bc5d42
|
[
"BSD-3-Clause"
] | null | null | null |
data/test-files/ListMember.agda
|
carlostome/martin
|
baf979ef78b5ec0f4783240b03f9547490bc5d42
|
[
"BSD-3-Clause"
] | null | null | null |
data/test-files/ListMember.agda
|
carlostome/martin
|
baf979ef78b5ec0f4783240b03f9547490bc5d42
|
[
"BSD-3-Clause"
] | null | null | null |
module ListMember where
open import Prelude
data Member {A : Set} (x : A) : List A -> Set where
here : {xs : List A} -> Member x (cons x xs)
there : forall {y} -> {xs : List A} -> Member x xs -> Member x (cons y xs)
empty-no-member' : forall {A} -> {x : A} -> Member x nil -> Empty
empty-no-member' p = {!!}
empty-no-member : forall {A} -> {x : A} -> Not (Member x nil)
empty-no-member = is-absurd empty-no-member'
neither-here-nor-there' : forall {A} -> {x y : A} {ys : List A} -> (x == y -> Empty) -> (Member x ys -> Empty) -> Member x (cons y ys) -> Empty
neither-here-nor-there' not-here not-there member = {!!}
neither-here-nor-there : forall {A} -> {x y : A} {ys : List A} -> Not (x == y) -> Not (Member x ys) -> Not (Member x (cons y ys))
neither-here-nor-there (is-absurd not-here) (is-absurd not-there) = is-absurd (neither-here-nor-there' not-here not-there)
member : forall {A} -> ((x y : A) -> Dec (x == y)) -> (v : A) -> (vs : List A) -> Dec (Member v vs)
member eq? x nil = no empty-no-member
member eq? x (cons y ys) with eq? x y
member eq? x (cons y ys) | yes p = {!!}
member eq? x (cons y ys) | no pf with member eq? x ys
member eq? x (cons y ys) | no pf | member = {!!}
| 44.407407
| 143
| 0.588824
|
11c0aa3d64072c7182cbefb0ca02b0ffd825a2b5
| 14,127
|
agda
|
Agda
|
complexity/complexity-final/submit/Complexity.agda
|
benhuds/Agda
|
2404a6ef2688f879bda89860bb22f77664ad813e
|
[
"MIT"
] | 2
|
2016-04-26T20:22:22.000Z
|
2019-08-08T12:27:18.000Z
|
complexity/complexity-final/submit/Complexity.agda
|
benhuds/Agda
|
2404a6ef2688f879bda89860bb22f77664ad813e
|
[
"MIT"
] | 1
|
2020-03-23T08:39:04.000Z
|
2020-05-12T00:32:45.000Z
|
complexity/complexity-final/submit/Complexity.agda
|
benhuds/Agda
|
2404a6ef2688f879bda89860bb22f77664ad813e
|
[
"MIT"
] | null | null | null |
open import Preliminaries
module Complexity where
data CTp : Set where
unit : CTp
nat : CTp -- discrete natural numbers ♭nat, where we interpret ≤ as =
_->c_ : CTp → CTp → CTp
_×c_ : CTp → CTp → CTp
list : CTp → CTp
bool : CTp
C : CTp
rnat : CTp
data CTpM : CTp → Set where
runit : CTpM unit
rnat-max : CTpM rnat
_×cm_ : ∀ {τ1 τ2} → CTpM τ1 → CTpM τ2 → CTpM (τ1 ×c τ2)
_->cm_ : ∀ {τ1 τ2} → CTpM τ2 → CTpM (τ1 ->c τ2)
-- represent a context as a list of types
Ctx = List CTp
-- de Bruijn indices (for free variables)
data _∈_ : CTp → Ctx → Set where
i0 : ∀ {Γ τ}
→ τ ∈ (τ :: Γ)
iS : ∀ {Γ τ τ1}
→ τ ∈ Γ
→ τ ∈ (τ1 :: Γ)
rctx : Ctx → Ctx → Set
rctx Γ Γ' = ∀ {τ} → τ ∈ Γ' → τ ∈ Γ
r-extend : ∀ {Γ Γ' τ} → rctx Γ Γ' → rctx (τ :: Γ) (τ :: Γ')
data _|-_ : Ctx → CTp → Set
sctx : Ctx → Ctx → Set
sctx Γ Γ' = ∀ {τ} → τ ∈ Γ' → Γ |- τ
_∙rr_ : ∀ {A B C} → rctx A B → rctx B C → rctx A C
_rs_ : ∀ {A B C} → rctx A B → sctx B C → sctx A C
ren : ∀ {Γ Γ' τ} → Γ' |- τ → rctx Γ Γ' → Γ |- τ
subst : ∀ {Γ Γ' τ} → Γ' |- τ → sctx Γ Γ' → Γ |- τ
_ss_ : ∀ {A B C} → sctx A B → sctx B C → sctx A C
_sr_ : ∀ {A B C} → sctx A B → rctx B C → sctx A C
data _≤s_ : ∀ {Γ T} → Γ |- T → Γ |- T → Set
rename-var : ∀ {Γ Γ' τ} → rctx Γ Γ' → τ ∈ Γ' → τ ∈ Γ
idr : ∀ {Γ} → rctx Γ Γ
p∙ : ∀ {Γ Γ' τ} → rctx Γ Γ' → rctx (τ :: Γ) Γ'
p : ∀ {Γ τ} → rctx (τ :: Γ) Γ
rename-var-ident : ∀ {Γ τ} → (x : τ ∈ Γ) → rename-var idr x == x
rename-var-∙ : ∀ {A B C τ} → (r1 : rctx A B) (r2 : rctx B C) (x : τ ∈ C) → rename-var r1 (rename-var r2 x) == rename-var (r1 ∙rr r2) x
∙rr-assoc : ∀ {A B C D} → (r1 : rctx A B) (r2 : rctx B C) (r3 : rctx C D) → _==_ {_} {rctx A D} (r1 ∙rr (r2 ∙rr r3)) ((r1 ∙rr r2) ∙rr r3)
extend-ren-comp-lemma : ∀ {Γ Γ' Γ'' τ τ'} → (x : τ ∈ τ' :: Γ'') (ρ1 : rctx Γ Γ') (ρ2 : rctx Γ' Γ'') → Id {_} {_} ((r-extend ρ1 ∙rr r-extend ρ2) x) (r-extend (ρ1 ∙rr ρ2) x)
extend-ren-comp : ∀ {Γ Γ' Γ'' τ} → (ρ1 : rctx Γ Γ') → (ρ2 : rctx Γ' Γ'') → Id {_} {rctx (τ :: Γ) (τ :: Γ'')} (r-extend ρ1 ∙rr r-extend ρ2) (r-extend (ρ1 ∙rr ρ2))
wkn : ∀ {Γ τ1 τ2} → Γ |- τ2 → (τ1 :: Γ) |- τ2
s-extend : ∀ {Γ Γ' τ} → sctx Γ Γ' → sctx (τ :: Γ) (τ :: Γ')
ids : ∀ {Γ} → sctx Γ Γ
q∙ : ∀ {Γ Γ' τ} → sctx Γ Γ' → sctx (τ :: Γ) Γ'
lem3' : ∀ {Γ Γ' τ} → sctx Γ Γ' → Γ |- τ → sctx Γ (τ :: Γ')
q : ∀ {Γ τ} → Γ |- τ → sctx Γ (τ :: Γ)
svar : ∀ {Γ1 Γ2 τ} → sctx Γ1 Γ2 → τ ∈ Γ2 → Γ1 |- τ
lem4' : ∀ {Γ Γ' τ1 τ2} → sctx Γ Γ' → Γ |- τ1 → Γ |- τ2 → sctx Γ (τ1 :: (τ2 :: Γ'))
lem4 : ∀ {Γ τ1 τ2} → Γ |- τ1 → Γ |- τ2 → sctx Γ (τ1 :: (τ2 :: Γ))
lem5' : ∀ {Γ Γ' τ1 τ2 τ3} → sctx Γ Γ' → Γ |- τ1 → Γ |- τ2 → Γ |- τ3 → sctx Γ (τ1 :: (τ2 :: (τ3 :: Γ')))
lem5 : ∀ {Γ τ1 τ2 τ3} → Γ |- τ1 → Γ |- τ2 → Γ |- τ3 → sctx Γ (τ1 :: (τ2 :: (τ3 :: Γ)))
data _|-_ where
unit : ∀ {Γ} → Γ |- unit
0C : ∀ {Γ} → Γ |- C
1C : ∀ {Γ}→ Γ |- C
plusC : ∀ {Γ} → Γ |- C → Γ |- C → Γ |- C
var : ∀ {Γ τ} → τ ∈ Γ → Γ |- τ
z : ∀ {Γ} → Γ |- nat
s : ∀ {Γ} → (e : Γ |- nat) → Γ |- nat
rec : ∀ {Γ τ} → Γ |- nat → Γ |- τ → (nat :: (τ :: Γ)) |- τ → Γ |- τ
lam : ∀ {Γ τ ρ} → (ρ :: Γ) |- τ → Γ |- (ρ ->c τ)
app : ∀ {Γ τ1 τ2} → Γ |- (τ2 ->c τ1) → Γ |- τ2 → Γ |- τ1
prod : ∀ {Γ τ1 τ2} → Γ |- τ1 → Γ |- τ2 → Γ |- (τ1 ×c τ2)
l-proj : ∀ {Γ τ1 τ2} → Γ |- (τ1 ×c τ2) → Γ |- τ1
r-proj : ∀ {Γ τ1 τ2} → Γ |- (τ1 ×c τ2) → Γ |- τ2
nil : ∀ {Γ τ} → Γ |- list τ
_::c_ : ∀ {Γ τ} → Γ |- τ → Γ |- list τ → Γ |- list τ
listrec : ∀ {Γ τ τ'} → Γ |- list τ → Γ |- τ' → (τ :: (list τ :: (τ' :: Γ))) |- τ' → Γ |- τ'
true : ∀ {Γ} → Γ |- bool
false : ∀ {Γ} → Γ |- bool
max : ∀ {Γ τ} → CTpM τ → Γ |- τ → Γ |- τ → Γ |- τ
letc : ∀ {Γ ρ τ} → (ρ :: Γ) |- τ → Γ |- ρ → Γ |- τ
{-[ Θ ]s : Monotone [ Γ ] [ Γ' ]
[ ρ ]r : same
interpE ren e ρ k == interpE e (interpR ρ) k
interp commutes with renaming and substitution
equations that define ren and subst are true in the semantics-}
--also add axioms for max-l/r etc.
data _≤s_ where
refl-s : ∀ {Γ T} → {e : Γ |- T} → e ≤s e
trans-s : ∀ {Γ T} → {e e' e'' : Γ |- T} → e ≤s e' → e' ≤s e'' → e ≤s e''
cong-refl : ∀ {Γ τ} {e e' : Γ |- τ} → e == e' → e ≤s e'
lt : ∀ {Γ} → _≤s_ {Γ} 0C 1C
letc-app-l : ∀ {Γ ρ τ} {e : (ρ :: Γ) |- τ} {e' : Γ |- ρ} → letc e e' ≤s app (lam e) e'
letc-app-r : ∀ {Γ ρ τ} {e : (ρ :: Γ) |- τ} {e' : Γ |- ρ} → app (lam e) e' ≤s letc e e'
+-unit-l : ∀ {Γ} {e : Γ |- C} → (plusC 0C e) ≤s e
+-unit-l' : ∀ {Γ} {e : Γ |- C} → e ≤s (plusC 0C e)
+-unit-r : ∀ {Γ} {e : Γ |- C} → (plusC e 0C) ≤s e
+-unit-r' : ∀ {Γ} {e : Γ |- C} → e ≤s (plusC e 0C)
+-assoc : ∀ {Γ} {e1 e2 e3 : Γ |- C} → (plusC e1 (plusC e2 e3)) ≤s (plusC (plusC e1 e2) e3)
+-assoc' : ∀ {Γ} {e1 e2 e3 : Γ |- C} → (plusC (plusC e1 e2) e3) ≤s (plusC e1 (plusC e2 e3))
refl-+ : ∀ {Γ} {e0 e1 : Γ |- C} → (plusC e0 e1) ≤s (plusC e1 e0)
cong-+ : ∀ {Γ} {e0 e1 e0' e1' : Γ |- C} → e0 ≤s e0' → e1 ≤s e1' → (plusC e0 e1) ≤s (plusC e0' e1')
cong-suc : ∀ {Γ} {e e' : Γ |- nat} → e ≤s e' → (s e) ≤s (s e')
cong-prod : ∀ {Γ τ τ'} {e1 e1' : Γ |- τ} {e2 e2' : Γ |- τ'} → e1 ≤s e1' → e2 ≤s e2' → (prod e1 e2) ≤s (prod e1' e2')
cong-lproj : ∀ {Γ τ τ'} {e e' : Γ |- (τ ×c τ')} → e ≤s e' → (l-proj e) ≤s (l-proj e')
cong-rproj : ∀ {Γ τ τ'} {e e' : Γ |- (τ ×c τ')} → e ≤s e' → (r-proj e) ≤s (r-proj e')
cong-lam : ∀ {Γ ρ τ} {e e' : (ρ :: Γ) |- τ} → e ≤s e' → (lam e) ≤s (lam e')
cong-app : ∀ {Γ τ τ'} {e e' : Γ |- (τ ->c τ')} {e1 : Γ |- τ} → e ≤s e' → (app e e1) ≤s (app e' e1)
ren-cong : ∀ {Γ Γ' τ} {e1 e2 : Γ' |- τ} {ρ : rctx Γ Γ'} → e1 ≤s e2 → (ren e1 ρ) ≤s (ren e2 ρ)
subst-cong : ∀ {Γ Γ' τ} {e1 e2 : Γ' |- τ} {Θ : sctx Γ Γ'} → e1 ≤s e2 → (subst e1 Θ) ≤s (subst e2 Θ)
subst-cong2 : ∀ {Γ Γ' τ} {Θ Θ' : sctx Γ Γ'} {e : Γ' |- τ} → (∀ τ → (x : τ ∈ Γ') → Θ x ≤s Θ' x) → subst e Θ ≤s subst e Θ'
cong-rec : ∀ {Γ τ} {e e' : Γ |- nat} {e0 : Γ |- τ} {e1 : (nat :: (τ :: Γ)) |- τ}
→ e ≤s e' → rec e e0 e1 ≤s rec e' e0 e1
cong-listrec : ∀ {Γ τ τ'} {e e' : Γ |- list τ} {e0 : Γ |- τ'} {e1 : (τ :: (list τ :: (τ' :: Γ))) |- τ'}
→ e ≤s e' → listrec e e0 e1 ≤s listrec e' e0 e1
lam-s : ∀ {Γ T T'} → {e : (T :: Γ) |- T'} → {e2 : Γ |- T} → subst e (q e2) ≤s app (lam e) e2
l-proj-s : ∀ {Γ T1 T2} → {e1 : Γ |- T1} {e2 : Γ |- T2} → e1 ≤s (l-proj (prod e1 e2))
r-proj-s : ∀ {Γ T1 T2} → {e1 : Γ |- T1} → {e2 : Γ |- T2} → e2 ≤s (r-proj (prod e1 e2))
rec-steps-z : ∀ {Γ T} → {e0 : Γ |- T} → {e1 : (nat :: (T :: Γ)) |- T} → e0 ≤s (rec z e0 e1)
rec-steps-s : ∀ {Γ T} → {e : Γ |- nat} → {e0 : Γ |- T} → {e1 : (nat :: (T :: Γ)) |- T} → subst e1 (lem4 e (rec e e0 e1)) ≤s (rec (s e) e0 e1)
listrec-steps-nil : ∀ {Γ τ τ'} → {e0 : Γ |- τ'} → {e1 : (τ :: (list τ :: (τ' :: Γ))) |- τ'}
→ e0 ≤s (listrec nil e0 e1)
listrec-steps-cons : ∀ {Γ τ τ'} → {h : Γ |- τ} {t : Γ |- list τ}
→ {e0 : Γ |- τ'} → {e1 : (τ :: (list τ :: (τ' :: Γ))) |- τ'}
→ subst e1 (lem5 h t (listrec t e0 e1)) ≤s (listrec (h ::c t) e0 e1)
ren-comp-l : ∀ {Γ Γ' Γ'' τ} → (ρ1 : rctx Γ Γ') → (ρ2 : rctx Γ' Γ'') → (e : Γ'' |- τ) → (ren (ren e ρ2) ρ1) ≤s (ren e (ρ1 ∙rr ρ2))
ren-comp-r : ∀ {Γ Γ' Γ'' τ} → (ρ1 : rctx Γ Γ') → (ρ2 : rctx Γ' Γ'') → (e : Γ'' |- τ) → (ren e (ρ1 ∙rr ρ2)) ≤s (ren (ren e ρ2) ρ1)
subst-id-l : ∀ {Γ τ} → (e : Γ |- τ) → e ≤s subst e ids
subst-id-r : ∀ {Γ τ} → (e : Γ |- τ) → subst e ids ≤s e
subst-rs-l : ∀ {A B C τ} → (ρ : rctx C A) (Θ : sctx A B) (e : B |- τ)
→ ren (subst e Θ) ρ ≤s subst e (ρ rs Θ)
subst-rs-r : ∀ {A B C τ} → (ρ : rctx C A) (Θ : sctx A B) (e : B |- τ)
→ subst e (ρ rs Θ) ≤s ren (subst e Θ) ρ
subst-sr-l : ∀ {Γ Γ' Γ'' τ} → (Θ : sctx Γ Γ') → (ρ : rctx Γ' Γ'') → (e : Γ'' |- τ)
→ (subst (ren e ρ) Θ) ≤s subst e (Θ sr ρ)
subst-sr-r : ∀ {Γ Γ' Γ'' τ} → (Θ : sctx Γ Γ') → (ρ : rctx Γ' Γ'') → (e : Γ'' |- τ)
→ subst e (Θ sr ρ) ≤s (subst (ren e ρ) Θ)
subst-ss-l : ∀ {A B C τ} → (Θ1 : sctx A B) (Θ2 : sctx B C) (e : C |- τ)
→ subst e (Θ1 ss Θ2) ≤s subst (subst e Θ2) Θ1
subst-ss-r : ∀ {A B C τ} → (Θ1 : sctx A B) (Θ2 : sctx B C) (e : C |- τ)
→ subst (subst e Θ2) Θ1 ≤s subst e (Θ1 ss Θ2)
subst-compose-l : ∀ {Γ Γ' τ τ1} (Θ : sctx Γ Γ') (v : Γ |- τ) (e : (τ :: Γ' |- τ1) )
→ subst (subst e (s-extend Θ)) (q v) ≤s subst e (lem3' Θ v)
subst-compose-r : ∀ {Γ Γ' τ τ1} (Θ : sctx Γ Γ') (v : Γ |- τ) (e : (τ :: Γ' |- τ1) )
→ subst e (lem3' Θ v) ≤s subst (subst e (s-extend Θ)) (q v)
subst-compose2-l : ∀ {Γ Γ' τ τ1 τ2} (Θ : sctx Γ Γ') (e1 : (τ1 :: (τ2 :: Γ')) |- τ) (v1 : Γ |- τ1) (v2 : Γ |- τ2)
→ subst (subst e1 (s-extend (s-extend Θ))) (lem4 v1 v2) ≤s subst e1 (lem4' Θ v1 v2)
subst-compose2-r : ∀ {Γ Γ' τ τ1 τ2} (Θ : sctx Γ Γ') (e1 : (τ1 :: (τ2 :: Γ')) |- τ) (v1 : Γ |- τ1) (v2 : Γ |- τ2)
→ subst e1 (lem4' Θ v1 v2) ≤s subst (subst e1 (s-extend (s-extend Θ))) (lem4 v1 v2)
subst-compose3-l : ∀ {Γ Γ' τ τ1 τ2} (Θ : sctx Γ Γ') (e1 : (τ1 :: (τ2 :: Γ')) |- τ) (v1 : Γ' |- τ1) (v2 : Γ' |- τ2)
→ subst (subst e1 (lem4 v1 v2)) Θ ≤s subst e1 (lem4' Θ (subst v1 Θ) (subst v2 Θ))
subst-compose3-r : ∀ {Γ Γ' τ τ1 τ2} (Θ : sctx Γ Γ') (e1 : (τ1 :: (τ2 :: Γ')) |- τ) (v1 : Γ' |- τ1) (v2 : Γ' |- τ2)
→ subst e1 (lem4' Θ (subst v1 Θ) (subst v2 Θ)) ≤s subst (subst e1 (lem4 v1 v2)) Θ
subst-compose4-l : ∀ {Γ Γ' τ} (Θ : sctx Γ Γ') (v' : Γ |- nat) (r : Γ |- τ) (e2 : (nat :: (τ :: Γ')) |- τ)
→ subst (subst e2 (s-extend (s-extend Θ))) (lem4 v' r) ≤s subst e2 (lem4' Θ v' r)
subst-compose4-r : ∀ {Γ Γ' τ} (Θ : sctx Γ Γ') (v' : Γ |- nat) (r : Γ |- τ) (e2 : (nat :: (τ :: Γ')) |- τ)
→ subst e2 (lem4' Θ v' r) ≤s subst (subst e2 (s-extend (s-extend Θ))) (lem4 v' r)
subst-compose5-l : ∀ {Γ Γ' τ τ1 τ2 τ3} (Θ : sctx Γ Γ') (e : (τ1 :: (τ2 :: (τ3 :: Γ'))) |- τ) (v1 : Γ |- τ1) (v2 : Γ |- τ2) (v3 : Γ |- τ3)
→ subst (subst e (s-extend (s-extend (s-extend (Θ))))) (lem5 v1 v2 v3) ≤s subst e (lem5' Θ v1 v2 v3)
subst-compose5-r : ∀ {Γ Γ' τ τ1 τ2 τ3} (Θ : sctx Γ Γ') (e : (τ1 :: (τ2 :: (τ3 :: Γ'))) |- τ) (v1 : Γ |- τ1) (v2 : Γ |- τ2) (v3 : Γ |- τ3)
→ subst e (lem5' Θ v1 v2 v3) ≤s subst (subst e (s-extend (s-extend (s-extend (Θ))))) (lem5 v1 v2 v3)
-- r-extend : ∀ {Γ Γ' τ} → rctx Γ Γ' → rctx (τ :: Γ) (τ :: Γ')
r-extend ρ i0 = i0
r-extend ρ (iS x) = iS (ρ x)
-- _∙rr_ : ∀ {A B C} → rctx A B → rctx B C → rctx A C
ρ1 ∙rr ρ2 = ρ1 o ρ2
rename-var ρ a = ρ a
idr x = x
p∙ ρ = λ x → iS (ρ x)
p = p∙ idr
--free stuff
rename-var-ident _ = Refl
rename-var-∙ _ _ _ = Refl
∙rr-assoc r1 r2 r3 = Refl
ren unit ρ = unit
ren 0C ρ = 0C
ren 1C ρ = 1C
ren (plusC e e₁) ρ = plusC (ren e ρ) (ren e₁ ρ)
ren (var x) ρ = var (ρ x)
ren z ρ = z
ren (s e) ρ = s (ren e ρ)
ren (rec e e₁ e₂) ρ = rec (ren e ρ) (ren e₁ ρ) (ren e₂ (r-extend (r-extend ρ)))
ren (lam e) ρ = lam (ren e (r-extend ρ))
ren (app e e₁) ρ = app (ren e ρ) (ren e₁ ρ)
ren (prod e1 e2) ρ = prod (ren e1 ρ) (ren e2 ρ)
ren (l-proj e) ρ = l-proj (ren e ρ)
ren (r-proj e) ρ = r-proj (ren e ρ)
ren nil ρ = nil
ren (x ::c xs) ρ = ren x ρ ::c ren xs ρ
ren true ρ = true
ren false ρ = false
ren (listrec e e₁ e₂) ρ = listrec (ren e ρ) (ren e₁ ρ) (ren e₂ (r-extend (r-extend (r-extend ρ))))
ren (max τ e1 e2) ρ = max τ (ren e1 ρ) (ren e2 ρ)
ren (letc e e') ρ = letc (ren e (r-extend ρ)) (ren e' ρ)
extend-ren-comp-lemma i0 ρ1 ρ2 = Refl
extend-ren-comp-lemma (iS x) ρ1 ρ2 = Refl
extend-ren-comp ρ1 ρ2 = λ=i (λ τ → λ= (λ x → extend-ren-comp-lemma x ρ1 ρ2))
-- weakening a context
wkn e = ren e iS
-- parallel extension
s-extend Θ i0 = var i0
s-extend Θ (iS x) = wkn (Θ x)
-- identity substitution
ids x = var x
-- weakening with substitution
q∙ Θ = λ x → wkn (Θ x)
lem3' Θ e i0 = e
lem3' Θ e (iS i) = Θ i
--lem3
q e = lem3' ids e
-- subst-var
svar Θ i = q (Θ i) i0
lem4' Θ a b = lem3' (lem3' Θ b) a
lem4 e1 e2 = lem4' ids e1 e2
lem5' Θ a b c = lem3' (lem3' (lem3' Θ c) b) a
lem5 e1 e2 e3 = lem5' ids e1 e2 e3
subst unit Θ = unit
subst 0C Θ = 0C
subst 1C Θ = 1C
subst (plusC e e₁) Θ = plusC (subst e Θ) (subst e₁ Θ)
subst (var x) Θ = Θ x
subst z Θ = z
subst (s e) Θ = s (subst e Θ)
subst (rec e e₁ e₂) Θ = rec (subst e Θ) (subst e₁ Θ) (subst e₂ (s-extend (s-extend Θ)))
subst (lam e) Θ = lam (subst e (s-extend Θ))
subst (app e e₁) Θ = app (subst e Θ) (subst e₁ Θ)
subst (prod e1 e2) Θ = prod (subst e1 Θ) (subst e2 Θ)
subst (l-proj e) Θ = l-proj (subst e Θ)
subst (r-proj e) Θ = r-proj (subst e Θ)
subst nil Θ = nil
subst (x ::c xs) Θ = subst x Θ ::c subst xs Θ
subst true Θ = true
subst false Θ = false
subst (listrec e e₁ e₂) Θ = listrec (subst e Θ) (subst e₁ Θ) (subst e₂ (s-extend (s-extend (s-extend Θ))))
subst (max τ e1 e2) Θ = max τ (subst e1 Θ) (subst e2 Θ)
subst (letc e e') Θ = letc (subst e (s-extend Θ)) (subst e' Θ)
subst1 : ∀ {Γ τ τ1} → Γ |- τ1 → (τ1 :: Γ) |- τ → Γ |- τ
subst1 e e' = subst e' (q e)
_rs_ ρ Θ x = ren (subst (var x) Θ) ρ
_ss_ Θ1 Θ2 x = subst (subst (var x) Θ2) Θ1
_sr_ Θ ρ x = subst (ren (var x) ρ) Θ
extend-id-once-lemma : ∀ {Γ τ τ'} → (x : τ ∈ τ' :: Γ) → _==_ {_} {τ' :: Γ |- τ}
(ids {τ' :: Γ} {τ} x) (s-extend {Γ} {Γ} {τ'} (ids {Γ}) {τ} x)
extend-id-once-lemma i0 = Refl
extend-id-once-lemma (iS x) = Refl
extend-id-once : ∀ {Γ τ} → Id {_} {sctx (τ :: Γ) (τ :: Γ)} (ids {τ :: Γ}) (s-extend ids)
extend-id-once = λ=i (λ τ → λ= (λ x → extend-id-once-lemma x))
extend-id-twice : ∀ {Γ τ1 τ2} → Id {_} {sctx (τ1 :: τ2 :: Γ) (τ1 :: τ2 :: Γ)} (ids {τ1 :: τ2 :: Γ}) (s-extend (s-extend ids))
extend-id-twice = ap s-extend extend-id-once ∘ extend-id-once
_trans_ : ∀ {Γ T}
→ {e e' e'' : Γ |- T}
→ e ≤s e' → e' ≤s e''
→ e ≤s e''
_trans_ = trans-s
infixr 10 _trans_
| 50.274021
| 173
| 0.439301
|
4d34ae86ddd035f77cc54932f2e634e1ffd0f459
| 17,003
|
agda
|
Agda
|
Cubical/Homotopy/Connected.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 1
|
2022-02-05T01:25:26.000Z
|
2022-02-05T01:25:26.000Z
|
Cubical/Homotopy/Connected.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | null | null | null |
Cubical/Homotopy/Connected.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --safe #-}
module Cubical.Homotopy.Connected where
open import Cubical.Core.Everything
open import Cubical.Foundations.Everything
open import Cubical.Foundations.Function
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.GroupoidLaws
open import Cubical.Foundations.Path
open import Cubical.Foundations.Univalence
open import Cubical.Functions.Fibration
open import Cubical.Data.Nat
open import Cubical.Data.Sigma
open import Cubical.HITs.Nullification
open import Cubical.HITs.Susp
open import Cubical.HITs.SmashProduct
open import Cubical.HITs.Truncation as Trunc renaming (rec to trRec)
open import Cubical.Homotopy.Loopspace
open import Cubical.HITs.Pushout
open import Cubical.HITs.Sn.Base
open import Cubical.HITs.S1
open import Cubical.Data.Bool
open import Cubical.Data.Unit
-- Note that relative to most sources, this notation is off by +2
isConnected : ∀ {ℓ} (n : HLevel) (A : Type ℓ) → Type ℓ
isConnected n A = isContr (hLevelTrunc n A)
isConnectedFun : ∀ {ℓ ℓ'} (n : HLevel) {A : Type ℓ} {B : Type ℓ'} (f : A → B) → Type (ℓ-max ℓ ℓ')
isConnectedFun n f = ∀ b → isConnected n (fiber f b)
isTruncatedFun : ∀ {ℓ ℓ'} (n : HLevel) {A : Type ℓ} {B : Type ℓ'} (f : A → B) → Type (ℓ-max ℓ ℓ')
isTruncatedFun n f = ∀ b → isOfHLevel n (fiber f b)
isConnectedSubtr : ∀ {ℓ} {A : Type ℓ} (n m : HLevel)
→ isConnected (m + n) A
→ isConnected n A
isConnectedSubtr {A = A} n m iscon =
isOfHLevelRetractFromIso 0 (truncOfTruncIso n m) (helper n iscon)
where
helper : (n : ℕ) → isConnected (m + n) A → isContr (hLevelTrunc n (hLevelTrunc (m + n) A))
helper zero iscon = isContrUnit*
helper (suc n) iscon = ∣ iscon .fst ∣ , (Trunc.elim (λ _ → isOfHLevelPath (suc n) (isOfHLevelTrunc (suc n)) _ _) λ a → cong ∣_∣ (iscon .snd a))
isConnectedFunSubtr : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} (n m : HLevel) (f : A → B)
→ isConnectedFun (m + n) f
→ isConnectedFun n f
isConnectedFunSubtr n m f iscon b = isConnectedSubtr n m (iscon b)
private
typeToFiberIso : ∀ {ℓ} (A : Type ℓ) → Iso A (fiber (λ (x : A) → tt) tt)
Iso.fun (typeToFiberIso A) x = x , refl
Iso.inv (typeToFiberIso A) = fst
Iso.rightInv (typeToFiberIso A) b i = fst b , (isOfHLevelSuc 1 (isPropUnit) tt tt (snd b) refl) i
Iso.leftInv (typeToFiberIso A) a = refl
typeToFiber : ∀ {ℓ} (A : Type ℓ) → A ≡ fiber (λ (x : A) → tt) tt
typeToFiber A = isoToPath (typeToFiberIso A)
isOfHLevelIsConnectedStable : ∀ {ℓ} {A : Type ℓ} (n : ℕ)
→ isOfHLevel n (isConnected n A)
isOfHLevelIsConnectedStable {A = A} zero =
(tt* , (λ _ → refl)) , λ _ → refl
isOfHLevelIsConnectedStable {A = A} (suc n) =
isProp→isOfHLevelSuc n isPropIsContr
module elim {ℓ ℓ' : Level} {A : Type ℓ} {B : Type ℓ'} (f : A → B) where
private
inv : ∀ {ℓ'''} (n : HLevel) (P : B → TypeOfHLevel ℓ''' (suc n))
→ ((a : A) → P (f a) .fst)
→ (b : B)
→ hLevelTrunc (suc n) (fiber f b) → P b .fst
inv n P t b =
Trunc.rec
(P b .snd)
(λ {(a , p) → subst (fst ∘ P) p (t a)})
isIsoPrecompose : ∀ {ℓ'''} (n : ℕ) (P : B → TypeOfHLevel ℓ''' n)
→ isConnectedFun n f
→ Iso ((b : B) → P b .fst) ((a : A) → P (f a) .fst)
isIsoPrecompose zero P fConn = isContr→Iso (isOfHLevelΠ _ (λ b → P b .snd)) (isOfHLevelΠ _ λ a → P (f a) .snd)
Iso.fun (isIsoPrecompose (suc n) P fConn) = _∘ f
Iso.inv (isIsoPrecompose (suc n) P fConn) t b = inv n P t b (fConn b .fst)
Iso.rightInv (isIsoPrecompose (suc n) P fConn) t =
funExt λ a → cong (inv n P t (f a)) (fConn (f a) .snd ∣ a , refl ∣)
∙ substRefl {B = fst ∘ P} (t a)
Iso.leftInv (isIsoPrecompose (suc n) P fConn) s =
funExt λ b →
Trunc.elim
{B = λ d → inv n P (s ∘ f) b d ≡ s b}
(λ _ → isOfHLevelPath (suc n) (P b .snd) _ _)
(λ {(a , p) i → transp (λ j → P (p (j ∨ i)) .fst) i (s (p i))})
(fConn b .fst)
isEquivPrecompose : ∀ {ℓ'''} (n : ℕ) (P : B → TypeOfHLevel ℓ''' n)
→ isConnectedFun n f
→ isEquiv (λ(s : (b : B) → P b .fst) → s ∘ f)
isEquivPrecompose zero P fConn = isoToIsEquiv theIso
where
theIso : Iso ((b : B) → P b .fst) ((a : A) → P (f a) .fst)
Iso.fun theIso = λ(s : (b : B) → P b .fst) → s ∘ f
Iso.inv theIso = λ _ b → P b .snd .fst
Iso.rightInv theIso g = funExt λ x → P (f x) .snd .snd (g x)
Iso.leftInv theIso g = funExt λ x → P x .snd .snd (g x)
isEquivPrecompose (suc n) P fConn = isoToIsEquiv (isIsoPrecompose (suc n) P fConn)
isConnectedPrecompose : (n : ℕ) → ((P : B → TypeOfHLevel (ℓ-max ℓ ℓ') n)
→ hasSection (λ(s : (b : B) → P b .fst) → s ∘ f))
→ isConnectedFun n f
isConnectedPrecompose zero P→sect b = isContrUnit*
isConnectedPrecompose (suc n) P→sect b = c n P→sect b , λ y → sym (fun n P→sect b y)
where
P : (n : HLevel) → ((P : B → TypeOfHLevel ℓ (suc n))
→ hasSection (λ(s : (b : B) → P b .fst) → s ∘ f))
→ B → Type _
P n s b = hLevelTrunc (suc n) (fiber f b)
c : (n : HLevel) → ((P : B → TypeOfHLevel (ℓ-max ℓ ℓ') (suc n))
→ hasSection (λ(s : (b : B) → P b .fst) → s ∘ f)) → (b : B)
→ hLevelTrunc (suc n) (fiber f b)
c n s = (s λ b → (hLevelTrunc (suc n) (fiber f b) , isOfHLevelTrunc _)) .fst
λ a → ∣ a , refl ∣
fun : (n : HLevel) (P→sect : ((P : B → TypeOfHLevel (ℓ-max ℓ ℓ') (suc n))
→ hasSection λ(s : (b : B) → P b .fst) → s ∘ f))
→ (b : B) (w : (hLevelTrunc (suc n) (fiber f b)))
→ w ≡ c n P→sect b
fun n P→sect b = Trunc.elim (λ x → isOfHLevelPath (suc n) (isOfHLevelTrunc _) _ _)
λ a → J (λ b p → ∣ (fst a) , p ∣ ≡ c n P→sect b)
(c* (fst a))
(snd a)
where
c* : ((a : A) → ∣ (a , refl {x = f a}) ∣ ≡ c n P→sect (f a))
c* a = sym (cong (λ x → x a) (P→sect (λ b → hLevelTrunc (suc n) (fiber f b) , isOfHLevelTrunc _) .snd λ a → ∣ a , refl ∣))
isOfHLevelPrecomposeConnected : ∀ {ℓ ℓ' ℓ''} (k : HLevel) (n : HLevel)
{A : Type ℓ} {B : Type ℓ'} (P : B → TypeOfHLevel ℓ'' (k + n)) (f : A → B)
→ isConnectedFun n f
→ isOfHLevelFun k (λ(s : (b : B) → P b .fst) → s ∘ f)
isOfHLevelPrecomposeConnected zero n P f fConn =
elim.isEquivPrecompose f n P fConn .equiv-proof
isOfHLevelPrecomposeConnected (suc k) n P f fConn t =
isOfHLevelPath'⁻ k
λ {(s₀ , p₀) (s₁ , p₁) →
isOfHLevelRetractFromIso k (invIso ΣPathIsoPathΣ)
(subst (isOfHLevel k)
(sym (fiberPath (s₀ , p₀) (s₁ , p₁)))
(isOfHLevelRetract k
(λ {(q , α) → (funExt⁻ q) , (cong funExt⁻ α)})
(λ {(h , β) → (funExt h) , (cong funExt β)})
(λ _ → refl)
(isOfHLevelPrecomposeConnected k n
(λ b → (s₀ b ≡ s₁ b) , isOfHLevelPath' (k + n) (P b .snd) _ _)
f fConn
(funExt⁻ (p₀ ∙∙ refl ∙∙ sym p₁)))))}
indMapEquiv→conType : ∀ {ℓ} {A : Type ℓ} (n : HLevel)
→ ((B : TypeOfHLevel ℓ n)
→ isEquiv (λ (b : (fst B)) → λ (a : A) → b))
→ isConnected n A
indMapEquiv→conType {A = A} zero BEq = isContrUnit*
indMapEquiv→conType {A = A} (suc n) BEq =
isOfHLevelRetractFromIso 0 (mapCompIso {n = (suc n)} (typeToFiberIso A))
(elim.isConnectedPrecompose (λ _ → tt) (suc n)
(λ P → ((λ a _ → a) ∘ invIsEq (BEq (P tt)))
, λ a → equiv-proof (BEq (P tt)) a .fst .snd)
tt)
isConnectedComp : ∀ {ℓ ℓ' ℓ''} {A : Type ℓ} {B : Type ℓ'} {C : Type ℓ''}
(f : B → C) (g : A → B) (n : ℕ)
→ isConnectedFun n f
→ isConnectedFun n g
→ isConnectedFun n (f ∘ g)
isConnectedComp {C = C} f g n con-f con-g =
elim.isConnectedPrecompose (f ∘ g) n
λ P →
isEquiv→hasSection
(compEquiv
(_ , elim.isEquivPrecompose f n P con-f)
(_ , elim.isEquivPrecompose g n (λ b → P (f b)) con-g) .snd)
isEquiv→isConnected : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'}
(f : A → B)
→ isEquiv f
→ (n : ℕ) → isConnectedFun n f
isEquiv→isConnected f iseq n b =
isContr→isContr∥ n (equiv-proof iseq b)
isConnectedPath : ∀ {ℓ} (n : HLevel) {A : Type ℓ}
→ isConnected (suc n) A
→ (a₀ a₁ : A) → isConnected n (a₀ ≡ a₁)
isConnectedPath zero connA a₀ a₁ = isContrUnit*
isConnectedPath (suc n) {A = A} connA a₀ a₁ =
isOfHLevelRetractFromIso 0 (invIso (PathIdTruncIso (suc n))) (isContr→isContrPath connA _ _)
isConnectedPathP : ∀ {ℓ} (n : HLevel) {A : I → Type ℓ}
→ isConnected (suc n) (A i1)
→ (a₀ : A i0) (a₁ : A i1) → isConnected n (PathP A a₀ a₁)
isConnectedPathP n con a₀ a₁ =
subst (isConnected n) (sym (PathP≡Path _ _ _))
(isConnectedPath n con _ _)
isConnectedCong : ∀ {ℓ ℓ'} (n : HLevel) {A : Type ℓ} {B : Type ℓ'} (f : A → B)
→ isConnectedFun (suc n) f
→ ∀ {a₀ a₁} → isConnectedFun n {A = a₀ ≡ a₁} (cong f)
isConnectedCong n f cf {a₀} {a₁} q =
subst (isConnected n)
(sym (fiberCong f q))
(isConnectedPath n (cf (f a₁)) (a₀ , q) (a₁ , refl))
isConnectedCong' : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} {x : A} {y : B}
(n : ℕ) (f : A → B)
→ isConnectedFun (suc n) f
→ (p : f x ≡ y)
→ isConnectedFun n
λ (q : x ≡ x) → sym p ∙∙ cong f q ∙∙ p
isConnectedCong' {x = x} n f conf p =
transport (λ i → (isConnectedFun n
λ (q : x ≡ x)
→ doubleCompPath-filler (sym p) (cong f q) p i))
(isConnectedCong n f conf)
isConnectedRetract : ∀ {ℓ ℓ'} (n : HLevel)
{A : Type ℓ} {B : Type ℓ'}
(f : A → B) (g : B → A)
(h : (x : A) → g (f x) ≡ x)
→ isConnected n B → isConnected n A
isConnectedRetract zero _ _ _ _ = isContrUnit*
isConnectedRetract (suc n) f g h =
isContrRetract
(Trunc.map f)
(Trunc.map g)
(Trunc.elim
(λ _ → isOfHLevelPath (suc n) (isOfHLevelTrunc (suc n)) _ _)
(λ a → cong ∣_∣ (h a)))
isConnectedRetractFromIso : ∀ {ℓ ℓ'} (n : HLevel)
{A : Type ℓ} {B : Type ℓ'}
→ Iso A B
→ isConnected n B → isConnected n A
isConnectedRetractFromIso n e =
isConnectedRetract n
(Iso.fun e)
(Iso.inv e)
(Iso.leftInv e)
isConnectedPoint : ∀ {ℓ} (n : HLevel) {A : Type ℓ}
→ isConnected (suc n) A
→ (a : A) → isConnectedFun n (λ(_ : Unit) → a)
isConnectedPoint n connA a₀ a =
isConnectedRetract n
snd (_ ,_) (λ _ → refl)
(isConnectedPath n connA a₀ a)
isConnectedPoint2 : ∀ {ℓ} (n : HLevel) {A : Type ℓ} (a : A)
→ isConnectedFun n (λ(_ : Unit) → a)
→ isConnected (suc n) A
isConnectedPoint2 n {A = A} a connMap = indMapEquiv→conType _ λ B → isoToIsEquiv (theIso B)
where
module _ {ℓ' : Level} (B : TypeOfHLevel ℓ' (suc n))
where
helper : (f : A → fst B) → (a2 : A) → f a2 ≡ f a
helper f = equiv-proof (elim.isEquivPrecompose (λ _ → a) n (λ a2 → (f a2 ≡ f a) ,
isOfHLevelPath' n (snd B) (f a2) (f a)) connMap) (λ _ → refl) .fst .fst
theIso : Iso (fst B) (A → fst B)
Iso.fun theIso b a = b
Iso.inv theIso f = f a
Iso.rightInv theIso f = funExt λ y → sym (helper f y)
Iso.leftInv theIso _ = refl
connectedTruncIso : ∀ {ℓ} {A B : Type ℓ} (n : HLevel) (f : A → B)
→ isConnectedFun n f
→ Iso (hLevelTrunc n A) (hLevelTrunc n B)
connectedTruncIso {A = A} {B = B} zero f con = isContr→Iso isContrUnit* isContrUnit*
connectedTruncIso {A = A} {B = B} (suc n) f con = g
where
back : B → hLevelTrunc (suc n) A
back y = map fst ((con y) .fst)
backSection : (b : B) → Path (hLevelTrunc (suc n) B)
(Trunc.rec (isOfHLevelTrunc (suc n))
(λ a → ∣ f a ∣)
(Trunc.rec (isOfHLevelTrunc (suc n))
back ∣ b ∣))
∣ b ∣
backSection b = helper (λ p → map f p ≡ ∣ b ∣)
(λ x → (isOfHLevelSuc (suc n) (isOfHLevelTrunc (suc n)))
(map f (map fst x)) ∣ b ∣)
(λ a p → cong ∣_∣ p)
(fst (con b))
where
helper : ∀ {ℓ ℓ' ℓ''} {A : Type ℓ} {B : A → Type ℓ'} (P : hLevelTrunc (suc n) A → Type ℓ'')
→ ((x : hLevelTrunc (suc n) (Σ A B)) → isOfHLevel (suc n) (P (map fst x)))
→ ((a : A) (b : B a) → P ∣ a ∣)
→ (p : hLevelTrunc (suc n) (Σ A B))
→ P (map fst p)
helper P hlev pf = Trunc.elim hlev λ pair → pf (fst pair) (snd pair)
g : Iso (hLevelTrunc (suc n) A) (hLevelTrunc (suc n) B)
Iso.fun g = map f
Iso.inv g = Trunc.rec (isOfHLevelTrunc _) back
Iso.leftInv g = Trunc.elim (λ x → isOfHLevelPath (suc n) (isOfHLevelTrunc _) _ _)
λ a → cong (map fst) (con (f a) .snd ∣ a , refl ∣)
Iso.rightInv g = Trunc.elim (λ x → isOfHLevelPath (suc n) (isOfHLevelTrunc _) _ _)
backSection
connectedTruncIso2 : ∀ {ℓ} {A B : Type ℓ} (n m : HLevel) (f : A → B)
→ Σ[ x ∈ ℕ ] x + n ≡ m
→ isConnectedFun m f
→ Iso (hLevelTrunc n A) (hLevelTrunc n B)
connectedTruncIso2 {A = A} {B = B} n m f (x , pf) con =
connectedTruncIso n f (isConnectedFunSubtr n x f (transport (λ i → isConnectedFun (pf (~ i)) f) con))
connectedTruncEquiv : ∀ {ℓ} {A B : Type ℓ} (n : HLevel) (f : A → B)
→ isConnectedFun n f
→ hLevelTrunc n A ≃ hLevelTrunc n B
connectedTruncEquiv {A = A} {B = B} n f con = isoToEquiv (connectedTruncIso n f con)
-- TODO : Reorganise the following proofs.
inrConnected : ∀ {ℓ ℓ' ℓ''} {A : Type ℓ} {B : Type ℓ'} {C : Type ℓ''} (n : HLevel)
→ (f : C → A) (g : C → B)
→ isConnectedFun n f
→ isConnectedFun n {A = B} {B = Pushout f g} inr
inrConnected {A = A} {B = B} {C = C} n f g iscon =
elim.isConnectedPrecompose inr n λ P → (k P) , λ b → refl
where
module _ {ℓ : Level} (P : (Pushout f g) → TypeOfHLevel ℓ n)
(h : (b : B) → typ (P (inr b)))
where
Q : A → TypeOfHLevel _ n
Q a = (P (inl a))
fun : (c : C) → typ (Q (f c))
fun c = transport (λ i → typ (P (push c (~ i)))) (h (g c))
k : (d : Pushout f g) → typ (P d)
k (inl x) = equiv-proof (elim.isEquivPrecompose f n Q iscon) fun .fst .fst x
k (inr x) = h x
k (push a i) =
hcomp (λ k → λ { (i = i0) → equiv-proof (elim.isEquivPrecompose f n Q iscon) fun .fst .snd i0 a
; (i = i1) → transportTransport⁻ (λ j → typ (P (push a j))) (h (g a)) k })
(transp (λ j → typ (P (push a (i ∧ j))))
(~ i)
(equiv-proof (elim.isEquivPrecompose f n Q iscon)
fun .fst .snd i a))
{- Given two fibration B , C : A → Type and a family of maps on fibres
f : (a : A) → B a → C a, we have that f a is n-connected for all (a : A)
iff the induced map on totalspaces Σ A B → Σ A C is n-connected -}
module _ {ℓ ℓ' ℓ'' : Level} {A : Type ℓ} {B : A → Type ℓ'} {C : A → Type ℓ''}
(f : ((a : A) → B a → C a))
where
open Iso
TotalFun : Σ A B → Σ A C
TotalFun (a , b) = a , f a b
fibTotalFun→fibFun : (x : Σ A C)
→ Σ[ y ∈ Σ A B ] TotalFun y ≡ x
→ Σ[ y ∈ B (fst x) ] f (fst x) y ≡ snd x
fibTotalFun→fibFun x =
uncurry
λ r → J (λ x _ → Σ[ y ∈ B (fst x) ] f (fst x) y ≡ snd x)
((snd r) , refl)
fibFun→fibTotalFun : (x : Σ A C)
→ Σ[ y ∈ B (fst x) ] f (fst x) y ≡ snd x
→ Σ[ y ∈ Σ A B ] TotalFun y ≡ x
fibFun→fibTotalFun x (b , p) = (_ , b) , ΣPathP (refl , p)
Iso-fibTotalFun-fibFun : (x : Σ A C)
→ Iso (Σ[ y ∈ Σ A B ] TotalFun y ≡ x)
(Σ[ y ∈ B (fst x) ] f (fst x) y ≡ snd x)
fun (Iso-fibTotalFun-fibFun x) = fibTotalFun→fibFun x
inv (Iso-fibTotalFun-fibFun x) = fibFun→fibTotalFun x
rightInv (Iso-fibTotalFun-fibFun x) (r , y) j =
transp (λ i → Σ[ b ∈ B (fst x) ] (f (fst x) b ≡ y (i ∨ j))) j
(r , λ i → y (i ∧ j))
leftInv (Iso-fibTotalFun-fibFun x) =
uncurry λ r
→ J (λ x y → inv (Iso-fibTotalFun-fibFun x)
(fun (Iso-fibTotalFun-fibFun x) (r , y))
≡ (r , y))
(cong (fibFun→fibTotalFun (TotalFun r))
(transportRefl (snd r , refl)))
TotalFunConnected→FunConnected : (n : ℕ)
→ isConnectedFun n TotalFun
→ ((a : A) → isConnectedFun n (f a))
TotalFunConnected→FunConnected n con a r =
isConnectedRetractFromIso n
(invIso (Iso-fibTotalFun-fibFun (a , r))) (con (a , r))
FunConnected→TotalFunConnected : (n : ℕ)
→ ((a : A) → isConnectedFun n (f a))
→ isConnectedFun n TotalFun
FunConnected→TotalFunConnected n con r =
isConnectedRetractFromIso n
(Iso-fibTotalFun-fibFun r) (con (fst r) (snd r))
| 41.87931
| 145
| 0.5342
|
14ecde1b1af4cf9bbbbf493fc70359ec938fc88b
| 3,595
|
agda
|
Agda
|
test/Succeed/Issue1324.agda
|
pthariensflame/agda
|
222c4c64b2ccf8e0fc2498492731c15e8fef32d4
|
[
"BSD-3-Clause"
] | 3
|
2015-03-28T14:51:03.000Z
|
2015-12-07T20:14:00.000Z
|
test/Succeed/Issue1324.agda
|
Blaisorblade/Agda
|
802a28aa8374f15fe9d011ceb80317fdb1ec0949
|
[
"BSD-3-Clause"
] | null | null | null |
test/Succeed/Issue1324.agda
|
Blaisorblade/Agda
|
802a28aa8374f15fe9d011ceb80317fdb1ec0949
|
[
"BSD-3-Clause"
] | null | null | null |
------------------------------------------------------------------------
-- Library stuff
data ⊥ : Set where
record ⊤ : Set where
constructor tt
data Bool : Set where
true false : Bool
if_then_else_ : ∀ {A : Set} → Bool → A → A → A
if true then t else f = t
if false then t else f = f
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
{-# BUILTIN NATURAL ℕ #-}
_∸_ : ℕ → ℕ → ℕ
m ∸ zero = m
zero ∸ suc n = zero
suc m ∸ suc n = m ∸ n
_≤_ : ℕ → ℕ → Bool
zero ≤ n = true
suc m ≤ zero = false
suc m ≤ suc n = m ≤ n
data _⊎_ (A : Set) (B : Set) : Set where
inj₁ : (x : A) → A ⊎ B
inj₂ : (y : B) → A ⊎ B
[_,_]₁ : ∀ {A : Set} {B : Set} {C : A ⊎ B → Set₁} →
((x : A) → C (inj₁ x)) → ((x : B) → C (inj₂ x)) →
((x : A ⊎ B) → C x)
[ f , g ]₁ (inj₁ x) = f x
[ f , g ]₁ (inj₂ y) = g y
data _≡_ {A : Set}(x : A) : A → Set where
refl : x ≡ x
record Σ (X : Set) (Y : X → Set) : Set where
constructor _,_
field
proj₁ : X
proj₂ : Y proj₁
_×_ : Set → Set → Set
X × Y = Σ X λ _ → Y
record Sig : Set₁ where
constructor _◃_
field
Parameter : Set
Arity : Parameter → Set
open Sig public
⟦_⟧ : Sig → Set → Set
⟦ P ◃ A ⟧ X = Σ P λ p → A p → X
Alg : Sig → Set → Set
Alg Σ X = ⟦ Σ ⟧ X → X
data μ (C : Sig) : Set where
sup : Alg C (μ C)
const^C : Set → Sig
const^C X = X ◃ λ _ → ⊥
_⊎^C_ : Sig → Sig → Sig
(P₁ ◃ A₁) ⊎^C (P₂ ◃ A₂) = (P₁ ⊎ P₂) ◃ [ A₁ , A₂ ]₁
_⋆^C_ : Sig → Set → Sig
C ⋆^C X = const^C X ⊎^C C
_⋆_ : Sig → Set → Set
C ⋆ X = μ (C ⋆^C X)
do : ∀ {C X} → Alg C (C ⋆ X)
do (p , k) = sup (inj₂ p , k)
record Monad (T : Set → Set) : Set₁ where
infixl 1 _>>=_
field
return : ∀ {X} → X → T X
_>>=_ : ∀ {X Y} → T X → (X → T Y) → T Y
monad : ∀ {Σ} → Monad (_⋆_ Σ)
monad {Σ} = record
{ return = λ x → sup (inj₁ x , λ ())
; _>>=_ = _>>=_
}
where
_>>=_ : ∀ {X Y} → Σ ⋆ X → (X → Σ ⋆ Y) → Σ ⋆ Y
sup (inj₁ x , _) >>= f = f x
sup (inj₂ p , k) >>= f = do (p , λ a → k a >>= f)
generic : ∀ {Σ} (p : Parameter Σ) → Σ ⋆ Arity Σ p
generic p = do (p , return)
where
open Monad monad
------------------------------------------------------------------------
-- Example
Π : (X : Set) → (X → Set) → Set
Π X Y = (x : X) → (X ◃ Y) ⋆ Y x
call : ∀ {X Y} → Π X Y
call x = generic x
dom : ∀ {X Y} → ∀ {x} → (X ◃ Y) ⋆ Y x → (X → Set) → Set
dom (sup (inj₁ _ , _)) R = ⊤
dom {Y = Y} (sup (inj₂ x , k)) R
= R x × ((y : Y x) → dom (k y) R)
data Dom {X}{Y} (f : (x : X) → (X ◃ Y) ⋆ Y x) : X → Set
where
⟨_⟩ : ∀ {x} → dom (f x) (Dom f) → Dom f x
dom-map : ∀ {X Y} {R₁ R₂ : X → Set} {x}
{w : (X ◃ Y) ⋆ Y x} →
(∀ {x} → R₁ x → R₂ x) → dom w R₁ → dom w R₂
dom-map {w = sup (inj₁ _ , _)} f _ = tt
dom-map {w = sup (inj₂ _ , _)} f (y₁ , k) =
f y₁ , λ y₂ → dom-map f (k y₂)
{-# TERMINATING #-}
bove-capretta : ∀ {X Y} (f : Π X Y) → (x : X) → Dom f x → Y x
bove-capretta {X}{Y} f x ⟨ d ⟩
= helper (f x) (dom-map (λ {x′} → bove-capretta f x′) d)
where
helper : ∀ {x} (w : (X ◃ Y) ⋆ Y x) → dom w Y → Y x
helper (sup (inj₁ y , _)) _ = y
helper (sup (inj₂ _ , k)) (d , dk) = helper (k d) (dk d)
module _ where
open Monad monad
gcd : Π (ℕ × ℕ) (λ _ → ℕ)
gcd (0 , n) = return n
gcd (m , 0) = return m
gcd (suc m , suc n) = if m ≤ n
then call (suc m , (n ∸ m))
else call ((m ∸ n) , suc n)
acc : Dom gcd (8 , 12)
acc = ⟨ ⟨ ⟨ ⟨ _ ⟩ , _ ⟩ , _ ⟩ , _ ⟩ -- ⟨ ⟨ ⟨ ⟨ tt ⟩ , (λ _ → tt) ⟩ , (λ _ → tt) ⟩ , (λ _ → tt) ⟩
test-gcd′ : bove-capretta gcd (8 , 12) acc ≡ 4
test-gcd′ = refl
| 23.044872
| 96
| 0.418359
|
29e2cec12cfb5c932bed92f50ac400932c5c8bbc
| 905
|
agda
|
Agda
|
README.agda
|
Saizan/dependent-lenses
|
b7921cc6b52858cd7d8a52c183c7a6544d1a4062
|
[
"MIT"
] | null | null | null |
README.agda
|
Saizan/dependent-lenses
|
b7921cc6b52858cd7d8a52c183c7a6544d1a4062
|
[
"MIT"
] | null | null | null |
README.agda
|
Saizan/dependent-lenses
|
b7921cc6b52858cd7d8a52c183c7a6544d1a4062
|
[
"MIT"
] | null | null | null |
------------------------------------------------------------------------
-- Non-dependent and dependent lenses
-- Nils Anders Danielsson
------------------------------------------------------------------------
{-# OPTIONS --cubical --safe #-}
module README where
-- Non-dependent lenses.
import Lens.Non-dependent
import Lens.Non-dependent.Traditional
import Lens.Non-dependent.Higher
import Lens.Non-dependent.Higher.Capriotti
import Lens.Non-dependent.Higher.Surjective-remainder
import Lens.Non-dependent.Equivalent-preimages
import Lens.Non-dependent.Bijection
-- Non-dependent lenses with erased proofs.
import Lens.Non-dependent.Traditional.Erased
import Lens.Non-dependent.Higher.Erased
-- Dependent lenses.
import Lens.Dependent
-- Comparisons of different kinds of lenses, focusing on the
-- definition of composable record getters and setters.
import README.Record-getters-and-setters
| 27.424242
| 72
| 0.675138
|
36611a2443d2629871665523a8cbc633459fc9ba
| 396
|
agda
|
Agda
|
test/interaction/Issue1653.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/interaction/Issue1653.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/interaction/Issue1653.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
-- Andreas, 2016-06-20
-- Issue #1653 reported by Jesper
-- Fixed by Ulf's AIM XXIII code sprint "instantiating module parameters"
open import Common.Equality
module _ (A : Set₁) where
-- Matching on refl works with new instantiateable module parameters.
test : A ≡ Set → Set₁
test refl = A
-- Case splitting thus should also work.
foo : A ≡ Set → Set₁
foo e = {!e!} -- C-c C-c
| 22
| 73
| 0.676768
|
3f7eaa724f6fbf13cc3bd7c35c517494cb606b87
| 2,072
|
agda
|
Agda
|
Cubical/Experiments/ZCohomologyOld/Groups/Connected.agda
|
Schippmunk/cubical
|
c345dc0c49d3950dc57f53ca5f7099bb53a4dc3a
|
[
"MIT"
] | null | null | null |
Cubical/Experiments/ZCohomologyOld/Groups/Connected.agda
|
Schippmunk/cubical
|
c345dc0c49d3950dc57f53ca5f7099bb53a4dc3a
|
[
"MIT"
] | null | null | null |
Cubical/Experiments/ZCohomologyOld/Groups/Connected.agda
|
Schippmunk/cubical
|
c345dc0c49d3950dc57f53ca5f7099bb53a4dc3a
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Experiments.ZCohomologyOld.Groups.Connected where
open import Cubical.Experiments.ZCohomologyOld.Base
open import Cubical.Experiments.ZCohomologyOld.Properties
open import Cubical.Experiments.ZCohomologyOld.Groups.Unit
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.GroupoidLaws
open import Cubical.HITs.SetTruncation renaming (rec to sRec ; elim to sElim ; elim2 to sElim2)
open import Cubical.HITs.PropositionalTruncation renaming (rec to pRec ; ∥_∥ to ∥_∥₁ ; ∣_∣ to ∣_∣₁)
open import Cubical.HITs.Nullification
open import Cubical.Data.Sigma hiding (_×_)
open import Cubical.Data.Int renaming (_+_ to _+ℤ_; +-comm to +ℤ-comm ; +-assoc to +ℤ-assoc)
open import Cubical.Data.Nat
open import Cubical.HITs.Truncation renaming (rec to trRec)
open import Cubical.Algebra.Group
open import Cubical.Homotopy.Connected
open import Cubical.Foundations.Equiv
private
H⁰-connected-type : ∀ {ℓ} {A : Type ℓ} (a : A) → isConnected 2 A → Iso (coHom 0 A) Int
Iso.fun (H⁰-connected-type a con) = sRec isSetInt λ f → f a
Iso.inv (H⁰-connected-type a con) b = ∣ (λ x → b) ∣₂
Iso.rightInv (H⁰-connected-type a con) b = refl
Iso.leftInv (H⁰-connected-type a con) =
sElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _)
λ f → cong ∣_∣₂ (funExt λ x → trRec (isSetInt _ _) (cong f) (isConnectedPath 1 con a x .fst))
H⁰-connected : ∀ {ℓ} {A : Type ℓ} (a : A) → ((x : A) → ∥ a ≡ x ∥₁) → GroupIso (coHomGr 0 A) intGroup
GroupHom.fun (GroupIso.map (H⁰-connected a con)) = sRec isSetInt (λ f → f a)
GroupHom.isHom (GroupIso.map (H⁰-connected a con)) =
sElim2 (λ _ _ → isProp→isSet (isSetInt _ _)) λ x y → addLemma (x a) (y a)
GroupIso.inv (H⁰-connected a con) b = ∣ (λ _ → b) ∣₂
GroupIso.rightInv (H⁰-connected a con) _ = refl
GroupIso.leftInv (H⁰-connected a con) =
sElim (λ _ → isProp→isSet (setTruncIsSet _ _))
(λ f → cong ∣_∣₂ (funExt λ x → pRec (isSetInt _ _) (cong f) (con x)))
| 47.090909
| 104
| 0.713803
|
314e4b4cfc80cdc6d4632165cfef306f8193e772
| 1,161
|
agda
|
Agda
|
test/Succeed/Issue1663.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/Issue1663.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/Issue1663.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
{-# OPTIONS --without-K --rewriting --confluence-check #-}
postulate
_↦_ : ∀ {i} {A : Set i} → A → A → Set i
idr : ∀ {i} {A : Set i} {a : A} → a ↦ a
{-# BUILTIN REWRITE _↦_ #-}
data _==_ {i} {A : Set i} (a : A) : A → Set i where
idp : a == a
PathOver : ∀ {i j} {A : Set i} (B : A → Set j)
{x y : A} (p : x == y) (u : B x) (v : B y) → Set j
PathOver B idp u v = (u == v)
syntax PathOver B p u v =
u == v [ B ↓ p ]
postulate
PathOver-rewr : ∀ {i j} {A : Set i} {B : Set j} {x y : A} (p : x == y) (u v : B) →
(PathOver (λ _ → B) p u v) ↦ (u == v)
{-# REWRITE PathOver-rewr #-}
ap : ∀ {i j} {A : Set i} {B : A → Set j} (f : (a : A) → B a) {x y : A}
→ (p : x == y) → PathOver B p (f x) (f y)
ap f idp = idp
postulate
Circle : Set
base : Circle
loop : base == base
module _ {i} {P : Circle → Set i} (base* : P base) (loop* : base* == base* [ P ↓ loop ])
where
postulate
Circle-elim : (x : Circle) → P x
Circle-base-β : Circle-elim base ↦ base*
{-# REWRITE Circle-base-β #-}
Circle-loop-β : ap Circle-elim loop ↦ loop*
{-# REWRITE Circle-loop-β #-}
idCircle : Circle → Circle
idCircle = Circle-elim base loop
| 26.386364
| 88
| 0.500431
|
1169f70468a9a6f44a1cd32127016c6eab9eac45
| 503
|
agda
|
Agda
|
NonReflectiveZ.agda
|
z-murray/AnalysisAgda
|
6fbaca08b1d63b5765d184f6284fb0e58c9f5e52
|
[
"MIT"
] | null | null | null |
NonReflectiveZ.agda
|
z-murray/AnalysisAgda
|
6fbaca08b1d63b5765d184f6284fb0e58c9f5e52
|
[
"MIT"
] | null | null | null |
NonReflectiveZ.agda
|
z-murray/AnalysisAgda
|
6fbaca08b1d63b5765d184f6284fb0e58c9f5e52
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K --safe #-}
open import Agda.Builtin.Bool
open import Data.Maybe.Base using (just; nothing)
open import Relation.Binary.PropositionalEquality
open import Relation.Nullary
open import Data.Integer.Base
open import Data.Integer.Properties using (+-*-commutativeRing)
open import Tactic.RingSolver.Core.AlmostCommutativeRing using (fromCommutativeRing)
open import Tactic.RingSolver.NonReflective (fromCommutativeRing +-*-commutativeRing λ { +0 -> just refl; _ -> nothing}) public
| 41.916667
| 127
| 0.797217
|
37fbddef0e84d66997b4a3cb081aa7fd19b8dbf6
| 782
|
agda
|
Agda
|
Data/Num/Sandbox/Unary.agda
|
banacorn/numeral
|
aae093cc9bf21f11064e7f7b12049448cd6449f1
|
[
"MIT"
] | 1
|
2015-04-23T15:58:28.000Z
|
2015-04-23T15:58:28.000Z
|
Data/Num/Sandbox/Unary.agda
|
banacorn/numeral
|
aae093cc9bf21f11064e7f7b12049448cd6449f1
|
[
"MIT"
] | null | null | null |
Data/Num/Sandbox/Unary.agda
|
banacorn/numeral
|
aae093cc9bf21f11064e7f7b12049448cd6449f1
|
[
"MIT"
] | 1
|
2015-05-30T05:50:50.000Z
|
2015-05-30T05:50:50.000Z
|
module Data.Num.Unary where
open import Data.Unit
open import Data.Empty
open import Data.List
open import Data.Nat renaming (_+_ to _⊹_)
data Digit : Set where
[1] : Digit
Unary : Set
Unary = List Digit
_⊕_ : Digit → Digit → Digit
[1] ⊕ [1] = [1]
_⊚_ : Digit → Digit → Digit
[1] ⊚ [1] = [1]
add : Digit → Unary → Unary
add [1] [] = [1] ∷ []
add [1] ([1] ∷ xs) = [1] ∷ add [1] xs
_+_ : Unary → Unary → Unary
[] + ys = ys
xs + [] = xs
(x ∷ xs) + (y ∷ ys) = x ⊕ y ∷ add (x ⊚ y) (xs + ys)
_≈_ : Unary → Unary → Set
[] ≈ [] = ⊤
[] ≈ (x ∷ ys) = ⊥
(x ∷ xs) ≈ [] = ⊥
(x ∷ xs) ≈ (y ∷ ys) = xs ≈ ys
fromℕ : ℕ → Unary
fromℕ zero = []
fromℕ (suc n) = fromℕ n
-- fromℕ zero = []
-- fromℕ (suc n) = [1] ∷ fromℕ n
toℕ : Unary → ℕ
toℕ [] = zero
toℕ (_ ∷ xs) = suc (toℕ xs)
| 17.377778
| 51
| 0.503836
|
0d64c5b9a927cb64b712ba20d655f99b2a55407f
| 732
|
agda
|
Agda
|
test/Succeed/Issue1546.agda
|
pthariensflame/agda
|
222c4c64b2ccf8e0fc2498492731c15e8fef32d4
|
[
"BSD-3-Clause"
] | 3
|
2015-03-28T14:51:03.000Z
|
2015-12-07T20:14:00.000Z
|
test/Succeed/Issue1546.agda
|
Blaisorblade/Agda
|
802a28aa8374f15fe9d011ceb80317fdb1ec0949
|
[
"BSD-3-Clause"
] | null | null | null |
test/Succeed/Issue1546.agda
|
Blaisorblade/Agda
|
802a28aa8374f15fe9d011ceb80317fdb1ec0949
|
[
"BSD-3-Clause"
] | 1
|
2019-03-05T20:02:38.000Z
|
2019-03-05T20:02:38.000Z
|
-- Andreas, 2015-06-11
-- testing with in copattern matching with dependent record
-- {-# OPTIONS -v tc.with:20 #-}
open import Common.Prelude
open import Common.Equality
data Dec P : Set where
yes : (p : P) → Dec P
no : (¬p : P → ⊥) → Dec P
postulate
_≟_ : (n m : Nat) → Dec (n ≡ m)
boring : {A : Set} → A
record R : Set₁ where
field
Car : Set
el : Car
same : (x : Car) → Dec (x ≡ el)
test : (n : Nat) → R
R.Car (test n) = Nat
R.el (test n) = n
R.same (test zero) zero = yes refl
R.same (test zero) (suc x) = no λ()
R.same (test (suc n)) zero = no λ()
R.same (test (suc n)) (suc x) with n ≟ x
R.same (test (suc n)) (suc .n) | yes refl = yes refl
R.same (test (suc n)) (suc x) | no ¬p = no boring
| 22.875
| 59
| 0.565574
|
cc494f6b2d55388c483137bac23a74ecc94ed4bc
| 458
|
agda
|
Agda
|
Nehemiah/Syntax/Type.agda
|
inc-lc/ilc-agda
|
39bb081c6f192bdb87bd58b4a89291686d2d7d03
|
[
"MIT"
] | 10
|
2015-03-04T06:09:20.000Z
|
2019-07-19T07:06:59.000Z
|
Nehemiah/Syntax/Type.agda
|
inc-lc/ilc-agda
|
39bb081c6f192bdb87bd58b4a89291686d2d7d03
|
[
"MIT"
] | 6
|
2015-07-01T18:09:31.000Z
|
2017-05-04T13:53:59.000Z
|
Nehemiah/Syntax/Type.agda
|
inc-lc/ilc-agda
|
39bb081c6f192bdb87bd58b4a89291686d2d7d03
|
[
"MIT"
] | 1
|
2016-02-18T12:26:44.000Z
|
2016-02-18T12:26:44.000Z
|
------------------------------------------------------------------------
-- INCREMENTAL λ-CALCULUS
--
-- The syntax of types with the Nehemiah plugin.
------------------------------------------------------------------------
module Nehemiah.Syntax.Type where
import Parametric.Syntax.Type as Type
data Base : Type.Structure where
base-int : Base
base-bag : Base
open Type.Structure Base public
pattern int = base base-int
pattern bag = base base-bag
| 24.105263
| 72
| 0.5131
|
365051c0e586ad822dbd487df395080f9d9524e6
| 810
|
agda
|
Agda
|
src/NTypes/Nat.agda
|
vituscze/HoTT-lectures
|
7730385adfdbdda38ee8b124be3cdeebb7312c65
|
[
"BSD-3-Clause"
] | null | null | null |
src/NTypes/Nat.agda
|
vituscze/HoTT-lectures
|
7730385adfdbdda38ee8b124be3cdeebb7312c65
|
[
"BSD-3-Clause"
] | null | null | null |
src/NTypes/Nat.agda
|
vituscze/HoTT-lectures
|
7730385adfdbdda38ee8b124be3cdeebb7312c65
|
[
"BSD-3-Clause"
] | null | null | null |
{-# OPTIONS --without-K #-}
module NTypes.Nat where
open import NTypes
open import PathOperations
open import PathStructure.Nat
open import Types
ℕ-isSet : isSet ℕ
ℕ-isSet = ind
(λ m → (n : ℕ) (p q : m ≡ n) → p ≡ q)
(λ m-1 r → ind (λ n → (p q : suc m-1 ≡ n) → p ≡ q)
(λ n-1 r′ p′ q′
→ split-eq p′ ⁻¹
· ap (ap suc)
(r _
(merge-path m-1 n-1
(tr (F (suc m-1)) p′ (F-lemma (suc m-1))))
(merge-path m-1 n-1
(tr (F (suc m-1)) q′ (F-lemma (suc m-1)))))
· split-eq q′
)
(λ p q → 0-elim (split-path _ _ p)))
(ind (λ n → (p q : 0 ≡ n) → p ≡ q)
(λ _ _ p q → 0-elim (split-path _ _ p))
(λ p q → split-eq p ⁻¹ · split-eq q))
where
split-eq : {x y : ℕ} → _
split-eq {x} {y} = π₂ (π₂ (π₂ (split-merge-eq {x} {y})))
| 27
| 58
| 0.471605
|
73214c5be30320f40554921739efe7552a118115
| 495
|
agda
|
Agda
|
test/Fail/Issue427.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/Issue427.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/Issue427.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
-- 2011-08-22 Andreas (reported and fixed by Dominique Devriese)
{-# OPTIONS --no-universe-polymorphism #-}
module Issue427 where
data ⊥ : Set where
postulate f : {I : ⊥} (B : _) → ⊥
data A : Set where a : {x y : ⊥} → A
test : A → Set
test (a {x = x} {y = y}) with f {_}
test (a {x = x} {y = y}) | _ = A
{- old error message:
⊥ should be a function type, but it isn't
when checking that {y} are valid arguments to a function of type ⊥
-}
-- new error message should be: Unresolved metas
| 26.052632
| 68
| 0.622222
|
4ed249bb467a7acc8a9f255fd53bf0938eb760f5
| 1,400
|
agda
|
Agda
|
src/Categories/Category/Monoidal/Bundle.agda
|
yourboynico/agda-categories
|
6a087c592dbe58fc4bd9d02e1be9b94a9e138aca
|
[
"MIT"
] | 279
|
2019-06-01T14:36:40.000Z
|
2022-03-22T00:40:14.000Z
|
src/Categories/Category/Monoidal/Bundle.agda
|
seanpm2001/agda-categories
|
d9e4f578b126313058d105c61707d8c8ae987fa8
|
[
"MIT"
] | 236
|
2019-06-01T14:53:54.000Z
|
2022-03-28T14:31:43.000Z
|
src/Categories/Category/Monoidal/Bundle.agda
|
seanpm2001/agda-categories
|
d9e4f578b126313058d105c61707d8c8ae987fa8
|
[
"MIT"
] | 64
|
2019-06-02T16:58:15.000Z
|
2022-03-14T02:00:59.000Z
|
{-# OPTIONS --without-K --safe #-}
-- Bundled version of Monoidal Category
module Categories.Category.Monoidal.Bundle where
open import Level
open import Categories.Category.Core using (Category)
open import Categories.Category.Monoidal.Core using (Monoidal)
open import Categories.Category.Monoidal.Braided using (Braided)
open import Categories.Category.Monoidal.Symmetric using (Symmetric)
record MonoidalCategory o ℓ e : Set (suc (o ⊔ ℓ ⊔ e)) where
field
U : Category o ℓ e
monoidal : Monoidal U
open Category U public
open Monoidal monoidal public
record BraidedMonoidalCategory o ℓ e : Set (suc (o ⊔ ℓ ⊔ e)) where
field
U : Category o ℓ e
monoidal : Monoidal U
braided : Braided monoidal
monoidalCategory : MonoidalCategory o ℓ e
monoidalCategory = record { U = U ; monoidal = monoidal }
open Category U public
open Braided braided public
record SymmetricMonoidalCategory o ℓ e : Set (suc (o ⊔ ℓ ⊔ e)) where
field
U : Category o ℓ e
monoidal : Monoidal U
symmetric : Symmetric monoidal
open Category U public
open Symmetric symmetric public
braidedMonoidalCategory : BraidedMonoidalCategory o ℓ e
braidedMonoidalCategory = record
{ U = U
; monoidal = monoidal
; braided = braided
}
open BraidedMonoidalCategory braidedMonoidalCategory public
using (monoidalCategory)
| 27.45098
| 68
| 0.715
|
ccb01f8602539dbc97c1b862faa83eb6f8c10313
| 626
|
agda
|
Agda
|
Relation/Binary/PropositionalEquality/FasterReasoning.agda
|
oisdk/agda-binary
|
92af4d620febd47a9791d466d747278dc4a417aa
|
[
"MIT"
] | 1
|
2019-03-21T21:30:10.000Z
|
2019-03-21T21:30:10.000Z
|
Relation/Binary/PropositionalEquality/FasterReasoning.agda
|
oisdk/agda-binary
|
92af4d620febd47a9791d466d747278dc4a417aa
|
[
"MIT"
] | null | null | null |
Relation/Binary/PropositionalEquality/FasterReasoning.agda
|
oisdk/agda-binary
|
92af4d620febd47a9791d466d747278dc4a417aa
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K --safe #-}
module Relation.Binary.PropositionalEquality.FasterReasoning {a} {A : Set a} where
open import Relation.Binary.PropositionalEquality
infix 3 _∎
infixr 2 _≡⟨⟩_ step-≡ step-≡˘
infix 1 begin_
begin_ : ∀{x y : A} → x ≡ y → x ≡ y
begin_ x≡y = x≡y
_≡⟨⟩_ : (x {y} : A) → x ≡ y → x ≡ y
_ ≡⟨⟩ x≡y = x≡y
step-≡ : (x {y z} : A) → y ≡ z → x ≡ y → x ≡ z
step-≡ _ y≡z x≡y = trans x≡y y≡z
syntax step-≡ x y≡z x≡y = x ≡⟨ x≡y ⟩ y≡z
_∎ : (x : A) → x ≡ x
_∎ _ = refl
step-≡˘ : (x {y z} : A) → y ≡ z → y ≡ x → x ≡ z
step-≡˘ _ y≡z y≡x = trans (sym y≡x) y≡z
syntax step-≡˘ x y≡z y≡x = x ≡˘⟨ y≡x ⟩ y≡z
| 21.586207
| 82
| 0.514377
|
736d2381ea87e48c15ede9e9e7172740684977ef
| 76,499
|
agda
|
Agda
|
agda/Text/Greek/SBLGNT/1Tim.agda
|
scott-fleischman/GreekGrammar
|
915c46c27c7f8aad5907474d8484f2685a4cd6a7
|
[
"MIT"
] | 44
|
2015-05-29T14:48:51.000Z
|
2022-03-06T15:41:57.000Z
|
agda/Text/Greek/SBLGNT/1Tim.agda
|
scott-fleischman/GreekGrammar
|
915c46c27c7f8aad5907474d8484f2685a4cd6a7
|
[
"MIT"
] | 13
|
2015-05-28T20:04:08.000Z
|
2020-09-07T11:58:38.000Z
|
agda/Text/Greek/SBLGNT/1Tim.agda
|
scott-fleischman/GreekGrammar
|
915c46c27c7f8aad5907474d8484f2685a4cd6a7
|
[
"MIT"
] | 5
|
2015-02-27T22:34:13.000Z
|
2017-06-11T11:25:09.000Z
|
module Text.Greek.SBLGNT.1Tim where
open import Data.List
open import Text.Greek.Bible
open import Text.Greek.Script
open import Text.Greek.Script.Unicode
ΠΡΟΣ-ΤΙΜΟΘΕΟΝ-Α : List (Word)
ΠΡΟΣ-ΤΙΜΟΘΕΟΝ-Α =
word (Π ∷ α ∷ ῦ ∷ ∙λ ∷ ο ∷ ς ∷ []) "1Tim.1.1"
∷ word (ἀ ∷ π ∷ ό ∷ σ ∷ τ ∷ ο ∷ ∙λ ∷ ο ∷ ς ∷ []) "1Tim.1.1"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.1.1"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.1.1"
∷ word (κ ∷ α ∷ τ ∷ []) "1Tim.1.1"
∷ word (ἐ ∷ π ∷ ι ∷ τ ∷ α ∷ γ ∷ ὴ ∷ ν ∷ []) "1Tim.1.1"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.1.1"
∷ word (σ ∷ ω ∷ τ ∷ ῆ ∷ ρ ∷ ο ∷ ς ∷ []) "1Tim.1.1"
∷ word (ἡ ∷ μ ∷ ῶ ∷ ν ∷ []) "1Tim.1.1"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.1"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.1.1"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.1.1"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.1.1"
∷ word (ἐ ∷ ∙λ ∷ π ∷ ί ∷ δ ∷ ο ∷ ς ∷ []) "1Tim.1.1"
∷ word (ἡ ∷ μ ∷ ῶ ∷ ν ∷ []) "1Tim.1.1"
∷ word (Τ ∷ ι ∷ μ ∷ ο ∷ θ ∷ έ ∷ ῳ ∷ []) "1Tim.1.2"
∷ word (γ ∷ ν ∷ η ∷ σ ∷ ί ∷ ῳ ∷ []) "1Tim.1.2"
∷ word (τ ∷ έ ∷ κ ∷ ν ∷ ῳ ∷ []) "1Tim.1.2"
∷ word (ἐ ∷ ν ∷ []) "1Tim.1.2"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ι ∷ []) "1Tim.1.2"
∷ word (χ ∷ ά ∷ ρ ∷ ι ∷ ς ∷ []) "1Tim.1.2"
∷ word (ἔ ∷ ∙λ ∷ ε ∷ ο ∷ ς ∷ []) "1Tim.1.2"
∷ word (ε ∷ ἰ ∷ ρ ∷ ή ∷ ν ∷ η ∷ []) "1Tim.1.2"
∷ word (ἀ ∷ π ∷ ὸ ∷ []) "1Tim.1.2"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.1.2"
∷ word (π ∷ α ∷ τ ∷ ρ ∷ ὸ ∷ ς ∷ []) "1Tim.1.2"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.2"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.1.2"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.1.2"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.1.2"
∷ word (κ ∷ υ ∷ ρ ∷ ί ∷ ο ∷ υ ∷ []) "1Tim.1.2"
∷ word (ἡ ∷ μ ∷ ῶ ∷ ν ∷ []) "1Tim.1.2"
∷ word (Κ ∷ α ∷ θ ∷ ὼ ∷ ς ∷ []) "1Tim.1.3"
∷ word (π ∷ α ∷ ρ ∷ ε ∷ κ ∷ ά ∷ ∙λ ∷ ε ∷ σ ∷ ά ∷ []) "1Tim.1.3"
∷ word (σ ∷ ε ∷ []) "1Tim.1.3"
∷ word (π ∷ ρ ∷ ο ∷ σ ∷ μ ∷ ε ∷ ῖ ∷ ν ∷ α ∷ ι ∷ []) "1Tim.1.3"
∷ word (ἐ ∷ ν ∷ []) "1Tim.1.3"
∷ word (Ἐ ∷ φ ∷ έ ∷ σ ∷ ῳ ∷ []) "1Tim.1.3"
∷ word (π ∷ ο ∷ ρ ∷ ε ∷ υ ∷ ό ∷ μ ∷ ε ∷ ν ∷ ο ∷ ς ∷ []) "1Tim.1.3"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.1.3"
∷ word (Μ ∷ α ∷ κ ∷ ε ∷ δ ∷ ο ∷ ν ∷ ί ∷ α ∷ ν ∷ []) "1Tim.1.3"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.1.3"
∷ word (π ∷ α ∷ ρ ∷ α ∷ γ ∷ γ ∷ ε ∷ ί ∷ ∙λ ∷ ῃ ∷ ς ∷ []) "1Tim.1.3"
∷ word (τ ∷ ι ∷ σ ∷ ὶ ∷ ν ∷ []) "1Tim.1.3"
∷ word (μ ∷ ὴ ∷ []) "1Tim.1.3"
∷ word (ἑ ∷ τ ∷ ε ∷ ρ ∷ ο ∷ δ ∷ ι ∷ δ ∷ α ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.1.3"
∷ word (μ ∷ η ∷ δ ∷ ὲ ∷ []) "1Tim.1.4"
∷ word (π ∷ ρ ∷ ο ∷ σ ∷ έ ∷ χ ∷ ε ∷ ι ∷ ν ∷ []) "1Tim.1.4"
∷ word (μ ∷ ύ ∷ θ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.1.4"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.4"
∷ word (γ ∷ ε ∷ ν ∷ ε ∷ α ∷ ∙λ ∷ ο ∷ γ ∷ ί ∷ α ∷ ι ∷ ς ∷ []) "1Tim.1.4"
∷ word (ἀ ∷ π ∷ ε ∷ ρ ∷ ά ∷ ν ∷ τ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.1.4"
∷ word (α ∷ ἵ ∷ τ ∷ ι ∷ ν ∷ ε ∷ ς ∷ []) "1Tim.1.4"
∷ word (ἐ ∷ κ ∷ ζ ∷ η ∷ τ ∷ ή ∷ σ ∷ ε ∷ ι ∷ ς ∷ []) "1Tim.1.4"
∷ word (π ∷ α ∷ ρ ∷ έ ∷ χ ∷ ο ∷ υ ∷ σ ∷ ι ∷ []) "1Tim.1.4"
∷ word (μ ∷ ᾶ ∷ ∙λ ∷ ∙λ ∷ ο ∷ ν ∷ []) "1Tim.1.4"
∷ word (ἢ ∷ []) "1Tim.1.4"
∷ word (ο ∷ ἰ ∷ κ ∷ ο ∷ ν ∷ ο ∷ μ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.1.4"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.1.4"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.1.4"
∷ word (ἐ ∷ ν ∷ []) "1Tim.1.4"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ι ∷ []) "1Tim.1.4"
∷ word (τ ∷ ὸ ∷ []) "1Tim.1.5"
∷ word (δ ∷ ὲ ∷ []) "1Tim.1.5"
∷ word (τ ∷ έ ∷ ∙λ ∷ ο ∷ ς ∷ []) "1Tim.1.5"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.1.5"
∷ word (π ∷ α ∷ ρ ∷ α ∷ γ ∷ γ ∷ ε ∷ ∙λ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.1.5"
∷ word (ἐ ∷ σ ∷ τ ∷ ὶ ∷ ν ∷ []) "1Tim.1.5"
∷ word (ἀ ∷ γ ∷ ά ∷ π ∷ η ∷ []) "1Tim.1.5"
∷ word (ἐ ∷ κ ∷ []) "1Tim.1.5"
∷ word (κ ∷ α ∷ θ ∷ α ∷ ρ ∷ ᾶ ∷ ς ∷ []) "1Tim.1.5"
∷ word (κ ∷ α ∷ ρ ∷ δ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.1.5"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.5"
∷ word (σ ∷ υ ∷ ν ∷ ε ∷ ι ∷ δ ∷ ή ∷ σ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.1.5"
∷ word (ἀ ∷ γ ∷ α ∷ θ ∷ ῆ ∷ ς ∷ []) "1Tim.1.5"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.5"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.1.5"
∷ word (ἀ ∷ ν ∷ υ ∷ π ∷ ο ∷ κ ∷ ρ ∷ ί ∷ τ ∷ ο ∷ υ ∷ []) "1Tim.1.5"
∷ word (ὧ ∷ ν ∷ []) "1Tim.1.6"
∷ word (τ ∷ ι ∷ ν ∷ ε ∷ ς ∷ []) "1Tim.1.6"
∷ word (ἀ ∷ σ ∷ τ ∷ ο ∷ χ ∷ ή ∷ σ ∷ α ∷ ν ∷ τ ∷ ε ∷ ς ∷ []) "1Tim.1.6"
∷ word (ἐ ∷ ξ ∷ ε ∷ τ ∷ ρ ∷ ά ∷ π ∷ η ∷ σ ∷ α ∷ ν ∷ []) "1Tim.1.6"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.1.6"
∷ word (μ ∷ α ∷ τ ∷ α ∷ ι ∷ ο ∷ ∙λ ∷ ο ∷ γ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.1.6"
∷ word (θ ∷ έ ∷ ∙λ ∷ ο ∷ ν ∷ τ ∷ ε ∷ ς ∷ []) "1Tim.1.7"
∷ word (ε ∷ ἶ ∷ ν ∷ α ∷ ι ∷ []) "1Tim.1.7"
∷ word (ν ∷ ο ∷ μ ∷ ο ∷ δ ∷ ι ∷ δ ∷ ά ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ο ∷ ι ∷ []) "1Tim.1.7"
∷ word (μ ∷ ὴ ∷ []) "1Tim.1.7"
∷ word (ν ∷ ο ∷ ο ∷ ῦ ∷ ν ∷ τ ∷ ε ∷ ς ∷ []) "1Tim.1.7"
∷ word (μ ∷ ή ∷ τ ∷ ε ∷ []) "1Tim.1.7"
∷ word (ἃ ∷ []) "1Tim.1.7"
∷ word (∙λ ∷ έ ∷ γ ∷ ο ∷ υ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.1.7"
∷ word (μ ∷ ή ∷ τ ∷ ε ∷ []) "1Tim.1.7"
∷ word (π ∷ ε ∷ ρ ∷ ὶ ∷ []) "1Tim.1.7"
∷ word (τ ∷ ί ∷ ν ∷ ω ∷ ν ∷ []) "1Tim.1.7"
∷ word (δ ∷ ι ∷ α ∷ β ∷ ε ∷ β ∷ α ∷ ι ∷ ο ∷ ῦ ∷ ν ∷ τ ∷ α ∷ ι ∷ []) "1Tim.1.7"
∷ word (Ο ∷ ἴ ∷ δ ∷ α ∷ μ ∷ ε ∷ ν ∷ []) "1Tim.1.8"
∷ word (δ ∷ ὲ ∷ []) "1Tim.1.8"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.1.8"
∷ word (κ ∷ α ∷ ∙λ ∷ ὸ ∷ ς ∷ []) "1Tim.1.8"
∷ word (ὁ ∷ []) "1Tim.1.8"
∷ word (ν ∷ ό ∷ μ ∷ ο ∷ ς ∷ []) "1Tim.1.8"
∷ word (ἐ ∷ ά ∷ ν ∷ []) "1Tim.1.8"
∷ word (τ ∷ ι ∷ ς ∷ []) "1Tim.1.8"
∷ word (α ∷ ὐ ∷ τ ∷ ῷ ∷ []) "1Tim.1.8"
∷ word (ν ∷ ο ∷ μ ∷ ί ∷ μ ∷ ω ∷ ς ∷ []) "1Tim.1.8"
∷ word (χ ∷ ρ ∷ ῆ ∷ τ ∷ α ∷ ι ∷ []) "1Tim.1.8"
∷ word (ε ∷ ἰ ∷ δ ∷ ὼ ∷ ς ∷ []) "1Tim.1.9"
∷ word (τ ∷ ο ∷ ῦ ∷ τ ∷ ο ∷ []) "1Tim.1.9"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.1.9"
∷ word (δ ∷ ι ∷ κ ∷ α ∷ ί ∷ ῳ ∷ []) "1Tim.1.9"
∷ word (ν ∷ ό ∷ μ ∷ ο ∷ ς ∷ []) "1Tim.1.9"
∷ word (ο ∷ ὐ ∷ []) "1Tim.1.9"
∷ word (κ ∷ ε ∷ ῖ ∷ τ ∷ α ∷ ι ∷ []) "1Tim.1.9"
∷ word (ἀ ∷ ν ∷ ό ∷ μ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.1.9"
∷ word (δ ∷ ὲ ∷ []) "1Tim.1.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.9"
∷ word (ἀ ∷ ν ∷ υ ∷ π ∷ ο ∷ τ ∷ ά ∷ κ ∷ τ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.1.9"
∷ word (ἀ ∷ σ ∷ ε ∷ β ∷ έ ∷ σ ∷ ι ∷ []) "1Tim.1.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.9"
∷ word (ἁ ∷ μ ∷ α ∷ ρ ∷ τ ∷ ω ∷ ∙λ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.1.9"
∷ word (ἀ ∷ ν ∷ ο ∷ σ ∷ ί ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.1.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.9"
∷ word (β ∷ ε ∷ β ∷ ή ∷ ∙λ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.1.9"
∷ word (π ∷ α ∷ τ ∷ ρ ∷ ο ∷ ∙λ ∷ ῴ ∷ α ∷ ι ∷ ς ∷ []) "1Tim.1.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.9"
∷ word (μ ∷ η ∷ τ ∷ ρ ∷ ο ∷ ∙λ ∷ ῴ ∷ α ∷ ι ∷ ς ∷ []) "1Tim.1.9"
∷ word (ἀ ∷ ν ∷ δ ∷ ρ ∷ ο ∷ φ ∷ ό ∷ ν ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.1.9"
∷ word (π ∷ ό ∷ ρ ∷ ν ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.1.10"
∷ word (ἀ ∷ ρ ∷ σ ∷ ε ∷ ν ∷ ο ∷ κ ∷ ο ∷ ί ∷ τ ∷ α ∷ ι ∷ ς ∷ []) "1Tim.1.10"
∷ word (ἀ ∷ ν ∷ δ ∷ ρ ∷ α ∷ π ∷ ο ∷ δ ∷ ι ∷ σ ∷ τ ∷ α ∷ ῖ ∷ ς ∷ []) "1Tim.1.10"
∷ word (ψ ∷ ε ∷ ύ ∷ σ ∷ τ ∷ α ∷ ι ∷ ς ∷ []) "1Tim.1.10"
∷ word (ἐ ∷ π ∷ ι ∷ ό ∷ ρ ∷ κ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.1.10"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.10"
∷ word (ε ∷ ἴ ∷ []) "1Tim.1.10"
∷ word (τ ∷ ι ∷ []) "1Tim.1.10"
∷ word (ἕ ∷ τ ∷ ε ∷ ρ ∷ ο ∷ ν ∷ []) "1Tim.1.10"
∷ word (τ ∷ ῇ ∷ []) "1Tim.1.10"
∷ word (ὑ ∷ γ ∷ ι ∷ α ∷ ι ∷ ν ∷ ο ∷ ύ ∷ σ ∷ ῃ ∷ []) "1Tim.1.10"
∷ word (δ ∷ ι ∷ δ ∷ α ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ί ∷ ᾳ ∷ []) "1Tim.1.10"
∷ word (ἀ ∷ ν ∷ τ ∷ ί ∷ κ ∷ ε ∷ ι ∷ τ ∷ α ∷ ι ∷ []) "1Tim.1.10"
∷ word (κ ∷ α ∷ τ ∷ ὰ ∷ []) "1Tim.1.11"
∷ word (τ ∷ ὸ ∷ []) "1Tim.1.11"
∷ word (ε ∷ ὐ ∷ α ∷ γ ∷ γ ∷ έ ∷ ∙λ ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.1.11"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.1.11"
∷ word (δ ∷ ό ∷ ξ ∷ η ∷ ς ∷ []) "1Tim.1.11"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.1.11"
∷ word (μ ∷ α ∷ κ ∷ α ∷ ρ ∷ ί ∷ ο ∷ υ ∷ []) "1Tim.1.11"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.1.11"
∷ word (ὃ ∷ []) "1Tim.1.11"
∷ word (ἐ ∷ π ∷ ι ∷ σ ∷ τ ∷ ε ∷ ύ ∷ θ ∷ η ∷ ν ∷ []) "1Tim.1.11"
∷ word (ἐ ∷ γ ∷ ώ ∷ []) "1Tim.1.11"
∷ word (Χ ∷ ά ∷ ρ ∷ ι ∷ ν ∷ []) "1Tim.1.12"
∷ word (ἔ ∷ χ ∷ ω ∷ []) "1Tim.1.12"
∷ word (τ ∷ ῷ ∷ []) "1Tim.1.12"
∷ word (ἐ ∷ ν ∷ δ ∷ υ ∷ ν ∷ α ∷ μ ∷ ώ ∷ σ ∷ α ∷ ν ∷ τ ∷ ί ∷ []) "1Tim.1.12"
∷ word (μ ∷ ε ∷ []) "1Tim.1.12"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ῷ ∷ []) "1Tim.1.12"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.1.12"
∷ word (τ ∷ ῷ ∷ []) "1Tim.1.12"
∷ word (κ ∷ υ ∷ ρ ∷ ί ∷ ῳ ∷ []) "1Tim.1.12"
∷ word (ἡ ∷ μ ∷ ῶ ∷ ν ∷ []) "1Tim.1.12"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.1.12"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ό ∷ ν ∷ []) "1Tim.1.12"
∷ word (μ ∷ ε ∷ []) "1Tim.1.12"
∷ word (ἡ ∷ γ ∷ ή ∷ σ ∷ α ∷ τ ∷ ο ∷ []) "1Tim.1.12"
∷ word (θ ∷ έ ∷ μ ∷ ε ∷ ν ∷ ο ∷ ς ∷ []) "1Tim.1.12"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.1.12"
∷ word (δ ∷ ι ∷ α ∷ κ ∷ ο ∷ ν ∷ ί ∷ α ∷ ν ∷ []) "1Tim.1.12"
∷ word (τ ∷ ὸ ∷ []) "1Tim.1.13"
∷ word (π ∷ ρ ∷ ό ∷ τ ∷ ε ∷ ρ ∷ ο ∷ ν ∷ []) "1Tim.1.13"
∷ word (ὄ ∷ ν ∷ τ ∷ α ∷ []) "1Tim.1.13"
∷ word (β ∷ ∙λ ∷ ά ∷ σ ∷ φ ∷ η ∷ μ ∷ ο ∷ ν ∷ []) "1Tim.1.13"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.13"
∷ word (δ ∷ ι ∷ ώ ∷ κ ∷ τ ∷ η ∷ ν ∷ []) "1Tim.1.13"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.13"
∷ word (ὑ ∷ β ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ή ∷ ν ∷ []) "1Tim.1.13"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ ὰ ∷ []) "1Tim.1.13"
∷ word (ἠ ∷ ∙λ ∷ ε ∷ ή ∷ θ ∷ η ∷ ν ∷ []) "1Tim.1.13"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.1.13"
∷ word (ἀ ∷ γ ∷ ν ∷ ο ∷ ῶ ∷ ν ∷ []) "1Tim.1.13"
∷ word (ἐ ∷ π ∷ ο ∷ ί ∷ η ∷ σ ∷ α ∷ []) "1Tim.1.13"
∷ word (ἐ ∷ ν ∷ []) "1Tim.1.13"
∷ word (ἀ ∷ π ∷ ι ∷ σ ∷ τ ∷ ί ∷ ᾳ ∷ []) "1Tim.1.13"
∷ word (ὑ ∷ π ∷ ε ∷ ρ ∷ ε ∷ π ∷ ∙λ ∷ ε ∷ ό ∷ ν ∷ α ∷ σ ∷ ε ∷ ν ∷ []) "1Tim.1.14"
∷ word (δ ∷ ὲ ∷ []) "1Tim.1.14"
∷ word (ἡ ∷ []) "1Tim.1.14"
∷ word (χ ∷ ά ∷ ρ ∷ ι ∷ ς ∷ []) "1Tim.1.14"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.1.14"
∷ word (κ ∷ υ ∷ ρ ∷ ί ∷ ο ∷ υ ∷ []) "1Tim.1.14"
∷ word (ἡ ∷ μ ∷ ῶ ∷ ν ∷ []) "1Tim.1.14"
∷ word (μ ∷ ε ∷ τ ∷ ὰ ∷ []) "1Tim.1.14"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.1.14"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.14"
∷ word (ἀ ∷ γ ∷ ά ∷ π ∷ η ∷ ς ∷ []) "1Tim.1.14"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.1.14"
∷ word (ἐ ∷ ν ∷ []) "1Tim.1.14"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ῷ ∷ []) "1Tim.1.14"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.1.14"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ὸ ∷ ς ∷ []) "1Tim.1.15"
∷ word (ὁ ∷ []) "1Tim.1.15"
∷ word (∙λ ∷ ό ∷ γ ∷ ο ∷ ς ∷ []) "1Tim.1.15"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.15"
∷ word (π ∷ ά ∷ σ ∷ η ∷ ς ∷ []) "1Tim.1.15"
∷ word (ἀ ∷ π ∷ ο ∷ δ ∷ ο ∷ χ ∷ ῆ ∷ ς ∷ []) "1Tim.1.15"
∷ word (ἄ ∷ ξ ∷ ι ∷ ο ∷ ς ∷ []) "1Tim.1.15"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.1.15"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ὸ ∷ ς ∷ []) "1Tim.1.15"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ ς ∷ []) "1Tim.1.15"
∷ word (ἦ ∷ ∙λ ∷ θ ∷ ε ∷ ν ∷ []) "1Tim.1.15"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.1.15"
∷ word (τ ∷ ὸ ∷ ν ∷ []) "1Tim.1.15"
∷ word (κ ∷ ό ∷ σ ∷ μ ∷ ο ∷ ν ∷ []) "1Tim.1.15"
∷ word (ἁ ∷ μ ∷ α ∷ ρ ∷ τ ∷ ω ∷ ∙λ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.1.15"
∷ word (σ ∷ ῶ ∷ σ ∷ α ∷ ι ∷ []) "1Tim.1.15"
∷ word (ὧ ∷ ν ∷ []) "1Tim.1.15"
∷ word (π ∷ ρ ∷ ῶ ∷ τ ∷ ό ∷ ς ∷ []) "1Tim.1.15"
∷ word (ε ∷ ἰ ∷ μ ∷ ι ∷ []) "1Tim.1.15"
∷ word (ἐ ∷ γ ∷ ώ ∷ []) "1Tim.1.15"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ ὰ ∷ []) "1Tim.1.16"
∷ word (δ ∷ ι ∷ ὰ ∷ []) "1Tim.1.16"
∷ word (τ ∷ ο ∷ ῦ ∷ τ ∷ ο ∷ []) "1Tim.1.16"
∷ word (ἠ ∷ ∙λ ∷ ε ∷ ή ∷ θ ∷ η ∷ ν ∷ []) "1Tim.1.16"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.1.16"
∷ word (ἐ ∷ ν ∷ []) "1Tim.1.16"
∷ word (ἐ ∷ μ ∷ ο ∷ ὶ ∷ []) "1Tim.1.16"
∷ word (π ∷ ρ ∷ ώ ∷ τ ∷ ῳ ∷ []) "1Tim.1.16"
∷ word (ἐ ∷ ν ∷ δ ∷ ε ∷ ί ∷ ξ ∷ η ∷ τ ∷ α ∷ ι ∷ []) "1Tim.1.16"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ὸ ∷ ς ∷ []) "1Tim.1.16"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ ς ∷ []) "1Tim.1.16"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.1.16"
∷ word (ἅ ∷ π ∷ α ∷ σ ∷ α ∷ ν ∷ []) "1Tim.1.16"
∷ word (μ ∷ α ∷ κ ∷ ρ ∷ ο ∷ θ ∷ υ ∷ μ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.1.16"
∷ word (π ∷ ρ ∷ ὸ ∷ ς ∷ []) "1Tim.1.16"
∷ word (ὑ ∷ π ∷ ο ∷ τ ∷ ύ ∷ π ∷ ω ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.1.16"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.1.16"
∷ word (μ ∷ ε ∷ ∙λ ∷ ∙λ ∷ ό ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.1.16"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ε ∷ ύ ∷ ε ∷ ι ∷ ν ∷ []) "1Tim.1.16"
∷ word (ἐ ∷ π ∷ []) "1Tim.1.16"
∷ word (α ∷ ὐ ∷ τ ∷ ῷ ∷ []) "1Tim.1.16"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.1.16"
∷ word (ζ ∷ ω ∷ ὴ ∷ ν ∷ []) "1Tim.1.16"
∷ word (α ∷ ἰ ∷ ώ ∷ ν ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.1.16"
∷ word (τ ∷ ῷ ∷ []) "1Tim.1.17"
∷ word (δ ∷ ὲ ∷ []) "1Tim.1.17"
∷ word (β ∷ α ∷ σ ∷ ι ∷ ∙λ ∷ ε ∷ ῖ ∷ []) "1Tim.1.17"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.1.17"
∷ word (α ∷ ἰ ∷ ώ ∷ ν ∷ ω ∷ ν ∷ []) "1Tim.1.17"
∷ word (ἀ ∷ φ ∷ θ ∷ ά ∷ ρ ∷ τ ∷ ῳ ∷ []) "1Tim.1.17"
∷ word (ἀ ∷ ο ∷ ρ ∷ ά ∷ τ ∷ ῳ ∷ []) "1Tim.1.17"
∷ word (μ ∷ ό ∷ ν ∷ ῳ ∷ []) "1Tim.1.17"
∷ word (θ ∷ ε ∷ ῷ ∷ []) "1Tim.1.17"
∷ word (τ ∷ ι ∷ μ ∷ ὴ ∷ []) "1Tim.1.17"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.17"
∷ word (δ ∷ ό ∷ ξ ∷ α ∷ []) "1Tim.1.17"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.1.17"
∷ word (τ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.1.17"
∷ word (α ∷ ἰ ∷ ῶ ∷ ν ∷ α ∷ ς ∷ []) "1Tim.1.17"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.1.17"
∷ word (α ∷ ἰ ∷ ώ ∷ ν ∷ ω ∷ ν ∷ []) "1Tim.1.17"
∷ word (ἀ ∷ μ ∷ ή ∷ ν ∷ []) "1Tim.1.17"
∷ word (Τ ∷ α ∷ ύ ∷ τ ∷ η ∷ ν ∷ []) "1Tim.1.18"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.1.18"
∷ word (π ∷ α ∷ ρ ∷ α ∷ γ ∷ γ ∷ ε ∷ ∙λ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.1.18"
∷ word (π ∷ α ∷ ρ ∷ α ∷ τ ∷ ί ∷ θ ∷ ε ∷ μ ∷ α ∷ ί ∷ []) "1Tim.1.18"
∷ word (σ ∷ ο ∷ ι ∷ []) "1Tim.1.18"
∷ word (τ ∷ έ ∷ κ ∷ ν ∷ ο ∷ ν ∷ []) "1Tim.1.18"
∷ word (Τ ∷ ι ∷ μ ∷ ό ∷ θ ∷ ε ∷ ε ∷ []) "1Tim.1.18"
∷ word (κ ∷ α ∷ τ ∷ ὰ ∷ []) "1Tim.1.18"
∷ word (τ ∷ ὰ ∷ ς ∷ []) "1Tim.1.18"
∷ word (π ∷ ρ ∷ ο ∷ α ∷ γ ∷ ο ∷ ύ ∷ σ ∷ α ∷ ς ∷ []) "1Tim.1.18"
∷ word (ἐ ∷ π ∷ ὶ ∷ []) "1Tim.1.18"
∷ word (σ ∷ ὲ ∷ []) "1Tim.1.18"
∷ word (π ∷ ρ ∷ ο ∷ φ ∷ η ∷ τ ∷ ε ∷ ί ∷ α ∷ ς ∷ []) "1Tim.1.18"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.1.18"
∷ word (σ ∷ τ ∷ ρ ∷ α ∷ τ ∷ ε ∷ ύ ∷ ῃ ∷ []) "1Tim.1.18"
∷ word (ἐ ∷ ν ∷ []) "1Tim.1.18"
∷ word (α ∷ ὐ ∷ τ ∷ α ∷ ῖ ∷ ς ∷ []) "1Tim.1.18"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.1.18"
∷ word (κ ∷ α ∷ ∙λ ∷ ὴ ∷ ν ∷ []) "1Tim.1.18"
∷ word (σ ∷ τ ∷ ρ ∷ α ∷ τ ∷ ε ∷ ί ∷ α ∷ ν ∷ []) "1Tim.1.18"
∷ word (ἔ ∷ χ ∷ ω ∷ ν ∷ []) "1Tim.1.19"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.1.19"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.19"
∷ word (ἀ ∷ γ ∷ α ∷ θ ∷ ὴ ∷ ν ∷ []) "1Tim.1.19"
∷ word (σ ∷ υ ∷ ν ∷ ε ∷ ί ∷ δ ∷ η ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.1.19"
∷ word (ἥ ∷ ν ∷ []) "1Tim.1.19"
∷ word (τ ∷ ι ∷ ν ∷ ε ∷ ς ∷ []) "1Tim.1.19"
∷ word (ἀ ∷ π ∷ ω ∷ σ ∷ ά ∷ μ ∷ ε ∷ ν ∷ ο ∷ ι ∷ []) "1Tim.1.19"
∷ word (π ∷ ε ∷ ρ ∷ ὶ ∷ []) "1Tim.1.19"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.1.19"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.1.19"
∷ word (ἐ ∷ ν ∷ α ∷ υ ∷ ά ∷ γ ∷ η ∷ σ ∷ α ∷ ν ∷ []) "1Tim.1.19"
∷ word (ὧ ∷ ν ∷ []) "1Tim.1.20"
∷ word (ἐ ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.1.20"
∷ word (Ὑ ∷ μ ∷ έ ∷ ν ∷ α ∷ ι ∷ ο ∷ ς ∷ []) "1Tim.1.20"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.1.20"
∷ word (Ἀ ∷ ∙λ ∷ έ ∷ ξ ∷ α ∷ ν ∷ δ ∷ ρ ∷ ο ∷ ς ∷ []) "1Tim.1.20"
∷ word (ο ∷ ὓ ∷ ς ∷ []) "1Tim.1.20"
∷ word (π ∷ α ∷ ρ ∷ έ ∷ δ ∷ ω ∷ κ ∷ α ∷ []) "1Tim.1.20"
∷ word (τ ∷ ῷ ∷ []) "1Tim.1.20"
∷ word (Σ ∷ α ∷ τ ∷ α ∷ ν ∷ ᾷ ∷ []) "1Tim.1.20"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.1.20"
∷ word (π ∷ α ∷ ι ∷ δ ∷ ε ∷ υ ∷ θ ∷ ῶ ∷ σ ∷ ι ∷ []) "1Tim.1.20"
∷ word (μ ∷ ὴ ∷ []) "1Tim.1.20"
∷ word (β ∷ ∙λ ∷ α ∷ σ ∷ φ ∷ η ∷ μ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.1.20"
∷ word (Π ∷ α ∷ ρ ∷ α ∷ κ ∷ α ∷ ∙λ ∷ ῶ ∷ []) "1Tim.2.1"
∷ word (ο ∷ ὖ ∷ ν ∷ []) "1Tim.2.1"
∷ word (π ∷ ρ ∷ ῶ ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.2.1"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.2.1"
∷ word (π ∷ ο ∷ ι ∷ ε ∷ ῖ ∷ σ ∷ θ ∷ α ∷ ι ∷ []) "1Tim.2.1"
∷ word (δ ∷ ε ∷ ή ∷ σ ∷ ε ∷ ι ∷ ς ∷ []) "1Tim.2.1"
∷ word (π ∷ ρ ∷ ο ∷ σ ∷ ε ∷ υ ∷ χ ∷ ά ∷ ς ∷ []) "1Tim.2.1"
∷ word (ἐ ∷ ν ∷ τ ∷ ε ∷ ύ ∷ ξ ∷ ε ∷ ι ∷ ς ∷ []) "1Tim.2.1"
∷ word (ε ∷ ὐ ∷ χ ∷ α ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.2.1"
∷ word (ὑ ∷ π ∷ ὲ ∷ ρ ∷ []) "1Tim.2.1"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.2.1"
∷ word (ἀ ∷ ν ∷ θ ∷ ρ ∷ ώ ∷ π ∷ ω ∷ ν ∷ []) "1Tim.2.1"
∷ word (ὑ ∷ π ∷ ὲ ∷ ρ ∷ []) "1Tim.2.2"
∷ word (β ∷ α ∷ σ ∷ ι ∷ ∙λ ∷ έ ∷ ω ∷ ν ∷ []) "1Tim.2.2"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.2"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.2.2"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.2.2"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.2"
∷ word (ὑ ∷ π ∷ ε ∷ ρ ∷ ο ∷ χ ∷ ῇ ∷ []) "1Tim.2.2"
∷ word (ὄ ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.2.2"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.2.2"
∷ word (ἤ ∷ ρ ∷ ε ∷ μ ∷ ο ∷ ν ∷ []) "1Tim.2.2"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.2"
∷ word (ἡ ∷ σ ∷ ύ ∷ χ ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.2.2"
∷ word (β ∷ ί ∷ ο ∷ ν ∷ []) "1Tim.2.2"
∷ word (δ ∷ ι ∷ ά ∷ γ ∷ ω ∷ μ ∷ ε ∷ ν ∷ []) "1Tim.2.2"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.2"
∷ word (π ∷ ά ∷ σ ∷ ῃ ∷ []) "1Tim.2.2"
∷ word (ε ∷ ὐ ∷ σ ∷ ε ∷ β ∷ ε ∷ ί ∷ ᾳ ∷ []) "1Tim.2.2"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.2"
∷ word (σ ∷ ε ∷ μ ∷ ν ∷ ό ∷ τ ∷ η ∷ τ ∷ ι ∷ []) "1Tim.2.2"
∷ word (τ ∷ ο ∷ ῦ ∷ τ ∷ ο ∷ []) "1Tim.2.3"
∷ word (κ ∷ α ∷ ∙λ ∷ ὸ ∷ ν ∷ []) "1Tim.2.3"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.3"
∷ word (ἀ ∷ π ∷ ό ∷ δ ∷ ε ∷ κ ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.2.3"
∷ word (ἐ ∷ ν ∷ ώ ∷ π ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.2.3"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.2.3"
∷ word (σ ∷ ω ∷ τ ∷ ῆ ∷ ρ ∷ ο ∷ ς ∷ []) "1Tim.2.3"
∷ word (ἡ ∷ μ ∷ ῶ ∷ ν ∷ []) "1Tim.2.3"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.2.3"
∷ word (ὃ ∷ ς ∷ []) "1Tim.2.4"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ α ∷ ς ∷ []) "1Tim.2.4"
∷ word (ἀ ∷ ν ∷ θ ∷ ρ ∷ ώ ∷ π ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.2.4"
∷ word (θ ∷ έ ∷ ∙λ ∷ ε ∷ ι ∷ []) "1Tim.2.4"
∷ word (σ ∷ ω ∷ θ ∷ ῆ ∷ ν ∷ α ∷ ι ∷ []) "1Tim.2.4"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.4"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.2.4"
∷ word (ἐ ∷ π ∷ ί ∷ γ ∷ ν ∷ ω ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.2.4"
∷ word (ἀ ∷ ∙λ ∷ η ∷ θ ∷ ε ∷ ί ∷ α ∷ ς ∷ []) "1Tim.2.4"
∷ word (ἐ ∷ ∙λ ∷ θ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.2.4"
∷ word (ε ∷ ἷ ∷ ς ∷ []) "1Tim.2.5"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.2.5"
∷ word (θ ∷ ε ∷ ό ∷ ς ∷ []) "1Tim.2.5"
∷ word (ε ∷ ἷ ∷ ς ∷ []) "1Tim.2.5"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.5"
∷ word (μ ∷ ε ∷ σ ∷ ί ∷ τ ∷ η ∷ ς ∷ []) "1Tim.2.5"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.2.5"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.5"
∷ word (ἀ ∷ ν ∷ θ ∷ ρ ∷ ώ ∷ π ∷ ω ∷ ν ∷ []) "1Tim.2.5"
∷ word (ἄ ∷ ν ∷ θ ∷ ρ ∷ ω ∷ π ∷ ο ∷ ς ∷ []) "1Tim.2.5"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ὸ ∷ ς ∷ []) "1Tim.2.5"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ ς ∷ []) "1Tim.2.5"
∷ word (ὁ ∷ []) "1Tim.2.6"
∷ word (δ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.2.6"
∷ word (ἑ ∷ α ∷ υ ∷ τ ∷ ὸ ∷ ν ∷ []) "1Tim.2.6"
∷ word (ἀ ∷ ν ∷ τ ∷ ί ∷ ∙λ ∷ υ ∷ τ ∷ ρ ∷ ο ∷ ν ∷ []) "1Tim.2.6"
∷ word (ὑ ∷ π ∷ ὲ ∷ ρ ∷ []) "1Tim.2.6"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.2.6"
∷ word (τ ∷ ὸ ∷ []) "1Tim.2.6"
∷ word (μ ∷ α ∷ ρ ∷ τ ∷ ύ ∷ ρ ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.2.6"
∷ word (κ ∷ α ∷ ι ∷ ρ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.2.6"
∷ word (ἰ ∷ δ ∷ ί ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.2.6"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.2.7"
∷ word (ὃ ∷ []) "1Tim.2.7"
∷ word (ἐ ∷ τ ∷ έ ∷ θ ∷ η ∷ ν ∷ []) "1Tim.2.7"
∷ word (ἐ ∷ γ ∷ ὼ ∷ []) "1Tim.2.7"
∷ word (κ ∷ ῆ ∷ ρ ∷ υ ∷ ξ ∷ []) "1Tim.2.7"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.7"
∷ word (ἀ ∷ π ∷ ό ∷ σ ∷ τ ∷ ο ∷ ∙λ ∷ ο ∷ ς ∷ []) "1Tim.2.7"
∷ word (ἀ ∷ ∙λ ∷ ή ∷ θ ∷ ε ∷ ι ∷ α ∷ ν ∷ []) "1Tim.2.7"
∷ word (∙λ ∷ έ ∷ γ ∷ ω ∷ []) "1Tim.2.7"
∷ word (ο ∷ ὐ ∷ []) "1Tim.2.7"
∷ word (ψ ∷ ε ∷ ύ ∷ δ ∷ ο ∷ μ ∷ α ∷ ι ∷ []) "1Tim.2.7"
∷ word (δ ∷ ι ∷ δ ∷ ά ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ο ∷ ς ∷ []) "1Tim.2.7"
∷ word (ἐ ∷ θ ∷ ν ∷ ῶ ∷ ν ∷ []) "1Tim.2.7"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.7"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ι ∷ []) "1Tim.2.7"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.7"
∷ word (ἀ ∷ ∙λ ∷ η ∷ θ ∷ ε ∷ ί ∷ ᾳ ∷ []) "1Tim.2.7"
∷ word (Β ∷ ο ∷ ύ ∷ ∙λ ∷ ο ∷ μ ∷ α ∷ ι ∷ []) "1Tim.2.8"
∷ word (ο ∷ ὖ ∷ ν ∷ []) "1Tim.2.8"
∷ word (π ∷ ρ ∷ ο ∷ σ ∷ ε ∷ ύ ∷ χ ∷ ε ∷ σ ∷ θ ∷ α ∷ ι ∷ []) "1Tim.2.8"
∷ word (τ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.2.8"
∷ word (ἄ ∷ ν ∷ δ ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.2.8"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.8"
∷ word (π ∷ α ∷ ν ∷ τ ∷ ὶ ∷ []) "1Tim.2.8"
∷ word (τ ∷ ό ∷ π ∷ ῳ ∷ []) "1Tim.2.8"
∷ word (ἐ ∷ π ∷ α ∷ ί ∷ ρ ∷ ο ∷ ν ∷ τ ∷ α ∷ ς ∷ []) "1Tim.2.8"
∷ word (ὁ ∷ σ ∷ ί ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.2.8"
∷ word (χ ∷ ε ∷ ῖ ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.2.8"
∷ word (χ ∷ ω ∷ ρ ∷ ὶ ∷ ς ∷ []) "1Tim.2.8"
∷ word (ὀ ∷ ρ ∷ γ ∷ ῆ ∷ ς ∷ []) "1Tim.2.8"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.8"
∷ word (δ ∷ ι ∷ α ∷ ∙λ ∷ ο ∷ γ ∷ ι ∷ σ ∷ μ ∷ ο ∷ ῦ ∷ []) "1Tim.2.8"
∷ word (ὡ ∷ σ ∷ α ∷ ύ ∷ τ ∷ ω ∷ ς ∷ []) "1Tim.2.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.9"
∷ word (γ ∷ υ ∷ ν ∷ α ∷ ῖ ∷ κ ∷ α ∷ ς ∷ []) "1Tim.2.9"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.9"
∷ word (κ ∷ α ∷ τ ∷ α ∷ σ ∷ τ ∷ ο ∷ ∙λ ∷ ῇ ∷ []) "1Tim.2.9"
∷ word (κ ∷ ο ∷ σ ∷ μ ∷ ί ∷ ῳ ∷ []) "1Tim.2.9"
∷ word (μ ∷ ε ∷ τ ∷ ὰ ∷ []) "1Tim.2.9"
∷ word (α ∷ ἰ ∷ δ ∷ ο ∷ ῦ ∷ ς ∷ []) "1Tim.2.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.9"
∷ word (σ ∷ ω ∷ φ ∷ ρ ∷ ο ∷ σ ∷ ύ ∷ ν ∷ η ∷ ς ∷ []) "1Tim.2.9"
∷ word (κ ∷ ο ∷ σ ∷ μ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.2.9"
∷ word (ἑ ∷ α ∷ υ ∷ τ ∷ ά ∷ ς ∷ []) "1Tim.2.9"
∷ word (μ ∷ ὴ ∷ []) "1Tim.2.9"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.9"
∷ word (π ∷ ∙λ ∷ έ ∷ γ ∷ μ ∷ α ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.2.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.9"
∷ word (χ ∷ ρ ∷ υ ∷ σ ∷ ί ∷ ῳ ∷ []) "1Tim.2.9"
∷ word (ἢ ∷ []) "1Tim.2.9"
∷ word (μ ∷ α ∷ ρ ∷ γ ∷ α ∷ ρ ∷ ί ∷ τ ∷ α ∷ ι ∷ ς ∷ []) "1Tim.2.9"
∷ word (ἢ ∷ []) "1Tim.2.9"
∷ word (ἱ ∷ μ ∷ α ∷ τ ∷ ι ∷ σ ∷ μ ∷ ῷ ∷ []) "1Tim.2.9"
∷ word (π ∷ ο ∷ ∙λ ∷ υ ∷ τ ∷ ε ∷ ∙λ ∷ ε ∷ ῖ ∷ []) "1Tim.2.9"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ []) "1Tim.2.10"
∷ word (ὃ ∷ []) "1Tim.2.10"
∷ word (π ∷ ρ ∷ έ ∷ π ∷ ε ∷ ι ∷ []) "1Tim.2.10"
∷ word (γ ∷ υ ∷ ν ∷ α ∷ ι ∷ ξ ∷ ὶ ∷ ν ∷ []) "1Tim.2.10"
∷ word (ἐ ∷ π ∷ α ∷ γ ∷ γ ∷ ε ∷ ∙λ ∷ ∙λ ∷ ο ∷ μ ∷ έ ∷ ν ∷ α ∷ ι ∷ ς ∷ []) "1Tim.2.10"
∷ word (θ ∷ ε ∷ ο ∷ σ ∷ έ ∷ β ∷ ε ∷ ι ∷ α ∷ ν ∷ []) "1Tim.2.10"
∷ word (δ ∷ ι ∷ []) "1Tim.2.10"
∷ word (ἔ ∷ ρ ∷ γ ∷ ω ∷ ν ∷ []) "1Tim.2.10"
∷ word (ἀ ∷ γ ∷ α ∷ θ ∷ ῶ ∷ ν ∷ []) "1Tim.2.10"
∷ word (γ ∷ υ ∷ ν ∷ ὴ ∷ []) "1Tim.2.11"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.11"
∷ word (ἡ ∷ σ ∷ υ ∷ χ ∷ ί ∷ ᾳ ∷ []) "1Tim.2.11"
∷ word (μ ∷ α ∷ ν ∷ θ ∷ α ∷ ν ∷ έ ∷ τ ∷ ω ∷ []) "1Tim.2.11"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.11"
∷ word (π ∷ ά ∷ σ ∷ ῃ ∷ []) "1Tim.2.11"
∷ word (ὑ ∷ π ∷ ο ∷ τ ∷ α ∷ γ ∷ ῇ ∷ []) "1Tim.2.11"
∷ word (δ ∷ ι ∷ δ ∷ ά ∷ σ ∷ κ ∷ ε ∷ ι ∷ ν ∷ []) "1Tim.2.12"
∷ word (δ ∷ ὲ ∷ []) "1Tim.2.12"
∷ word (γ ∷ υ ∷ ν ∷ α ∷ ι ∷ κ ∷ ὶ ∷ []) "1Tim.2.12"
∷ word (ο ∷ ὐ ∷ κ ∷ []) "1Tim.2.12"
∷ word (ἐ ∷ π ∷ ι ∷ τ ∷ ρ ∷ έ ∷ π ∷ ω ∷ []) "1Tim.2.12"
∷ word (ο ∷ ὐ ∷ δ ∷ ὲ ∷ []) "1Tim.2.12"
∷ word (α ∷ ὐ ∷ θ ∷ ε ∷ ν ∷ τ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.2.12"
∷ word (ἀ ∷ ν ∷ δ ∷ ρ ∷ ό ∷ ς ∷ []) "1Tim.2.12"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ []) "1Tim.2.12"
∷ word (ε ∷ ἶ ∷ ν ∷ α ∷ ι ∷ []) "1Tim.2.12"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.12"
∷ word (ἡ ∷ σ ∷ υ ∷ χ ∷ ί ∷ ᾳ ∷ []) "1Tim.2.12"
∷ word (Ἀ ∷ δ ∷ ὰ ∷ μ ∷ []) "1Tim.2.13"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.2.13"
∷ word (π ∷ ρ ∷ ῶ ∷ τ ∷ ο ∷ ς ∷ []) "1Tim.2.13"
∷ word (ἐ ∷ π ∷ ∙λ ∷ ά ∷ σ ∷ θ ∷ η ∷ []) "1Tim.2.13"
∷ word (ε ∷ ἶ ∷ τ ∷ α ∷ []) "1Tim.2.13"
∷ word (Ε ∷ ὕ ∷ α ∷ []) "1Tim.2.13"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.14"
∷ word (Ἀ ∷ δ ∷ ὰ ∷ μ ∷ []) "1Tim.2.14"
∷ word (ο ∷ ὐ ∷ κ ∷ []) "1Tim.2.14"
∷ word (ἠ ∷ π ∷ α ∷ τ ∷ ή ∷ θ ∷ η ∷ []) "1Tim.2.14"
∷ word (ἡ ∷ []) "1Tim.2.14"
∷ word (δ ∷ ὲ ∷ []) "1Tim.2.14"
∷ word (γ ∷ υ ∷ ν ∷ ὴ ∷ []) "1Tim.2.14"
∷ word (ἐ ∷ ξ ∷ α ∷ π ∷ α ∷ τ ∷ η ∷ θ ∷ ε ∷ ῖ ∷ σ ∷ α ∷ []) "1Tim.2.14"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.14"
∷ word (π ∷ α ∷ ρ ∷ α ∷ β ∷ ά ∷ σ ∷ ε ∷ ι ∷ []) "1Tim.2.14"
∷ word (γ ∷ έ ∷ γ ∷ ο ∷ ν ∷ ε ∷ ν ∷ []) "1Tim.2.14"
∷ word (σ ∷ ω ∷ θ ∷ ή ∷ σ ∷ ε ∷ τ ∷ α ∷ ι ∷ []) "1Tim.2.15"
∷ word (δ ∷ ὲ ∷ []) "1Tim.2.15"
∷ word (δ ∷ ι ∷ ὰ ∷ []) "1Tim.2.15"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.2.15"
∷ word (τ ∷ ε ∷ κ ∷ ν ∷ ο ∷ γ ∷ ο ∷ ν ∷ ί ∷ α ∷ ς ∷ []) "1Tim.2.15"
∷ word (ἐ ∷ ὰ ∷ ν ∷ []) "1Tim.2.15"
∷ word (μ ∷ ε ∷ ί ∷ ν ∷ ω ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.2.15"
∷ word (ἐ ∷ ν ∷ []) "1Tim.2.15"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ι ∷ []) "1Tim.2.15"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.15"
∷ word (ἀ ∷ γ ∷ ά ∷ π ∷ ῃ ∷ []) "1Tim.2.15"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.2.15"
∷ word (ἁ ∷ γ ∷ ι ∷ α ∷ σ ∷ μ ∷ ῷ ∷ []) "1Tim.2.15"
∷ word (μ ∷ ε ∷ τ ∷ ὰ ∷ []) "1Tim.2.15"
∷ word (σ ∷ ω ∷ φ ∷ ρ ∷ ο ∷ σ ∷ ύ ∷ ν ∷ η ∷ ς ∷ []) "1Tim.2.15"
∷ word (Π ∷ ι ∷ σ ∷ τ ∷ ὸ ∷ ς ∷ []) "1Tim.3.1"
∷ word (ὁ ∷ []) "1Tim.3.1"
∷ word (∙λ ∷ ό ∷ γ ∷ ο ∷ ς ∷ []) "1Tim.3.1"
∷ word (ε ∷ ἴ ∷ []) "1Tim.3.1"
∷ word (τ ∷ ι ∷ ς ∷ []) "1Tim.3.1"
∷ word (ἐ ∷ π ∷ ι ∷ σ ∷ κ ∷ ο ∷ π ∷ ῆ ∷ ς ∷ []) "1Tim.3.1"
∷ word (ὀ ∷ ρ ∷ έ ∷ γ ∷ ε ∷ τ ∷ α ∷ ι ∷ []) "1Tim.3.1"
∷ word (κ ∷ α ∷ ∙λ ∷ ο ∷ ῦ ∷ []) "1Tim.3.1"
∷ word (ἔ ∷ ρ ∷ γ ∷ ο ∷ υ ∷ []) "1Tim.3.1"
∷ word (ἐ ∷ π ∷ ι ∷ θ ∷ υ ∷ μ ∷ ε ∷ ῖ ∷ []) "1Tim.3.1"
∷ word (δ ∷ ε ∷ ῖ ∷ []) "1Tim.3.2"
∷ word (ο ∷ ὖ ∷ ν ∷ []) "1Tim.3.2"
∷ word (τ ∷ ὸ ∷ ν ∷ []) "1Tim.3.2"
∷ word (ἐ ∷ π ∷ ί ∷ σ ∷ κ ∷ ο ∷ π ∷ ο ∷ ν ∷ []) "1Tim.3.2"
∷ word (ἀ ∷ ν ∷ ε ∷ π ∷ ί ∷ ∙λ ∷ η ∷ μ ∷ π ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.3.2"
∷ word (ε ∷ ἶ ∷ ν ∷ α ∷ ι ∷ []) "1Tim.3.2"
∷ word (μ ∷ ι ∷ ᾶ ∷ ς ∷ []) "1Tim.3.2"
∷ word (γ ∷ υ ∷ ν ∷ α ∷ ι ∷ κ ∷ ὸ ∷ ς ∷ []) "1Tim.3.2"
∷ word (ἄ ∷ ν ∷ δ ∷ ρ ∷ α ∷ []) "1Tim.3.2"
∷ word (ν ∷ η ∷ φ ∷ ά ∷ ∙λ ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.3.2"
∷ word (σ ∷ ώ ∷ φ ∷ ρ ∷ ο ∷ ν ∷ α ∷ []) "1Tim.3.2"
∷ word (κ ∷ ό ∷ σ ∷ μ ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.3.2"
∷ word (φ ∷ ι ∷ ∙λ ∷ ό ∷ ξ ∷ ε ∷ ν ∷ ο ∷ ν ∷ []) "1Tim.3.2"
∷ word (δ ∷ ι ∷ δ ∷ α ∷ κ ∷ τ ∷ ι ∷ κ ∷ ό ∷ ν ∷ []) "1Tim.3.2"
∷ word (μ ∷ ὴ ∷ []) "1Tim.3.3"
∷ word (π ∷ ά ∷ ρ ∷ ο ∷ ι ∷ ν ∷ ο ∷ ν ∷ []) "1Tim.3.3"
∷ word (μ ∷ ὴ ∷ []) "1Tim.3.3"
∷ word (π ∷ ∙λ ∷ ή ∷ κ ∷ τ ∷ η ∷ ν ∷ []) "1Tim.3.3"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ ὰ ∷ []) "1Tim.3.3"
∷ word (ἐ ∷ π ∷ ι ∷ ε ∷ ι ∷ κ ∷ ῆ ∷ []) "1Tim.3.3"
∷ word (ἄ ∷ μ ∷ α ∷ χ ∷ ο ∷ ν ∷ []) "1Tim.3.3"
∷ word (ἀ ∷ φ ∷ ι ∷ ∙λ ∷ ά ∷ ρ ∷ γ ∷ υ ∷ ρ ∷ ο ∷ ν ∷ []) "1Tim.3.3"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.3.4"
∷ word (ἰ ∷ δ ∷ ί ∷ ο ∷ υ ∷ []) "1Tim.3.4"
∷ word (ο ∷ ἴ ∷ κ ∷ ο ∷ υ ∷ []) "1Tim.3.4"
∷ word (κ ∷ α ∷ ∙λ ∷ ῶ ∷ ς ∷ []) "1Tim.3.4"
∷ word (π ∷ ρ ∷ ο ∷ ϊ ∷ σ ∷ τ ∷ ά ∷ μ ∷ ε ∷ ν ∷ ο ∷ ν ∷ []) "1Tim.3.4"
∷ word (τ ∷ έ ∷ κ ∷ ν ∷ α ∷ []) "1Tim.3.4"
∷ word (ἔ ∷ χ ∷ ο ∷ ν ∷ τ ∷ α ∷ []) "1Tim.3.4"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.4"
∷ word (ὑ ∷ π ∷ ο ∷ τ ∷ α ∷ γ ∷ ῇ ∷ []) "1Tim.3.4"
∷ word (μ ∷ ε ∷ τ ∷ ὰ ∷ []) "1Tim.3.4"
∷ word (π ∷ ά ∷ σ ∷ η ∷ ς ∷ []) "1Tim.3.4"
∷ word (σ ∷ ε ∷ μ ∷ ν ∷ ό ∷ τ ∷ η ∷ τ ∷ ο ∷ ς ∷ []) "1Tim.3.4"
∷ word (ε ∷ ἰ ∷ []) "1Tim.3.5"
∷ word (δ ∷ έ ∷ []) "1Tim.3.5"
∷ word (τ ∷ ι ∷ ς ∷ []) "1Tim.3.5"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.3.5"
∷ word (ἰ ∷ δ ∷ ί ∷ ο ∷ υ ∷ []) "1Tim.3.5"
∷ word (ο ∷ ἴ ∷ κ ∷ ο ∷ υ ∷ []) "1Tim.3.5"
∷ word (π ∷ ρ ∷ ο ∷ σ ∷ τ ∷ ῆ ∷ ν ∷ α ∷ ι ∷ []) "1Tim.3.5"
∷ word (ο ∷ ὐ ∷ κ ∷ []) "1Tim.3.5"
∷ word (ο ∷ ἶ ∷ δ ∷ ε ∷ ν ∷ []) "1Tim.3.5"
∷ word (π ∷ ῶ ∷ ς ∷ []) "1Tim.3.5"
∷ word (ἐ ∷ κ ∷ κ ∷ ∙λ ∷ η ∷ σ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.3.5"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.3.5"
∷ word (ἐ ∷ π ∷ ι ∷ μ ∷ ε ∷ ∙λ ∷ ή ∷ σ ∷ ε ∷ τ ∷ α ∷ ι ∷ []) "1Tim.3.5"
∷ word (μ ∷ ὴ ∷ []) "1Tim.3.6"
∷ word (ν ∷ ε ∷ ό ∷ φ ∷ υ ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.3.6"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.3.6"
∷ word (μ ∷ ὴ ∷ []) "1Tim.3.6"
∷ word (τ ∷ υ ∷ φ ∷ ω ∷ θ ∷ ε ∷ ὶ ∷ ς ∷ []) "1Tim.3.6"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.3.6"
∷ word (κ ∷ ρ ∷ ί ∷ μ ∷ α ∷ []) "1Tim.3.6"
∷ word (ἐ ∷ μ ∷ π ∷ έ ∷ σ ∷ ῃ ∷ []) "1Tim.3.6"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.3.6"
∷ word (δ ∷ ι ∷ α ∷ β ∷ ό ∷ ∙λ ∷ ο ∷ υ ∷ []) "1Tim.3.6"
∷ word (δ ∷ ε ∷ ῖ ∷ []) "1Tim.3.7"
∷ word (δ ∷ ὲ ∷ []) "1Tim.3.7"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.3.7"
∷ word (μ ∷ α ∷ ρ ∷ τ ∷ υ ∷ ρ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.3.7"
∷ word (κ ∷ α ∷ ∙λ ∷ ὴ ∷ ν ∷ []) "1Tim.3.7"
∷ word (ἔ ∷ χ ∷ ε ∷ ι ∷ ν ∷ []) "1Tim.3.7"
∷ word (ἀ ∷ π ∷ ὸ ∷ []) "1Tim.3.7"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.3.7"
∷ word (ἔ ∷ ξ ∷ ω ∷ θ ∷ ε ∷ ν ∷ []) "1Tim.3.7"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.3.7"
∷ word (μ ∷ ὴ ∷ []) "1Tim.3.7"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.3.7"
∷ word (ὀ ∷ ν ∷ ε ∷ ι ∷ δ ∷ ι ∷ σ ∷ μ ∷ ὸ ∷ ν ∷ []) "1Tim.3.7"
∷ word (ἐ ∷ μ ∷ π ∷ έ ∷ σ ∷ ῃ ∷ []) "1Tim.3.7"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.3.7"
∷ word (π ∷ α ∷ γ ∷ ί ∷ δ ∷ α ∷ []) "1Tim.3.7"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.3.7"
∷ word (δ ∷ ι ∷ α ∷ β ∷ ό ∷ ∙λ ∷ ο ∷ υ ∷ []) "1Tim.3.7"
∷ word (Δ ∷ ι ∷ α ∷ κ ∷ ό ∷ ν ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.3.8"
∷ word (ὡ ∷ σ ∷ α ∷ ύ ∷ τ ∷ ω ∷ ς ∷ []) "1Tim.3.8"
∷ word (σ ∷ ε ∷ μ ∷ ν ∷ ο ∷ ύ ∷ ς ∷ []) "1Tim.3.8"
∷ word (μ ∷ ὴ ∷ []) "1Tim.3.8"
∷ word (δ ∷ ι ∷ ∙λ ∷ ό ∷ γ ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.3.8"
∷ word (μ ∷ ὴ ∷ []) "1Tim.3.8"
∷ word (ο ∷ ἴ ∷ ν ∷ ῳ ∷ []) "1Tim.3.8"
∷ word (π ∷ ο ∷ ∙λ ∷ ∙λ ∷ ῷ ∷ []) "1Tim.3.8"
∷ word (π ∷ ρ ∷ ο ∷ σ ∷ έ ∷ χ ∷ ο ∷ ν ∷ τ ∷ α ∷ ς ∷ []) "1Tim.3.8"
∷ word (μ ∷ ὴ ∷ []) "1Tim.3.8"
∷ word (α ∷ ἰ ∷ σ ∷ χ ∷ ρ ∷ ο ∷ κ ∷ ε ∷ ρ ∷ δ ∷ ε ∷ ῖ ∷ ς ∷ []) "1Tim.3.8"
∷ word (ἔ ∷ χ ∷ ο ∷ ν ∷ τ ∷ α ∷ ς ∷ []) "1Tim.3.9"
∷ word (τ ∷ ὸ ∷ []) "1Tim.3.9"
∷ word (μ ∷ υ ∷ σ ∷ τ ∷ ή ∷ ρ ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.3.9"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.3.9"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.3.9"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.9"
∷ word (κ ∷ α ∷ θ ∷ α ∷ ρ ∷ ᾷ ∷ []) "1Tim.3.9"
∷ word (σ ∷ υ ∷ ν ∷ ε ∷ ι ∷ δ ∷ ή ∷ σ ∷ ε ∷ ι ∷ []) "1Tim.3.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.3.10"
∷ word (ο ∷ ὗ ∷ τ ∷ ο ∷ ι ∷ []) "1Tim.3.10"
∷ word (δ ∷ ὲ ∷ []) "1Tim.3.10"
∷ word (δ ∷ ο ∷ κ ∷ ι ∷ μ ∷ α ∷ ζ ∷ έ ∷ σ ∷ θ ∷ ω ∷ σ ∷ α ∷ ν ∷ []) "1Tim.3.10"
∷ word (π ∷ ρ ∷ ῶ ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.3.10"
∷ word (ε ∷ ἶ ∷ τ ∷ α ∷ []) "1Tim.3.10"
∷ word (δ ∷ ι ∷ α ∷ κ ∷ ο ∷ ν ∷ ε ∷ ί ∷ τ ∷ ω ∷ σ ∷ α ∷ ν ∷ []) "1Tim.3.10"
∷ word (ἀ ∷ ν ∷ έ ∷ γ ∷ κ ∷ ∙λ ∷ η ∷ τ ∷ ο ∷ ι ∷ []) "1Tim.3.10"
∷ word (ὄ ∷ ν ∷ τ ∷ ε ∷ ς ∷ []) "1Tim.3.10"
∷ word (γ ∷ υ ∷ ν ∷ α ∷ ῖ ∷ κ ∷ α ∷ ς ∷ []) "1Tim.3.11"
∷ word (ὡ ∷ σ ∷ α ∷ ύ ∷ τ ∷ ω ∷ ς ∷ []) "1Tim.3.11"
∷ word (σ ∷ ε ∷ μ ∷ ν ∷ ά ∷ ς ∷ []) "1Tim.3.11"
∷ word (μ ∷ ὴ ∷ []) "1Tim.3.11"
∷ word (δ ∷ ι ∷ α ∷ β ∷ ό ∷ ∙λ ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.3.11"
∷ word (ν ∷ η ∷ φ ∷ α ∷ ∙λ ∷ ί ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.3.11"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ὰ ∷ ς ∷ []) "1Tim.3.11"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.11"
∷ word (π ∷ ᾶ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.3.11"
∷ word (δ ∷ ι ∷ ά ∷ κ ∷ ο ∷ ν ∷ ο ∷ ι ∷ []) "1Tim.3.12"
∷ word (ἔ ∷ σ ∷ τ ∷ ω ∷ σ ∷ α ∷ ν ∷ []) "1Tim.3.12"
∷ word (μ ∷ ι ∷ ᾶ ∷ ς ∷ []) "1Tim.3.12"
∷ word (γ ∷ υ ∷ ν ∷ α ∷ ι ∷ κ ∷ ὸ ∷ ς ∷ []) "1Tim.3.12"
∷ word (ἄ ∷ ν ∷ δ ∷ ρ ∷ ε ∷ ς ∷ []) "1Tim.3.12"
∷ word (τ ∷ έ ∷ κ ∷ ν ∷ ω ∷ ν ∷ []) "1Tim.3.12"
∷ word (κ ∷ α ∷ ∙λ ∷ ῶ ∷ ς ∷ []) "1Tim.3.12"
∷ word (π ∷ ρ ∷ ο ∷ ϊ ∷ σ ∷ τ ∷ ά ∷ μ ∷ ε ∷ ν ∷ ο ∷ ι ∷ []) "1Tim.3.12"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.3.12"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.3.12"
∷ word (ἰ ∷ δ ∷ ί ∷ ω ∷ ν ∷ []) "1Tim.3.12"
∷ word (ο ∷ ἴ ∷ κ ∷ ω ∷ ν ∷ []) "1Tim.3.12"
∷ word (ο ∷ ἱ ∷ []) "1Tim.3.13"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.3.13"
∷ word (κ ∷ α ∷ ∙λ ∷ ῶ ∷ ς ∷ []) "1Tim.3.13"
∷ word (δ ∷ ι ∷ α ∷ κ ∷ ο ∷ ν ∷ ή ∷ σ ∷ α ∷ ν ∷ τ ∷ ε ∷ ς ∷ []) "1Tim.3.13"
∷ word (β ∷ α ∷ θ ∷ μ ∷ ὸ ∷ ν ∷ []) "1Tim.3.13"
∷ word (ἑ ∷ α ∷ υ ∷ τ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.3.13"
∷ word (κ ∷ α ∷ ∙λ ∷ ὸ ∷ ν ∷ []) "1Tim.3.13"
∷ word (π ∷ ε ∷ ρ ∷ ι ∷ π ∷ ο ∷ ι ∷ ο ∷ ῦ ∷ ν ∷ τ ∷ α ∷ ι ∷ []) "1Tim.3.13"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.3.13"
∷ word (π ∷ ο ∷ ∙λ ∷ ∙λ ∷ ὴ ∷ ν ∷ []) "1Tim.3.13"
∷ word (π ∷ α ∷ ρ ∷ ρ ∷ η ∷ σ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.3.13"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.13"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ι ∷ []) "1Tim.3.13"
∷ word (τ ∷ ῇ ∷ []) "1Tim.3.13"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.13"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ῷ ∷ []) "1Tim.3.13"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.3.13"
∷ word (Τ ∷ α ∷ ῦ ∷ τ ∷ ά ∷ []) "1Tim.3.14"
∷ word (σ ∷ ο ∷ ι ∷ []) "1Tim.3.14"
∷ word (γ ∷ ρ ∷ ά ∷ φ ∷ ω ∷ []) "1Tim.3.14"
∷ word (ἐ ∷ ∙λ ∷ π ∷ ί ∷ ζ ∷ ω ∷ ν ∷ []) "1Tim.3.14"
∷ word (ἐ ∷ ∙λ ∷ θ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.3.14"
∷ word (π ∷ ρ ∷ ὸ ∷ ς ∷ []) "1Tim.3.14"
∷ word (σ ∷ ὲ ∷ []) "1Tim.3.14"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.14"
∷ word (τ ∷ ά ∷ χ ∷ ε ∷ ι ∷ []) "1Tim.3.14"
∷ word (ἐ ∷ ὰ ∷ ν ∷ []) "1Tim.3.15"
∷ word (δ ∷ ὲ ∷ []) "1Tim.3.15"
∷ word (β ∷ ρ ∷ α ∷ δ ∷ ύ ∷ ν ∷ ω ∷ []) "1Tim.3.15"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.3.15"
∷ word (ε ∷ ἰ ∷ δ ∷ ῇ ∷ ς ∷ []) "1Tim.3.15"
∷ word (π ∷ ῶ ∷ ς ∷ []) "1Tim.3.15"
∷ word (δ ∷ ε ∷ ῖ ∷ []) "1Tim.3.15"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.15"
∷ word (ο ∷ ἴ ∷ κ ∷ ῳ ∷ []) "1Tim.3.15"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.3.15"
∷ word (ἀ ∷ ν ∷ α ∷ σ ∷ τ ∷ ρ ∷ έ ∷ φ ∷ ε ∷ σ ∷ θ ∷ α ∷ ι ∷ []) "1Tim.3.15"
∷ word (ἥ ∷ τ ∷ ι ∷ ς ∷ []) "1Tim.3.15"
∷ word (ἐ ∷ σ ∷ τ ∷ ὶ ∷ ν ∷ []) "1Tim.3.15"
∷ word (ἐ ∷ κ ∷ κ ∷ ∙λ ∷ η ∷ σ ∷ ί ∷ α ∷ []) "1Tim.3.15"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.3.15"
∷ word (ζ ∷ ῶ ∷ ν ∷ τ ∷ ο ∷ ς ∷ []) "1Tim.3.15"
∷ word (σ ∷ τ ∷ ῦ ∷ ∙λ ∷ ο ∷ ς ∷ []) "1Tim.3.15"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.3.15"
∷ word (ἑ ∷ δ ∷ ρ ∷ α ∷ ί ∷ ω ∷ μ ∷ α ∷ []) "1Tim.3.15"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.3.15"
∷ word (ἀ ∷ ∙λ ∷ η ∷ θ ∷ ε ∷ ί ∷ α ∷ ς ∷ []) "1Tim.3.15"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.3.16"
∷ word (ὁ ∷ μ ∷ ο ∷ ∙λ ∷ ο ∷ γ ∷ ο ∷ υ ∷ μ ∷ έ ∷ ν ∷ ω ∷ ς ∷ []) "1Tim.3.16"
∷ word (μ ∷ έ ∷ γ ∷ α ∷ []) "1Tim.3.16"
∷ word (ἐ ∷ σ ∷ τ ∷ ὶ ∷ ν ∷ []) "1Tim.3.16"
∷ word (τ ∷ ὸ ∷ []) "1Tim.3.16"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.3.16"
∷ word (ε ∷ ὐ ∷ σ ∷ ε ∷ β ∷ ε ∷ ί ∷ α ∷ ς ∷ []) "1Tim.3.16"
∷ word (μ ∷ υ ∷ σ ∷ τ ∷ ή ∷ ρ ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.3.16"
∷ word (Ὃ ∷ ς ∷ []) "1Tim.3.16"
∷ word (ἐ ∷ φ ∷ α ∷ ν ∷ ε ∷ ρ ∷ ώ ∷ θ ∷ η ∷ []) "1Tim.3.16"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.16"
∷ word (σ ∷ α ∷ ρ ∷ κ ∷ ί ∷ []) "1Tim.3.16"
∷ word (ἐ ∷ δ ∷ ι ∷ κ ∷ α ∷ ι ∷ ώ ∷ θ ∷ η ∷ []) "1Tim.3.16"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.16"
∷ word (π ∷ ν ∷ ε ∷ ύ ∷ μ ∷ α ∷ τ ∷ ι ∷ []) "1Tim.3.16"
∷ word (ὤ ∷ φ ∷ θ ∷ η ∷ []) "1Tim.3.16"
∷ word (ἀ ∷ γ ∷ γ ∷ έ ∷ ∙λ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.3.16"
∷ word (ἐ ∷ κ ∷ η ∷ ρ ∷ ύ ∷ χ ∷ θ ∷ η ∷ []) "1Tim.3.16"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.16"
∷ word (ἔ ∷ θ ∷ ν ∷ ε ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.3.16"
∷ word (ἐ ∷ π ∷ ι ∷ σ ∷ τ ∷ ε ∷ ύ ∷ θ ∷ η ∷ []) "1Tim.3.16"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.16"
∷ word (κ ∷ ό ∷ σ ∷ μ ∷ ῳ ∷ []) "1Tim.3.16"
∷ word (ἀ ∷ ν ∷ ε ∷ ∙λ ∷ ή ∷ μ ∷ φ ∷ θ ∷ η ∷ []) "1Tim.3.16"
∷ word (ἐ ∷ ν ∷ []) "1Tim.3.16"
∷ word (δ ∷ ό ∷ ξ ∷ ῃ ∷ []) "1Tim.3.16"
∷ word (Τ ∷ ὸ ∷ []) "1Tim.4.1"
∷ word (δ ∷ ὲ ∷ []) "1Tim.4.1"
∷ word (π ∷ ν ∷ ε ∷ ῦ ∷ μ ∷ α ∷ []) "1Tim.4.1"
∷ word (ῥ ∷ η ∷ τ ∷ ῶ ∷ ς ∷ []) "1Tim.4.1"
∷ word (∙λ ∷ έ ∷ γ ∷ ε ∷ ι ∷ []) "1Tim.4.1"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.4.1"
∷ word (ἐ ∷ ν ∷ []) "1Tim.4.1"
∷ word (ὑ ∷ σ ∷ τ ∷ έ ∷ ρ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.4.1"
∷ word (κ ∷ α ∷ ι ∷ ρ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.4.1"
∷ word (ἀ ∷ π ∷ ο ∷ σ ∷ τ ∷ ή ∷ σ ∷ ο ∷ ν ∷ τ ∷ α ∷ ί ∷ []) "1Tim.4.1"
∷ word (τ ∷ ι ∷ ν ∷ ε ∷ ς ∷ []) "1Tim.4.1"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.4.1"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.4.1"
∷ word (π ∷ ρ ∷ ο ∷ σ ∷ έ ∷ χ ∷ ο ∷ ν ∷ τ ∷ ε ∷ ς ∷ []) "1Tim.4.1"
∷ word (π ∷ ν ∷ ε ∷ ύ ∷ μ ∷ α ∷ σ ∷ ι ∷ []) "1Tim.4.1"
∷ word (π ∷ ∙λ ∷ ά ∷ ν ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.4.1"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.1"
∷ word (δ ∷ ι ∷ δ ∷ α ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ί ∷ α ∷ ι ∷ ς ∷ []) "1Tim.4.1"
∷ word (δ ∷ α ∷ ι ∷ μ ∷ ο ∷ ν ∷ ί ∷ ω ∷ ν ∷ []) "1Tim.4.1"
∷ word (ἐ ∷ ν ∷ []) "1Tim.4.2"
∷ word (ὑ ∷ π ∷ ο ∷ κ ∷ ρ ∷ ί ∷ σ ∷ ε ∷ ι ∷ []) "1Tim.4.2"
∷ word (ψ ∷ ε ∷ υ ∷ δ ∷ ο ∷ ∙λ ∷ ό ∷ γ ∷ ω ∷ ν ∷ []) "1Tim.4.2"
∷ word (κ ∷ ε ∷ κ ∷ α ∷ υ ∷ σ ∷ τ ∷ η ∷ ρ ∷ ι ∷ α ∷ σ ∷ μ ∷ έ ∷ ν ∷ ω ∷ ν ∷ []) "1Tim.4.2"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.4.2"
∷ word (ἰ ∷ δ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.4.2"
∷ word (σ ∷ υ ∷ ν ∷ ε ∷ ί ∷ δ ∷ η ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.4.2"
∷ word (κ ∷ ω ∷ ∙λ ∷ υ ∷ ό ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.4.3"
∷ word (γ ∷ α ∷ μ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.4.3"
∷ word (ἀ ∷ π ∷ έ ∷ χ ∷ ε ∷ σ ∷ θ ∷ α ∷ ι ∷ []) "1Tim.4.3"
∷ word (β ∷ ρ ∷ ω ∷ μ ∷ ά ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.4.3"
∷ word (ἃ ∷ []) "1Tim.4.3"
∷ word (ὁ ∷ []) "1Tim.4.3"
∷ word (θ ∷ ε ∷ ὸ ∷ ς ∷ []) "1Tim.4.3"
∷ word (ἔ ∷ κ ∷ τ ∷ ι ∷ σ ∷ ε ∷ ν ∷ []) "1Tim.4.3"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.4.3"
∷ word (μ ∷ ε ∷ τ ∷ ά ∷ ∙λ ∷ η ∷ μ ∷ ψ ∷ ι ∷ ν ∷ []) "1Tim.4.3"
∷ word (μ ∷ ε ∷ τ ∷ ὰ ∷ []) "1Tim.4.3"
∷ word (ε ∷ ὐ ∷ χ ∷ α ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.4.3"
∷ word (τ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.4.3"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.4.3"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.3"
∷ word (ἐ ∷ π ∷ ε ∷ γ ∷ ν ∷ ω ∷ κ ∷ ό ∷ σ ∷ ι ∷ []) "1Tim.4.3"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.4.3"
∷ word (ἀ ∷ ∙λ ∷ ή ∷ θ ∷ ε ∷ ι ∷ α ∷ ν ∷ []) "1Tim.4.3"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.4.4"
∷ word (π ∷ ᾶ ∷ ν ∷ []) "1Tim.4.4"
∷ word (κ ∷ τ ∷ ί ∷ σ ∷ μ ∷ α ∷ []) "1Tim.4.4"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.4.4"
∷ word (κ ∷ α ∷ ∙λ ∷ ό ∷ ν ∷ []) "1Tim.4.4"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.4"
∷ word (ο ∷ ὐ ∷ δ ∷ ὲ ∷ ν ∷ []) "1Tim.4.4"
∷ word (ἀ ∷ π ∷ ό ∷ β ∷ ∙λ ∷ η ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.4.4"
∷ word (μ ∷ ε ∷ τ ∷ ὰ ∷ []) "1Tim.4.4"
∷ word (ε ∷ ὐ ∷ χ ∷ α ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.4.4"
∷ word (∙λ ∷ α ∷ μ ∷ β ∷ α ∷ ν ∷ ό ∷ μ ∷ ε ∷ ν ∷ ο ∷ ν ∷ []) "1Tim.4.4"
∷ word (ἁ ∷ γ ∷ ι ∷ ά ∷ ζ ∷ ε ∷ τ ∷ α ∷ ι ∷ []) "1Tim.4.5"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.4.5"
∷ word (δ ∷ ι ∷ ὰ ∷ []) "1Tim.4.5"
∷ word (∙λ ∷ ό ∷ γ ∷ ο ∷ υ ∷ []) "1Tim.4.5"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.4.5"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.5"
∷ word (ἐ ∷ ν ∷ τ ∷ ε ∷ ύ ∷ ξ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.4.5"
∷ word (Τ ∷ α ∷ ῦ ∷ τ ∷ α ∷ []) "1Tim.4.6"
∷ word (ὑ ∷ π ∷ ο ∷ τ ∷ ι ∷ θ ∷ έ ∷ μ ∷ ε ∷ ν ∷ ο ∷ ς ∷ []) "1Tim.4.6"
∷ word (τ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.4.6"
∷ word (ἀ ∷ δ ∷ ε ∷ ∙λ ∷ φ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.4.6"
∷ word (κ ∷ α ∷ ∙λ ∷ ὸ ∷ ς ∷ []) "1Tim.4.6"
∷ word (ἔ ∷ σ ∷ ῃ ∷ []) "1Tim.4.6"
∷ word (δ ∷ ι ∷ ά ∷ κ ∷ ο ∷ ν ∷ ο ∷ ς ∷ []) "1Tim.4.6"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.4.6"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.4.6"
∷ word (ἐ ∷ ν ∷ τ ∷ ρ ∷ ε ∷ φ ∷ ό ∷ μ ∷ ε ∷ ν ∷ ο ∷ ς ∷ []) "1Tim.4.6"
∷ word (τ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.4.6"
∷ word (∙λ ∷ ό ∷ γ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.4.6"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.4.6"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.4.6"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.6"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.4.6"
∷ word (κ ∷ α ∷ ∙λ ∷ ῆ ∷ ς ∷ []) "1Tim.4.6"
∷ word (δ ∷ ι ∷ δ ∷ α ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.4.6"
∷ word (ᾗ ∷ []) "1Tim.4.6"
∷ word (π ∷ α ∷ ρ ∷ η ∷ κ ∷ ο ∷ ∙λ ∷ ο ∷ ύ ∷ θ ∷ η ∷ κ ∷ α ∷ ς ∷ []) "1Tim.4.6"
∷ word (τ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.4.7"
∷ word (δ ∷ ὲ ∷ []) "1Tim.4.7"
∷ word (β ∷ ε ∷ β ∷ ή ∷ ∙λ ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.4.7"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.7"
∷ word (γ ∷ ρ ∷ α ∷ ώ ∷ δ ∷ ε ∷ ι ∷ ς ∷ []) "1Tim.4.7"
∷ word (μ ∷ ύ ∷ θ ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.4.7"
∷ word (π ∷ α ∷ ρ ∷ α ∷ ι ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.4.7"
∷ word (γ ∷ ύ ∷ μ ∷ ν ∷ α ∷ ζ ∷ ε ∷ []) "1Tim.4.7"
∷ word (δ ∷ ὲ ∷ []) "1Tim.4.7"
∷ word (σ ∷ ε ∷ α ∷ υ ∷ τ ∷ ὸ ∷ ν ∷ []) "1Tim.4.7"
∷ word (π ∷ ρ ∷ ὸ ∷ ς ∷ []) "1Tim.4.7"
∷ word (ε ∷ ὐ ∷ σ ∷ έ ∷ β ∷ ε ∷ ι ∷ α ∷ ν ∷ []) "1Tim.4.7"
∷ word (ἡ ∷ []) "1Tim.4.8"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.4.8"
∷ word (σ ∷ ω ∷ μ ∷ α ∷ τ ∷ ι ∷ κ ∷ ὴ ∷ []) "1Tim.4.8"
∷ word (γ ∷ υ ∷ μ ∷ ν ∷ α ∷ σ ∷ ί ∷ α ∷ []) "1Tim.4.8"
∷ word (π ∷ ρ ∷ ὸ ∷ ς ∷ []) "1Tim.4.8"
∷ word (ὀ ∷ ∙λ ∷ ί ∷ γ ∷ ο ∷ ν ∷ []) "1Tim.4.8"
∷ word (ἐ ∷ σ ∷ τ ∷ ὶ ∷ ν ∷ []) "1Tim.4.8"
∷ word (ὠ ∷ φ ∷ έ ∷ ∙λ ∷ ι ∷ μ ∷ ο ∷ ς ∷ []) "1Tim.4.8"
∷ word (ἡ ∷ []) "1Tim.4.8"
∷ word (δ ∷ ὲ ∷ []) "1Tim.4.8"
∷ word (ε ∷ ὐ ∷ σ ∷ έ ∷ β ∷ ε ∷ ι ∷ α ∷ []) "1Tim.4.8"
∷ word (π ∷ ρ ∷ ὸ ∷ ς ∷ []) "1Tim.4.8"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ α ∷ []) "1Tim.4.8"
∷ word (ὠ ∷ φ ∷ έ ∷ ∙λ ∷ ι ∷ μ ∷ ό ∷ ς ∷ []) "1Tim.4.8"
∷ word (ἐ ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.4.8"
∷ word (ἐ ∷ π ∷ α ∷ γ ∷ γ ∷ ε ∷ ∙λ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.4.8"
∷ word (ἔ ∷ χ ∷ ο ∷ υ ∷ σ ∷ α ∷ []) "1Tim.4.8"
∷ word (ζ ∷ ω ∷ ῆ ∷ ς ∷ []) "1Tim.4.8"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.4.8"
∷ word (ν ∷ ῦ ∷ ν ∷ []) "1Tim.4.8"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.8"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.4.8"
∷ word (μ ∷ ε ∷ ∙λ ∷ ∙λ ∷ ο ∷ ύ ∷ σ ∷ η ∷ ς ∷ []) "1Tim.4.8"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ὸ ∷ ς ∷ []) "1Tim.4.9"
∷ word (ὁ ∷ []) "1Tim.4.9"
∷ word (∙λ ∷ ό ∷ γ ∷ ο ∷ ς ∷ []) "1Tim.4.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.9"
∷ word (π ∷ ά ∷ σ ∷ η ∷ ς ∷ []) "1Tim.4.9"
∷ word (ἀ ∷ π ∷ ο ∷ δ ∷ ο ∷ χ ∷ ῆ ∷ ς ∷ []) "1Tim.4.9"
∷ word (ἄ ∷ ξ ∷ ι ∷ ο ∷ ς ∷ []) "1Tim.4.9"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.4.10"
∷ word (τ ∷ ο ∷ ῦ ∷ τ ∷ ο ∷ []) "1Tim.4.10"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.4.10"
∷ word (κ ∷ ο ∷ π ∷ ι ∷ ῶ ∷ μ ∷ ε ∷ ν ∷ []) "1Tim.4.10"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.10"
∷ word (ὀ ∷ ν ∷ ε ∷ ι ∷ δ ∷ ι ∷ ζ ∷ ό ∷ μ ∷ ε ∷ θ ∷ α ∷ []) "1Tim.4.10"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.4.10"
∷ word (ἠ ∷ ∙λ ∷ π ∷ ί ∷ κ ∷ α ∷ μ ∷ ε ∷ ν ∷ []) "1Tim.4.10"
∷ word (ἐ ∷ π ∷ ὶ ∷ []) "1Tim.4.10"
∷ word (θ ∷ ε ∷ ῷ ∷ []) "1Tim.4.10"
∷ word (ζ ∷ ῶ ∷ ν ∷ τ ∷ ι ∷ []) "1Tim.4.10"
∷ word (ὅ ∷ ς ∷ []) "1Tim.4.10"
∷ word (ἐ ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.4.10"
∷ word (σ ∷ ω ∷ τ ∷ ὴ ∷ ρ ∷ []) "1Tim.4.10"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.4.10"
∷ word (ἀ ∷ ν ∷ θ ∷ ρ ∷ ώ ∷ π ∷ ω ∷ ν ∷ []) "1Tim.4.10"
∷ word (μ ∷ ά ∷ ∙λ ∷ ι ∷ σ ∷ τ ∷ α ∷ []) "1Tim.4.10"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ῶ ∷ ν ∷ []) "1Tim.4.10"
∷ word (Π ∷ α ∷ ρ ∷ ά ∷ γ ∷ γ ∷ ε ∷ ∙λ ∷ ∙λ ∷ ε ∷ []) "1Tim.4.11"
∷ word (τ ∷ α ∷ ῦ ∷ τ ∷ α ∷ []) "1Tim.4.11"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.11"
∷ word (δ ∷ ί ∷ δ ∷ α ∷ σ ∷ κ ∷ ε ∷ []) "1Tim.4.11"
∷ word (μ ∷ η ∷ δ ∷ ε ∷ ί ∷ ς ∷ []) "1Tim.4.12"
∷ word (σ ∷ ο ∷ υ ∷ []) "1Tim.4.12"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.4.12"
∷ word (ν ∷ ε ∷ ό ∷ τ ∷ η ∷ τ ∷ ο ∷ ς ∷ []) "1Tim.4.12"
∷ word (κ ∷ α ∷ τ ∷ α ∷ φ ∷ ρ ∷ ο ∷ ν ∷ ε ∷ ί ∷ τ ∷ ω ∷ []) "1Tim.4.12"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ ὰ ∷ []) "1Tim.4.12"
∷ word (τ ∷ ύ ∷ π ∷ ο ∷ ς ∷ []) "1Tim.4.12"
∷ word (γ ∷ ί ∷ ν ∷ ο ∷ υ ∷ []) "1Tim.4.12"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.4.12"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ῶ ∷ ν ∷ []) "1Tim.4.12"
∷ word (ἐ ∷ ν ∷ []) "1Tim.4.12"
∷ word (∙λ ∷ ό ∷ γ ∷ ῳ ∷ []) "1Tim.4.12"
∷ word (ἐ ∷ ν ∷ []) "1Tim.4.12"
∷ word (ἀ ∷ ν ∷ α ∷ σ ∷ τ ∷ ρ ∷ ο ∷ φ ∷ ῇ ∷ []) "1Tim.4.12"
∷ word (ἐ ∷ ν ∷ []) "1Tim.4.12"
∷ word (ἀ ∷ γ ∷ ά ∷ π ∷ ῃ ∷ []) "1Tim.4.12"
∷ word (ἐ ∷ ν ∷ []) "1Tim.4.12"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ι ∷ []) "1Tim.4.12"
∷ word (ἐ ∷ ν ∷ []) "1Tim.4.12"
∷ word (ἁ ∷ γ ∷ ν ∷ ε ∷ ί ∷ ᾳ ∷ []) "1Tim.4.12"
∷ word (ἕ ∷ ω ∷ ς ∷ []) "1Tim.4.13"
∷ word (ἔ ∷ ρ ∷ χ ∷ ο ∷ μ ∷ α ∷ ι ∷ []) "1Tim.4.13"
∷ word (π ∷ ρ ∷ ό ∷ σ ∷ ε ∷ χ ∷ ε ∷ []) "1Tim.4.13"
∷ word (τ ∷ ῇ ∷ []) "1Tim.4.13"
∷ word (ἀ ∷ ν ∷ α ∷ γ ∷ ν ∷ ώ ∷ σ ∷ ε ∷ ι ∷ []) "1Tim.4.13"
∷ word (τ ∷ ῇ ∷ []) "1Tim.4.13"
∷ word (π ∷ α ∷ ρ ∷ α ∷ κ ∷ ∙λ ∷ ή ∷ σ ∷ ε ∷ ι ∷ []) "1Tim.4.13"
∷ word (τ ∷ ῇ ∷ []) "1Tim.4.13"
∷ word (δ ∷ ι ∷ δ ∷ α ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ί ∷ ᾳ ∷ []) "1Tim.4.13"
∷ word (μ ∷ ὴ ∷ []) "1Tim.4.14"
∷ word (ἀ ∷ μ ∷ έ ∷ ∙λ ∷ ε ∷ ι ∷ []) "1Tim.4.14"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.4.14"
∷ word (ἐ ∷ ν ∷ []) "1Tim.4.14"
∷ word (σ ∷ ο ∷ ὶ ∷ []) "1Tim.4.14"
∷ word (χ ∷ α ∷ ρ ∷ ί ∷ σ ∷ μ ∷ α ∷ τ ∷ ο ∷ ς ∷ []) "1Tim.4.14"
∷ word (ὃ ∷ []) "1Tim.4.14"
∷ word (ἐ ∷ δ ∷ ό ∷ θ ∷ η ∷ []) "1Tim.4.14"
∷ word (σ ∷ ο ∷ ι ∷ []) "1Tim.4.14"
∷ word (δ ∷ ι ∷ ὰ ∷ []) "1Tim.4.14"
∷ word (π ∷ ρ ∷ ο ∷ φ ∷ η ∷ τ ∷ ε ∷ ί ∷ α ∷ ς ∷ []) "1Tim.4.14"
∷ word (μ ∷ ε ∷ τ ∷ ὰ ∷ []) "1Tim.4.14"
∷ word (ἐ ∷ π ∷ ι ∷ θ ∷ έ ∷ σ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.4.14"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.4.14"
∷ word (χ ∷ ε ∷ ι ∷ ρ ∷ ῶ ∷ ν ∷ []) "1Tim.4.14"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.4.14"
∷ word (π ∷ ρ ∷ ε ∷ σ ∷ β ∷ υ ∷ τ ∷ ε ∷ ρ ∷ ί ∷ ο ∷ υ ∷ []) "1Tim.4.14"
∷ word (τ ∷ α ∷ ῦ ∷ τ ∷ α ∷ []) "1Tim.4.15"
∷ word (μ ∷ ε ∷ ∙λ ∷ έ ∷ τ ∷ α ∷ []) "1Tim.4.15"
∷ word (ἐ ∷ ν ∷ []) "1Tim.4.15"
∷ word (τ ∷ ο ∷ ύ ∷ τ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.4.15"
∷ word (ἴ ∷ σ ∷ θ ∷ ι ∷ []) "1Tim.4.15"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.4.15"
∷ word (σ ∷ ο ∷ υ ∷ []) "1Tim.4.15"
∷ word (ἡ ∷ []) "1Tim.4.15"
∷ word (π ∷ ρ ∷ ο ∷ κ ∷ ο ∷ π ∷ ὴ ∷ []) "1Tim.4.15"
∷ word (φ ∷ α ∷ ν ∷ ε ∷ ρ ∷ ὰ ∷ []) "1Tim.4.15"
∷ word (ᾖ ∷ []) "1Tim.4.15"
∷ word (π ∷ ᾶ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.4.15"
∷ word (ἔ ∷ π ∷ ε ∷ χ ∷ ε ∷ []) "1Tim.4.16"
∷ word (σ ∷ ε ∷ α ∷ υ ∷ τ ∷ ῷ ∷ []) "1Tim.4.16"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.16"
∷ word (τ ∷ ῇ ∷ []) "1Tim.4.16"
∷ word (δ ∷ ι ∷ δ ∷ α ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ί ∷ ᾳ ∷ []) "1Tim.4.16"
∷ word (ἐ ∷ π ∷ ί ∷ μ ∷ ε ∷ ν ∷ ε ∷ []) "1Tim.4.16"
∷ word (α ∷ ὐ ∷ τ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.4.16"
∷ word (τ ∷ ο ∷ ῦ ∷ τ ∷ ο ∷ []) "1Tim.4.16"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.4.16"
∷ word (π ∷ ο ∷ ι ∷ ῶ ∷ ν ∷ []) "1Tim.4.16"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.16"
∷ word (σ ∷ ε ∷ α ∷ υ ∷ τ ∷ ὸ ∷ ν ∷ []) "1Tim.4.16"
∷ word (σ ∷ ώ ∷ σ ∷ ε ∷ ι ∷ ς ∷ []) "1Tim.4.16"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.4.16"
∷ word (τ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.4.16"
∷ word (ἀ ∷ κ ∷ ο ∷ ύ ∷ ο ∷ ν ∷ τ ∷ ά ∷ ς ∷ []) "1Tim.4.16"
∷ word (σ ∷ ο ∷ υ ∷ []) "1Tim.4.16"
∷ word (Π ∷ ρ ∷ ε ∷ σ ∷ β ∷ υ ∷ τ ∷ έ ∷ ρ ∷ ῳ ∷ []) "1Tim.5.1"
∷ word (μ ∷ ὴ ∷ []) "1Tim.5.1"
∷ word (ἐ ∷ π ∷ ι ∷ π ∷ ∙λ ∷ ή ∷ ξ ∷ ῃ ∷ ς ∷ []) "1Tim.5.1"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ ὰ ∷ []) "1Tim.5.1"
∷ word (π ∷ α ∷ ρ ∷ α ∷ κ ∷ ά ∷ ∙λ ∷ ε ∷ ι ∷ []) "1Tim.5.1"
∷ word (ὡ ∷ ς ∷ []) "1Tim.5.1"
∷ word (π ∷ α ∷ τ ∷ έ ∷ ρ ∷ α ∷ []) "1Tim.5.1"
∷ word (ν ∷ ε ∷ ω ∷ τ ∷ έ ∷ ρ ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.5.1"
∷ word (ὡ ∷ ς ∷ []) "1Tim.5.1"
∷ word (ἀ ∷ δ ∷ ε ∷ ∙λ ∷ φ ∷ ο ∷ ύ ∷ ς ∷ []) "1Tim.5.1"
∷ word (π ∷ ρ ∷ ε ∷ σ ∷ β ∷ υ ∷ τ ∷ έ ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.2"
∷ word (ὡ ∷ ς ∷ []) "1Tim.5.2"
∷ word (μ ∷ η ∷ τ ∷ έ ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.2"
∷ word (ν ∷ ε ∷ ω ∷ τ ∷ έ ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.2"
∷ word (ὡ ∷ ς ∷ []) "1Tim.5.2"
∷ word (ἀ ∷ δ ∷ ε ∷ ∙λ ∷ φ ∷ ὰ ∷ ς ∷ []) "1Tim.5.2"
∷ word (ἐ ∷ ν ∷ []) "1Tim.5.2"
∷ word (π ∷ ά ∷ σ ∷ ῃ ∷ []) "1Tim.5.2"
∷ word (ἁ ∷ γ ∷ ν ∷ ε ∷ ί ∷ ᾳ ∷ []) "1Tim.5.2"
∷ word (Χ ∷ ή ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.3"
∷ word (τ ∷ ί ∷ μ ∷ α ∷ []) "1Tim.5.3"
∷ word (τ ∷ ὰ ∷ ς ∷ []) "1Tim.5.3"
∷ word (ὄ ∷ ν ∷ τ ∷ ω ∷ ς ∷ []) "1Tim.5.3"
∷ word (χ ∷ ή ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.3"
∷ word (ε ∷ ἰ ∷ []) "1Tim.5.4"
∷ word (δ ∷ έ ∷ []) "1Tim.5.4"
∷ word (τ ∷ ι ∷ ς ∷ []) "1Tim.5.4"
∷ word (χ ∷ ή ∷ ρ ∷ α ∷ []) "1Tim.5.4"
∷ word (τ ∷ έ ∷ κ ∷ ν ∷ α ∷ []) "1Tim.5.4"
∷ word (ἢ ∷ []) "1Tim.5.4"
∷ word (ἔ ∷ κ ∷ γ ∷ ο ∷ ν ∷ α ∷ []) "1Tim.5.4"
∷ word (ἔ ∷ χ ∷ ε ∷ ι ∷ []) "1Tim.5.4"
∷ word (μ ∷ α ∷ ν ∷ θ ∷ α ∷ ν ∷ έ ∷ τ ∷ ω ∷ σ ∷ α ∷ ν ∷ []) "1Tim.5.4"
∷ word (π ∷ ρ ∷ ῶ ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.5.4"
∷ word (τ ∷ ὸ ∷ ν ∷ []) "1Tim.5.4"
∷ word (ἴ ∷ δ ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.5.4"
∷ word (ο ∷ ἶ ∷ κ ∷ ο ∷ ν ∷ []) "1Tim.5.4"
∷ word (ε ∷ ὐ ∷ σ ∷ ε ∷ β ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.5.4"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.4"
∷ word (ἀ ∷ μ ∷ ο ∷ ι ∷ β ∷ ὰ ∷ ς ∷ []) "1Tim.5.4"
∷ word (ἀ ∷ π ∷ ο ∷ δ ∷ ι ∷ δ ∷ ό ∷ ν ∷ α ∷ ι ∷ []) "1Tim.5.4"
∷ word (τ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.5.4"
∷ word (π ∷ ρ ∷ ο ∷ γ ∷ ό ∷ ν ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.5.4"
∷ word (τ ∷ ο ∷ ῦ ∷ τ ∷ ο ∷ []) "1Tim.5.4"
∷ word (γ ∷ ά ∷ ρ ∷ []) "1Tim.5.4"
∷ word (ἐ ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.5.4"
∷ word (ἀ ∷ π ∷ ό ∷ δ ∷ ε ∷ κ ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.5.4"
∷ word (ἐ ∷ ν ∷ ώ ∷ π ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.5.4"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.5.4"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.5.4"
∷ word (ἡ ∷ []) "1Tim.5.5"
∷ word (δ ∷ ὲ ∷ []) "1Tim.5.5"
∷ word (ὄ ∷ ν ∷ τ ∷ ω ∷ ς ∷ []) "1Tim.5.5"
∷ word (χ ∷ ή ∷ ρ ∷ α ∷ []) "1Tim.5.5"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.5"
∷ word (μ ∷ ε ∷ μ ∷ ο ∷ ν ∷ ω ∷ μ ∷ έ ∷ ν ∷ η ∷ []) "1Tim.5.5"
∷ word (ἤ ∷ ∙λ ∷ π ∷ ι ∷ κ ∷ ε ∷ ν ∷ []) "1Tim.5.5"
∷ word (ἐ ∷ π ∷ ὶ ∷ []) "1Tim.5.5"
∷ word (θ ∷ ε ∷ ὸ ∷ ν ∷ []) "1Tim.5.5"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.5"
∷ word (π ∷ ρ ∷ ο ∷ σ ∷ μ ∷ έ ∷ ν ∷ ε ∷ ι ∷ []) "1Tim.5.5"
∷ word (τ ∷ α ∷ ῖ ∷ ς ∷ []) "1Tim.5.5"
∷ word (δ ∷ ε ∷ ή ∷ σ ∷ ε ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.5.5"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.5"
∷ word (τ ∷ α ∷ ῖ ∷ ς ∷ []) "1Tim.5.5"
∷ word (π ∷ ρ ∷ ο ∷ σ ∷ ε ∷ υ ∷ χ ∷ α ∷ ῖ ∷ ς ∷ []) "1Tim.5.5"
∷ word (ν ∷ υ ∷ κ ∷ τ ∷ ὸ ∷ ς ∷ []) "1Tim.5.5"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.5"
∷ word (ἡ ∷ μ ∷ έ ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.5"
∷ word (ἡ ∷ []) "1Tim.5.6"
∷ word (δ ∷ ὲ ∷ []) "1Tim.5.6"
∷ word (σ ∷ π ∷ α ∷ τ ∷ α ∷ ∙λ ∷ ῶ ∷ σ ∷ α ∷ []) "1Tim.5.6"
∷ word (ζ ∷ ῶ ∷ σ ∷ α ∷ []) "1Tim.5.6"
∷ word (τ ∷ έ ∷ θ ∷ ν ∷ η ∷ κ ∷ ε ∷ ν ∷ []) "1Tim.5.6"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.7"
∷ word (τ ∷ α ∷ ῦ ∷ τ ∷ α ∷ []) "1Tim.5.7"
∷ word (π ∷ α ∷ ρ ∷ ά ∷ γ ∷ γ ∷ ε ∷ ∙λ ∷ ∙λ ∷ ε ∷ []) "1Tim.5.7"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.5.7"
∷ word (ἀ ∷ ν ∷ ε ∷ π ∷ ί ∷ ∙λ ∷ η ∷ μ ∷ π ∷ τ ∷ ο ∷ ι ∷ []) "1Tim.5.7"
∷ word (ὦ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.5.7"
∷ word (ε ∷ ἰ ∷ []) "1Tim.5.8"
∷ word (δ ∷ έ ∷ []) "1Tim.5.8"
∷ word (τ ∷ ι ∷ ς ∷ []) "1Tim.5.8"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.5.8"
∷ word (ἰ ∷ δ ∷ ί ∷ ω ∷ ν ∷ []) "1Tim.5.8"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.8"
∷ word (μ ∷ ά ∷ ∙λ ∷ ι ∷ σ ∷ τ ∷ α ∷ []) "1Tim.5.8"
∷ word (ο ∷ ἰ ∷ κ ∷ ε ∷ ί ∷ ω ∷ ν ∷ []) "1Tim.5.8"
∷ word (ο ∷ ὐ ∷ []) "1Tim.5.8"
∷ word (π ∷ ρ ∷ ο ∷ ν ∷ ο ∷ ε ∷ ῖ ∷ []) "1Tim.5.8"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.5.8"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.5.8"
∷ word (ἤ ∷ ρ ∷ ν ∷ η ∷ τ ∷ α ∷ ι ∷ []) "1Tim.5.8"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.8"
∷ word (ἔ ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.5.8"
∷ word (ἀ ∷ π ∷ ί ∷ σ ∷ τ ∷ ο ∷ υ ∷ []) "1Tim.5.8"
∷ word (χ ∷ ε ∷ ί ∷ ρ ∷ ω ∷ ν ∷ []) "1Tim.5.8"
∷ word (Χ ∷ ή ∷ ρ ∷ α ∷ []) "1Tim.5.9"
∷ word (κ ∷ α ∷ τ ∷ α ∷ ∙λ ∷ ε ∷ γ ∷ έ ∷ σ ∷ θ ∷ ω ∷ []) "1Tim.5.9"
∷ word (μ ∷ ὴ ∷ []) "1Tim.5.9"
∷ word (ἔ ∷ ∙λ ∷ α ∷ τ ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.5.9"
∷ word (ἐ ∷ τ ∷ ῶ ∷ ν ∷ []) "1Tim.5.9"
∷ word (ἑ ∷ ξ ∷ ή ∷ κ ∷ ο ∷ ν ∷ τ ∷ α ∷ []) "1Tim.5.9"
∷ word (γ ∷ ε ∷ γ ∷ ο ∷ ν ∷ υ ∷ ῖ ∷ α ∷ []) "1Tim.5.9"
∷ word (ἑ ∷ ν ∷ ὸ ∷ ς ∷ []) "1Tim.5.9"
∷ word (ἀ ∷ ν ∷ δ ∷ ρ ∷ ὸ ∷ ς ∷ []) "1Tim.5.9"
∷ word (γ ∷ υ ∷ ν ∷ ή ∷ []) "1Tim.5.9"
∷ word (ἐ ∷ ν ∷ []) "1Tim.5.10"
∷ word (ἔ ∷ ρ ∷ γ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.5.10"
∷ word (κ ∷ α ∷ ∙λ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.5.10"
∷ word (μ ∷ α ∷ ρ ∷ τ ∷ υ ∷ ρ ∷ ο ∷ υ ∷ μ ∷ έ ∷ ν ∷ η ∷ []) "1Tim.5.10"
∷ word (ε ∷ ἰ ∷ []) "1Tim.5.10"
∷ word (ἐ ∷ τ ∷ ε ∷ κ ∷ ν ∷ ο ∷ τ ∷ ρ ∷ ό ∷ φ ∷ η ∷ σ ∷ ε ∷ ν ∷ []) "1Tim.5.10"
∷ word (ε ∷ ἰ ∷ []) "1Tim.5.10"
∷ word (ἐ ∷ ξ ∷ ε ∷ ν ∷ ο ∷ δ ∷ ό ∷ χ ∷ η ∷ σ ∷ ε ∷ ν ∷ []) "1Tim.5.10"
∷ word (ε ∷ ἰ ∷ []) "1Tim.5.10"
∷ word (ἁ ∷ γ ∷ ί ∷ ω ∷ ν ∷ []) "1Tim.5.10"
∷ word (π ∷ ό ∷ δ ∷ α ∷ ς ∷ []) "1Tim.5.10"
∷ word (ἔ ∷ ν ∷ ι ∷ ψ ∷ ε ∷ ν ∷ []) "1Tim.5.10"
∷ word (ε ∷ ἰ ∷ []) "1Tim.5.10"
∷ word (θ ∷ ∙λ ∷ ι ∷ β ∷ ο ∷ μ ∷ έ ∷ ν ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.5.10"
∷ word (ἐ ∷ π ∷ ή ∷ ρ ∷ κ ∷ ε ∷ σ ∷ ε ∷ ν ∷ []) "1Tim.5.10"
∷ word (ε ∷ ἰ ∷ []) "1Tim.5.10"
∷ word (π ∷ α ∷ ν ∷ τ ∷ ὶ ∷ []) "1Tim.5.10"
∷ word (ἔ ∷ ρ ∷ γ ∷ ῳ ∷ []) "1Tim.5.10"
∷ word (ἀ ∷ γ ∷ α ∷ θ ∷ ῷ ∷ []) "1Tim.5.10"
∷ word (ἐ ∷ π ∷ η ∷ κ ∷ ο ∷ ∙λ ∷ ο ∷ ύ ∷ θ ∷ η ∷ σ ∷ ε ∷ ν ∷ []) "1Tim.5.10"
∷ word (ν ∷ ε ∷ ω ∷ τ ∷ έ ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.11"
∷ word (δ ∷ ὲ ∷ []) "1Tim.5.11"
∷ word (χ ∷ ή ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.11"
∷ word (π ∷ α ∷ ρ ∷ α ∷ ι ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.5.11"
∷ word (ὅ ∷ τ ∷ α ∷ ν ∷ []) "1Tim.5.11"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.5.11"
∷ word (κ ∷ α ∷ τ ∷ α ∷ σ ∷ τ ∷ ρ ∷ η ∷ ν ∷ ι ∷ ά ∷ σ ∷ ω ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.5.11"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.5.11"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.5.11"
∷ word (γ ∷ α ∷ μ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.5.11"
∷ word (θ ∷ έ ∷ ∙λ ∷ ο ∷ υ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.5.11"
∷ word (ἔ ∷ χ ∷ ο ∷ υ ∷ σ ∷ α ∷ ι ∷ []) "1Tim.5.12"
∷ word (κ ∷ ρ ∷ ί ∷ μ ∷ α ∷ []) "1Tim.5.12"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.5.12"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.5.12"
∷ word (π ∷ ρ ∷ ώ ∷ τ ∷ η ∷ ν ∷ []) "1Tim.5.12"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.5.12"
∷ word (ἠ ∷ θ ∷ έ ∷ τ ∷ η ∷ σ ∷ α ∷ ν ∷ []) "1Tim.5.12"
∷ word (ἅ ∷ μ ∷ α ∷ []) "1Tim.5.13"
∷ word (δ ∷ ὲ ∷ []) "1Tim.5.13"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.13"
∷ word (ἀ ∷ ρ ∷ γ ∷ α ∷ ὶ ∷ []) "1Tim.5.13"
∷ word (μ ∷ α ∷ ν ∷ θ ∷ ά ∷ ν ∷ ο ∷ υ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.5.13"
∷ word (π ∷ ε ∷ ρ ∷ ι ∷ ε ∷ ρ ∷ χ ∷ ό ∷ μ ∷ ε ∷ ν ∷ α ∷ ι ∷ []) "1Tim.5.13"
∷ word (τ ∷ ὰ ∷ ς ∷ []) "1Tim.5.13"
∷ word (ο ∷ ἰ ∷ κ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.5.13"
∷ word (ο ∷ ὐ ∷ []) "1Tim.5.13"
∷ word (μ ∷ ό ∷ ν ∷ ο ∷ ν ∷ []) "1Tim.5.13"
∷ word (δ ∷ ὲ ∷ []) "1Tim.5.13"
∷ word (ἀ ∷ ρ ∷ γ ∷ α ∷ ὶ ∷ []) "1Tim.5.13"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ ὰ ∷ []) "1Tim.5.13"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.13"
∷ word (φ ∷ ∙λ ∷ ύ ∷ α ∷ ρ ∷ ο ∷ ι ∷ []) "1Tim.5.13"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.13"
∷ word (π ∷ ε ∷ ρ ∷ ί ∷ ε ∷ ρ ∷ γ ∷ ο ∷ ι ∷ []) "1Tim.5.13"
∷ word (∙λ ∷ α ∷ ∙λ ∷ ο ∷ ῦ ∷ σ ∷ α ∷ ι ∷ []) "1Tim.5.13"
∷ word (τ ∷ ὰ ∷ []) "1Tim.5.13"
∷ word (μ ∷ ὴ ∷ []) "1Tim.5.13"
∷ word (δ ∷ έ ∷ ο ∷ ν ∷ τ ∷ α ∷ []) "1Tim.5.13"
∷ word (β ∷ ο ∷ ύ ∷ ∙λ ∷ ο ∷ μ ∷ α ∷ ι ∷ []) "1Tim.5.14"
∷ word (ο ∷ ὖ ∷ ν ∷ []) "1Tim.5.14"
∷ word (ν ∷ ε ∷ ω ∷ τ ∷ έ ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.14"
∷ word (γ ∷ α ∷ μ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.5.14"
∷ word (τ ∷ ε ∷ κ ∷ ν ∷ ο ∷ γ ∷ ο ∷ ν ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.5.14"
∷ word (ο ∷ ἰ ∷ κ ∷ ο ∷ δ ∷ ε ∷ σ ∷ π ∷ ο ∷ τ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.5.14"
∷ word (μ ∷ η ∷ δ ∷ ε ∷ μ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.5.14"
∷ word (ἀ ∷ φ ∷ ο ∷ ρ ∷ μ ∷ ὴ ∷ ν ∷ []) "1Tim.5.14"
∷ word (δ ∷ ι ∷ δ ∷ ό ∷ ν ∷ α ∷ ι ∷ []) "1Tim.5.14"
∷ word (τ ∷ ῷ ∷ []) "1Tim.5.14"
∷ word (ἀ ∷ ν ∷ τ ∷ ι ∷ κ ∷ ε ∷ ι ∷ μ ∷ έ ∷ ν ∷ ῳ ∷ []) "1Tim.5.14"
∷ word (∙λ ∷ ο ∷ ι ∷ δ ∷ ο ∷ ρ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.5.14"
∷ word (χ ∷ ά ∷ ρ ∷ ι ∷ ν ∷ []) "1Tim.5.14"
∷ word (ἤ ∷ δ ∷ η ∷ []) "1Tim.5.15"
∷ word (γ ∷ ά ∷ ρ ∷ []) "1Tim.5.15"
∷ word (τ ∷ ι ∷ ν ∷ ε ∷ ς ∷ []) "1Tim.5.15"
∷ word (ἐ ∷ ξ ∷ ε ∷ τ ∷ ρ ∷ ά ∷ π ∷ η ∷ σ ∷ α ∷ ν ∷ []) "1Tim.5.15"
∷ word (ὀ ∷ π ∷ ί ∷ σ ∷ ω ∷ []) "1Tim.5.15"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.5.15"
∷ word (Σ ∷ α ∷ τ ∷ α ∷ ν ∷ ᾶ ∷ []) "1Tim.5.15"
∷ word (ε ∷ ἴ ∷ []) "1Tim.5.16"
∷ word (τ ∷ ι ∷ ς ∷ []) "1Tim.5.16"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ὴ ∷ []) "1Tim.5.16"
∷ word (ἔ ∷ χ ∷ ε ∷ ι ∷ []) "1Tim.5.16"
∷ word (χ ∷ ή ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.16"
∷ word (ἐ ∷ π ∷ α ∷ ρ ∷ κ ∷ ε ∷ ί ∷ τ ∷ ω ∷ []) "1Tim.5.16"
∷ word (α ∷ ὐ ∷ τ ∷ α ∷ ῖ ∷ ς ∷ []) "1Tim.5.16"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.16"
∷ word (μ ∷ ὴ ∷ []) "1Tim.5.16"
∷ word (β ∷ α ∷ ρ ∷ ε ∷ ί ∷ σ ∷ θ ∷ ω ∷ []) "1Tim.5.16"
∷ word (ἡ ∷ []) "1Tim.5.16"
∷ word (ἐ ∷ κ ∷ κ ∷ ∙λ ∷ η ∷ σ ∷ ί ∷ α ∷ []) "1Tim.5.16"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.5.16"
∷ word (τ ∷ α ∷ ῖ ∷ ς ∷ []) "1Tim.5.16"
∷ word (ὄ ∷ ν ∷ τ ∷ ω ∷ ς ∷ []) "1Tim.5.16"
∷ word (χ ∷ ή ∷ ρ ∷ α ∷ ι ∷ ς ∷ []) "1Tim.5.16"
∷ word (ἐ ∷ π ∷ α ∷ ρ ∷ κ ∷ έ ∷ σ ∷ ῃ ∷ []) "1Tim.5.16"
∷ word (Ο ∷ ἱ ∷ []) "1Tim.5.17"
∷ word (κ ∷ α ∷ ∙λ ∷ ῶ ∷ ς ∷ []) "1Tim.5.17"
∷ word (π ∷ ρ ∷ ο ∷ ε ∷ σ ∷ τ ∷ ῶ ∷ τ ∷ ε ∷ ς ∷ []) "1Tim.5.17"
∷ word (π ∷ ρ ∷ ε ∷ σ ∷ β ∷ ύ ∷ τ ∷ ε ∷ ρ ∷ ο ∷ ι ∷ []) "1Tim.5.17"
∷ word (δ ∷ ι ∷ π ∷ ∙λ ∷ ῆ ∷ ς ∷ []) "1Tim.5.17"
∷ word (τ ∷ ι ∷ μ ∷ ῆ ∷ ς ∷ []) "1Tim.5.17"
∷ word (ἀ ∷ ξ ∷ ι ∷ ο ∷ ύ ∷ σ ∷ θ ∷ ω ∷ σ ∷ α ∷ ν ∷ []) "1Tim.5.17"
∷ word (μ ∷ ά ∷ ∙λ ∷ ι ∷ σ ∷ τ ∷ α ∷ []) "1Tim.5.17"
∷ word (ο ∷ ἱ ∷ []) "1Tim.5.17"
∷ word (κ ∷ ο ∷ π ∷ ι ∷ ῶ ∷ ν ∷ τ ∷ ε ∷ ς ∷ []) "1Tim.5.17"
∷ word (ἐ ∷ ν ∷ []) "1Tim.5.17"
∷ word (∙λ ∷ ό ∷ γ ∷ ῳ ∷ []) "1Tim.5.17"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.17"
∷ word (δ ∷ ι ∷ δ ∷ α ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ί ∷ ᾳ ∷ []) "1Tim.5.17"
∷ word (∙λ ∷ έ ∷ γ ∷ ε ∷ ι ∷ []) "1Tim.5.18"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.5.18"
∷ word (ἡ ∷ []) "1Tim.5.18"
∷ word (γ ∷ ρ ∷ α ∷ φ ∷ ή ∷ []) "1Tim.5.18"
∷ word (Β ∷ ο ∷ ῦ ∷ ν ∷ []) "1Tim.5.18"
∷ word (ἀ ∷ ∙λ ∷ ο ∷ ῶ ∷ ν ∷ τ ∷ α ∷ []) "1Tim.5.18"
∷ word (ο ∷ ὐ ∷ []) "1Tim.5.18"
∷ word (φ ∷ ι ∷ μ ∷ ώ ∷ σ ∷ ε ∷ ι ∷ ς ∷ []) "1Tim.5.18"
∷ word (κ ∷ α ∷ ί ∷ []) "1Tim.5.18"
∷ word (Ἄ ∷ ξ ∷ ι ∷ ο ∷ ς ∷ []) "1Tim.5.18"
∷ word (ὁ ∷ []) "1Tim.5.18"
∷ word (ἐ ∷ ρ ∷ γ ∷ ά ∷ τ ∷ η ∷ ς ∷ []) "1Tim.5.18"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.5.18"
∷ word (μ ∷ ι ∷ σ ∷ θ ∷ ο ∷ ῦ ∷ []) "1Tim.5.18"
∷ word (α ∷ ὐ ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.5.18"
∷ word (κ ∷ α ∷ τ ∷ ὰ ∷ []) "1Tim.5.19"
∷ word (π ∷ ρ ∷ ε ∷ σ ∷ β ∷ υ ∷ τ ∷ έ ∷ ρ ∷ ο ∷ υ ∷ []) "1Tim.5.19"
∷ word (κ ∷ α ∷ τ ∷ η ∷ γ ∷ ο ∷ ρ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.5.19"
∷ word (μ ∷ ὴ ∷ []) "1Tim.5.19"
∷ word (π ∷ α ∷ ρ ∷ α ∷ δ ∷ έ ∷ χ ∷ ο ∷ υ ∷ []) "1Tim.5.19"
∷ word (ἐ ∷ κ ∷ τ ∷ ὸ ∷ ς ∷ []) "1Tim.5.19"
∷ word (ε ∷ ἰ ∷ []) "1Tim.5.19"
∷ word (μ ∷ ὴ ∷ []) "1Tim.5.19"
∷ word (ἐ ∷ π ∷ ὶ ∷ []) "1Tim.5.19"
∷ word (δ ∷ ύ ∷ ο ∷ []) "1Tim.5.19"
∷ word (ἢ ∷ []) "1Tim.5.19"
∷ word (τ ∷ ρ ∷ ι ∷ ῶ ∷ ν ∷ []) "1Tim.5.19"
∷ word (μ ∷ α ∷ ρ ∷ τ ∷ ύ ∷ ρ ∷ ω ∷ ν ∷ []) "1Tim.5.19"
∷ word (τ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.5.20"
∷ word (ἁ ∷ μ ∷ α ∷ ρ ∷ τ ∷ ά ∷ ν ∷ ο ∷ ν ∷ τ ∷ α ∷ ς ∷ []) "1Tim.5.20"
∷ word (ἐ ∷ ν ∷ ώ ∷ π ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.5.20"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.5.20"
∷ word (ἔ ∷ ∙λ ∷ ε ∷ γ ∷ χ ∷ ε ∷ []) "1Tim.5.20"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.5.20"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.20"
∷ word (ο ∷ ἱ ∷ []) "1Tim.5.20"
∷ word (∙λ ∷ ο ∷ ι ∷ π ∷ ο ∷ ὶ ∷ []) "1Tim.5.20"
∷ word (φ ∷ ό ∷ β ∷ ο ∷ ν ∷ []) "1Tim.5.20"
∷ word (ἔ ∷ χ ∷ ω ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.5.20"
∷ word (δ ∷ ι ∷ α ∷ μ ∷ α ∷ ρ ∷ τ ∷ ύ ∷ ρ ∷ ο ∷ μ ∷ α ∷ ι ∷ []) "1Tim.5.21"
∷ word (ἐ ∷ ν ∷ ώ ∷ π ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.5.21"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.5.21"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.5.21"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.21"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.5.21"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.5.21"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.21"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.5.21"
∷ word (ἐ ∷ κ ∷ ∙λ ∷ ε ∷ κ ∷ τ ∷ ῶ ∷ ν ∷ []) "1Tim.5.21"
∷ word (ἀ ∷ γ ∷ γ ∷ έ ∷ ∙λ ∷ ω ∷ ν ∷ []) "1Tim.5.21"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.5.21"
∷ word (τ ∷ α ∷ ῦ ∷ τ ∷ α ∷ []) "1Tim.5.21"
∷ word (φ ∷ υ ∷ ∙λ ∷ ά ∷ ξ ∷ ῃ ∷ ς ∷ []) "1Tim.5.21"
∷ word (χ ∷ ω ∷ ρ ∷ ὶ ∷ ς ∷ []) "1Tim.5.21"
∷ word (π ∷ ρ ∷ ο ∷ κ ∷ ρ ∷ ί ∷ μ ∷ α ∷ τ ∷ ο ∷ ς ∷ []) "1Tim.5.21"
∷ word (μ ∷ η ∷ δ ∷ ὲ ∷ ν ∷ []) "1Tim.5.21"
∷ word (π ∷ ο ∷ ι ∷ ῶ ∷ ν ∷ []) "1Tim.5.21"
∷ word (κ ∷ α ∷ τ ∷ ὰ ∷ []) "1Tim.5.21"
∷ word (π ∷ ρ ∷ ό ∷ σ ∷ κ ∷ ∙λ ∷ ι ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.5.21"
∷ word (χ ∷ ε ∷ ῖ ∷ ρ ∷ α ∷ ς ∷ []) "1Tim.5.22"
∷ word (τ ∷ α ∷ χ ∷ έ ∷ ω ∷ ς ∷ []) "1Tim.5.22"
∷ word (μ ∷ η ∷ δ ∷ ε ∷ ν ∷ ὶ ∷ []) "1Tim.5.22"
∷ word (ἐ ∷ π ∷ ι ∷ τ ∷ ί ∷ θ ∷ ε ∷ ι ∷ []) "1Tim.5.22"
∷ word (μ ∷ η ∷ δ ∷ ὲ ∷ []) "1Tim.5.22"
∷ word (κ ∷ ο ∷ ι ∷ ν ∷ ώ ∷ ν ∷ ε ∷ ι ∷ []) "1Tim.5.22"
∷ word (ἁ ∷ μ ∷ α ∷ ρ ∷ τ ∷ ί ∷ α ∷ ι ∷ ς ∷ []) "1Tim.5.22"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ ο ∷ τ ∷ ρ ∷ ί ∷ α ∷ ι ∷ ς ∷ []) "1Tim.5.22"
∷ word (σ ∷ ε ∷ α ∷ υ ∷ τ ∷ ὸ ∷ ν ∷ []) "1Tim.5.22"
∷ word (ἁ ∷ γ ∷ ν ∷ ὸ ∷ ν ∷ []) "1Tim.5.22"
∷ word (τ ∷ ή ∷ ρ ∷ ε ∷ ι ∷ []) "1Tim.5.22"
∷ word (μ ∷ η ∷ κ ∷ έ ∷ τ ∷ ι ∷ []) "1Tim.5.23"
∷ word (ὑ ∷ δ ∷ ρ ∷ ο ∷ π ∷ ό ∷ τ ∷ ε ∷ ι ∷ []) "1Tim.5.23"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ ὰ ∷ []) "1Tim.5.23"
∷ word (ο ∷ ἴ ∷ ν ∷ ῳ ∷ []) "1Tim.5.23"
∷ word (ὀ ∷ ∙λ ∷ ί ∷ γ ∷ ῳ ∷ []) "1Tim.5.23"
∷ word (χ ∷ ρ ∷ ῶ ∷ []) "1Tim.5.23"
∷ word (δ ∷ ι ∷ ὰ ∷ []) "1Tim.5.23"
∷ word (τ ∷ ὸ ∷ ν ∷ []) "1Tim.5.23"
∷ word (σ ∷ τ ∷ ό ∷ μ ∷ α ∷ χ ∷ ο ∷ ν ∷ []) "1Tim.5.23"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.23"
∷ word (τ ∷ ὰ ∷ ς ∷ []) "1Tim.5.23"
∷ word (π ∷ υ ∷ κ ∷ ν ∷ ά ∷ ς ∷ []) "1Tim.5.23"
∷ word (σ ∷ ο ∷ υ ∷ []) "1Tim.5.23"
∷ word (ἀ ∷ σ ∷ θ ∷ ε ∷ ν ∷ ε ∷ ί ∷ α ∷ ς ∷ []) "1Tim.5.23"
∷ word (Τ ∷ ι ∷ ν ∷ ῶ ∷ ν ∷ []) "1Tim.5.24"
∷ word (ἀ ∷ ν ∷ θ ∷ ρ ∷ ώ ∷ π ∷ ω ∷ ν ∷ []) "1Tim.5.24"
∷ word (α ∷ ἱ ∷ []) "1Tim.5.24"
∷ word (ἁ ∷ μ ∷ α ∷ ρ ∷ τ ∷ ί ∷ α ∷ ι ∷ []) "1Tim.5.24"
∷ word (π ∷ ρ ∷ ό ∷ δ ∷ η ∷ ∙λ ∷ ο ∷ ί ∷ []) "1Tim.5.24"
∷ word (ε ∷ ἰ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.5.24"
∷ word (π ∷ ρ ∷ ο ∷ ά ∷ γ ∷ ο ∷ υ ∷ σ ∷ α ∷ ι ∷ []) "1Tim.5.24"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.5.24"
∷ word (κ ∷ ρ ∷ ί ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.5.24"
∷ word (τ ∷ ι ∷ σ ∷ ὶ ∷ ν ∷ []) "1Tim.5.24"
∷ word (δ ∷ ὲ ∷ []) "1Tim.5.24"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.24"
∷ word (ἐ ∷ π ∷ α ∷ κ ∷ ο ∷ ∙λ ∷ ο ∷ υ ∷ θ ∷ ο ∷ ῦ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.5.24"
∷ word (ὡ ∷ σ ∷ α ∷ ύ ∷ τ ∷ ω ∷ ς ∷ []) "1Tim.5.25"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.25"
∷ word (τ ∷ ὰ ∷ []) "1Tim.5.25"
∷ word (ἔ ∷ ρ ∷ γ ∷ α ∷ []) "1Tim.5.25"
∷ word (τ ∷ ὰ ∷ []) "1Tim.5.25"
∷ word (κ ∷ α ∷ ∙λ ∷ ὰ ∷ []) "1Tim.5.25"
∷ word (π ∷ ρ ∷ ό ∷ δ ∷ η ∷ ∙λ ∷ α ∷ []) "1Tim.5.25"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.5.25"
∷ word (τ ∷ ὰ ∷ []) "1Tim.5.25"
∷ word (ἄ ∷ ∙λ ∷ ∙λ ∷ ω ∷ ς ∷ []) "1Tim.5.25"
∷ word (ἔ ∷ χ ∷ ο ∷ ν ∷ τ ∷ α ∷ []) "1Tim.5.25"
∷ word (κ ∷ ρ ∷ υ ∷ β ∷ ῆ ∷ ν ∷ α ∷ ι ∷ []) "1Tim.5.25"
∷ word (ο ∷ ὐ ∷ []) "1Tim.5.25"
∷ word (δ ∷ ύ ∷ ν ∷ α ∷ ν ∷ τ ∷ α ∷ ι ∷ []) "1Tim.5.25"
∷ word (Ὅ ∷ σ ∷ ο ∷ ι ∷ []) "1Tim.6.1"
∷ word (ε ∷ ἰ ∷ σ ∷ ὶ ∷ ν ∷ []) "1Tim.6.1"
∷ word (ὑ ∷ π ∷ ὸ ∷ []) "1Tim.6.1"
∷ word (ζ ∷ υ ∷ γ ∷ ὸ ∷ ν ∷ []) "1Tim.6.1"
∷ word (δ ∷ ο ∷ ῦ ∷ ∙λ ∷ ο ∷ ι ∷ []) "1Tim.6.1"
∷ word (τ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.6.1"
∷ word (ἰ ∷ δ ∷ ί ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.6.1"
∷ word (δ ∷ ε ∷ σ ∷ π ∷ ό ∷ τ ∷ α ∷ ς ∷ []) "1Tim.6.1"
∷ word (π ∷ ά ∷ σ ∷ η ∷ ς ∷ []) "1Tim.6.1"
∷ word (τ ∷ ι ∷ μ ∷ ῆ ∷ ς ∷ []) "1Tim.6.1"
∷ word (ἀ ∷ ξ ∷ ί ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.6.1"
∷ word (ἡ ∷ γ ∷ ε ∷ ί ∷ σ ∷ θ ∷ ω ∷ σ ∷ α ∷ ν ∷ []) "1Tim.6.1"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.6.1"
∷ word (μ ∷ ὴ ∷ []) "1Tim.6.1"
∷ word (τ ∷ ὸ ∷ []) "1Tim.6.1"
∷ word (ὄ ∷ ν ∷ ο ∷ μ ∷ α ∷ []) "1Tim.6.1"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.6.1"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.6.1"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.1"
∷ word (ἡ ∷ []) "1Tim.6.1"
∷ word (δ ∷ ι ∷ δ ∷ α ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ί ∷ α ∷ []) "1Tim.6.1"
∷ word (β ∷ ∙λ ∷ α ∷ σ ∷ φ ∷ η ∷ μ ∷ ῆ ∷ τ ∷ α ∷ ι ∷ []) "1Tim.6.1"
∷ word (ο ∷ ἱ ∷ []) "1Tim.6.2"
∷ word (δ ∷ ὲ ∷ []) "1Tim.6.2"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.6.2"
∷ word (ἔ ∷ χ ∷ ο ∷ ν ∷ τ ∷ ε ∷ ς ∷ []) "1Tim.6.2"
∷ word (δ ∷ ε ∷ σ ∷ π ∷ ό ∷ τ ∷ α ∷ ς ∷ []) "1Tim.6.2"
∷ word (μ ∷ ὴ ∷ []) "1Tim.6.2"
∷ word (κ ∷ α ∷ τ ∷ α ∷ φ ∷ ρ ∷ ο ∷ ν ∷ ε ∷ ί ∷ τ ∷ ω ∷ σ ∷ α ∷ ν ∷ []) "1Tim.6.2"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.6.2"
∷ word (ἀ ∷ δ ∷ ε ∷ ∙λ ∷ φ ∷ ο ∷ ί ∷ []) "1Tim.6.2"
∷ word (ε ∷ ἰ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.6.2"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ ὰ ∷ []) "1Tim.6.2"
∷ word (μ ∷ ᾶ ∷ ∙λ ∷ ∙λ ∷ ο ∷ ν ∷ []) "1Tim.6.2"
∷ word (δ ∷ ο ∷ υ ∷ ∙λ ∷ ε ∷ υ ∷ έ ∷ τ ∷ ω ∷ σ ∷ α ∷ ν ∷ []) "1Tim.6.2"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.6.2"
∷ word (π ∷ ι ∷ σ ∷ τ ∷ ο ∷ ί ∷ []) "1Tim.6.2"
∷ word (ε ∷ ἰ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.6.2"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.2"
∷ word (ἀ ∷ γ ∷ α ∷ π ∷ η ∷ τ ∷ ο ∷ ὶ ∷ []) "1Tim.6.2"
∷ word (ο ∷ ἱ ∷ []) "1Tim.6.2"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.6.2"
∷ word (ε ∷ ὐ ∷ ε ∷ ρ ∷ γ ∷ ε ∷ σ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.6.2"
∷ word (ἀ ∷ ν ∷ τ ∷ ι ∷ ∙λ ∷ α ∷ μ ∷ β ∷ α ∷ ν ∷ ό ∷ μ ∷ ε ∷ ν ∷ ο ∷ ι ∷ []) "1Tim.6.2"
∷ word (Τ ∷ α ∷ ῦ ∷ τ ∷ α ∷ []) "1Tim.6.2"
∷ word (δ ∷ ί ∷ δ ∷ α ∷ σ ∷ κ ∷ ε ∷ []) "1Tim.6.2"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.2"
∷ word (π ∷ α ∷ ρ ∷ α ∷ κ ∷ ά ∷ ∙λ ∷ ε ∷ ι ∷ []) "1Tim.6.2"
∷ word (ε ∷ ἴ ∷ []) "1Tim.6.3"
∷ word (τ ∷ ι ∷ ς ∷ []) "1Tim.6.3"
∷ word (ἑ ∷ τ ∷ ε ∷ ρ ∷ ο ∷ δ ∷ ι ∷ δ ∷ α ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ε ∷ ῖ ∷ []) "1Tim.6.3"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.3"
∷ word (μ ∷ ὴ ∷ []) "1Tim.6.3"
∷ word (π ∷ ρ ∷ ο ∷ σ ∷ έ ∷ ρ ∷ χ ∷ ε ∷ τ ∷ α ∷ ι ∷ []) "1Tim.6.3"
∷ word (ὑ ∷ γ ∷ ι ∷ α ∷ ί ∷ ν ∷ ο ∷ υ ∷ σ ∷ ι ∷ []) "1Tim.6.3"
∷ word (∙λ ∷ ό ∷ γ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.6.3"
∷ word (τ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.6.3"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.6.3"
∷ word (κ ∷ υ ∷ ρ ∷ ί ∷ ο ∷ υ ∷ []) "1Tim.6.3"
∷ word (ἡ ∷ μ ∷ ῶ ∷ ν ∷ []) "1Tim.6.3"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.6.3"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.6.3"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.3"
∷ word (τ ∷ ῇ ∷ []) "1Tim.6.3"
∷ word (κ ∷ α ∷ τ ∷ []) "1Tim.6.3"
∷ word (ε ∷ ὐ ∷ σ ∷ έ ∷ β ∷ ε ∷ ι ∷ α ∷ ν ∷ []) "1Tim.6.3"
∷ word (δ ∷ ι ∷ δ ∷ α ∷ σ ∷ κ ∷ α ∷ ∙λ ∷ ί ∷ ᾳ ∷ []) "1Tim.6.3"
∷ word (τ ∷ ε ∷ τ ∷ ύ ∷ φ ∷ ω ∷ τ ∷ α ∷ ι ∷ []) "1Tim.6.4"
∷ word (μ ∷ η ∷ δ ∷ ὲ ∷ ν ∷ []) "1Tim.6.4"
∷ word (ἐ ∷ π ∷ ι ∷ σ ∷ τ ∷ ά ∷ μ ∷ ε ∷ ν ∷ ο ∷ ς ∷ []) "1Tim.6.4"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ ὰ ∷ []) "1Tim.6.4"
∷ word (ν ∷ ο ∷ σ ∷ ῶ ∷ ν ∷ []) "1Tim.6.4"
∷ word (π ∷ ε ∷ ρ ∷ ὶ ∷ []) "1Tim.6.4"
∷ word (ζ ∷ η ∷ τ ∷ ή ∷ σ ∷ ε ∷ ι ∷ ς ∷ []) "1Tim.6.4"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.4"
∷ word (∙λ ∷ ο ∷ γ ∷ ο ∷ μ ∷ α ∷ χ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.6.4"
∷ word (ἐ ∷ ξ ∷ []) "1Tim.6.4"
∷ word (ὧ ∷ ν ∷ []) "1Tim.6.4"
∷ word (γ ∷ ί ∷ ν ∷ ε ∷ τ ∷ α ∷ ι ∷ []) "1Tim.6.4"
∷ word (φ ∷ θ ∷ ό ∷ ν ∷ ο ∷ ς ∷ []) "1Tim.6.4"
∷ word (ἔ ∷ ρ ∷ ι ∷ ς ∷ []) "1Tim.6.4"
∷ word (β ∷ ∙λ ∷ α ∷ σ ∷ φ ∷ η ∷ μ ∷ ί ∷ α ∷ ι ∷ []) "1Tim.6.4"
∷ word (ὑ ∷ π ∷ ό ∷ ν ∷ ο ∷ ι ∷ α ∷ ι ∷ []) "1Tim.6.4"
∷ word (π ∷ ο ∷ ν ∷ η ∷ ρ ∷ α ∷ ί ∷ []) "1Tim.6.4"
∷ word (δ ∷ ι ∷ α ∷ π ∷ α ∷ ρ ∷ α ∷ τ ∷ ρ ∷ ι ∷ β ∷ α ∷ ὶ ∷ []) "1Tim.6.5"
∷ word (δ ∷ ι ∷ ε ∷ φ ∷ θ ∷ α ∷ ρ ∷ μ ∷ έ ∷ ν ∷ ω ∷ ν ∷ []) "1Tim.6.5"
∷ word (ἀ ∷ ν ∷ θ ∷ ρ ∷ ώ ∷ π ∷ ω ∷ ν ∷ []) "1Tim.6.5"
∷ word (τ ∷ ὸ ∷ ν ∷ []) "1Tim.6.5"
∷ word (ν ∷ ο ∷ ῦ ∷ ν ∷ []) "1Tim.6.5"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.5"
∷ word (ἀ ∷ π ∷ ε ∷ σ ∷ τ ∷ ε ∷ ρ ∷ η ∷ μ ∷ έ ∷ ν ∷ ω ∷ ν ∷ []) "1Tim.6.5"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.6.5"
∷ word (ἀ ∷ ∙λ ∷ η ∷ θ ∷ ε ∷ ί ∷ α ∷ ς ∷ []) "1Tim.6.5"
∷ word (ν ∷ ο ∷ μ ∷ ι ∷ ζ ∷ ό ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.6.5"
∷ word (π ∷ ο ∷ ρ ∷ ι ∷ σ ∷ μ ∷ ὸ ∷ ν ∷ []) "1Tim.6.5"
∷ word (ε ∷ ἶ ∷ ν ∷ α ∷ ι ∷ []) "1Tim.6.5"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.6.5"
∷ word (ε ∷ ὐ ∷ σ ∷ έ ∷ β ∷ ε ∷ ι ∷ α ∷ ν ∷ []) "1Tim.6.5"
∷ word (ἔ ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.6.6"
∷ word (δ ∷ ὲ ∷ []) "1Tim.6.6"
∷ word (π ∷ ο ∷ ρ ∷ ι ∷ σ ∷ μ ∷ ὸ ∷ ς ∷ []) "1Tim.6.6"
∷ word (μ ∷ έ ∷ γ ∷ α ∷ ς ∷ []) "1Tim.6.6"
∷ word (ἡ ∷ []) "1Tim.6.6"
∷ word (ε ∷ ὐ ∷ σ ∷ έ ∷ β ∷ ε ∷ ι ∷ α ∷ []) "1Tim.6.6"
∷ word (μ ∷ ε ∷ τ ∷ ὰ ∷ []) "1Tim.6.6"
∷ word (α ∷ ὐ ∷ τ ∷ α ∷ ρ ∷ κ ∷ ε ∷ ί ∷ α ∷ ς ∷ []) "1Tim.6.6"
∷ word (ο ∷ ὐ ∷ δ ∷ ὲ ∷ ν ∷ []) "1Tim.6.7"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.6.7"
∷ word (ε ∷ ἰ ∷ σ ∷ η ∷ ν ∷ έ ∷ γ ∷ κ ∷ α ∷ μ ∷ ε ∷ ν ∷ []) "1Tim.6.7"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.6.7"
∷ word (τ ∷ ὸ ∷ ν ∷ []) "1Tim.6.7"
∷ word (κ ∷ ό ∷ σ ∷ μ ∷ ο ∷ ν ∷ []) "1Tim.6.7"
∷ word (ὅ ∷ τ ∷ ι ∷ []) "1Tim.6.7"
∷ word (ο ∷ ὐ ∷ δ ∷ ὲ ∷ []) "1Tim.6.7"
∷ word (ἐ ∷ ξ ∷ ε ∷ ν ∷ ε ∷ γ ∷ κ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.6.7"
∷ word (τ ∷ ι ∷ []) "1Tim.6.7"
∷ word (δ ∷ υ ∷ ν ∷ ά ∷ μ ∷ ε ∷ θ ∷ α ∷ []) "1Tim.6.7"
∷ word (ἔ ∷ χ ∷ ο ∷ ν ∷ τ ∷ ε ∷ ς ∷ []) "1Tim.6.8"
∷ word (δ ∷ ὲ ∷ []) "1Tim.6.8"
∷ word (δ ∷ ι ∷ α ∷ τ ∷ ρ ∷ ο ∷ φ ∷ ὰ ∷ ς ∷ []) "1Tim.6.8"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.8"
∷ word (σ ∷ κ ∷ ε ∷ π ∷ ά ∷ σ ∷ μ ∷ α ∷ τ ∷ α ∷ []) "1Tim.6.8"
∷ word (τ ∷ ο ∷ ύ ∷ τ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.6.8"
∷ word (ἀ ∷ ρ ∷ κ ∷ ε ∷ σ ∷ θ ∷ η ∷ σ ∷ ό ∷ μ ∷ ε ∷ θ ∷ α ∷ []) "1Tim.6.8"
∷ word (ο ∷ ἱ ∷ []) "1Tim.6.9"
∷ word (δ ∷ ὲ ∷ []) "1Tim.6.9"
∷ word (β ∷ ο ∷ υ ∷ ∙λ ∷ ό ∷ μ ∷ ε ∷ ν ∷ ο ∷ ι ∷ []) "1Tim.6.9"
∷ word (π ∷ ∙λ ∷ ο ∷ υ ∷ τ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.6.9"
∷ word (ἐ ∷ μ ∷ π ∷ ί ∷ π ∷ τ ∷ ο ∷ υ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.6.9"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.6.9"
∷ word (π ∷ ε ∷ ι ∷ ρ ∷ α ∷ σ ∷ μ ∷ ὸ ∷ ν ∷ []) "1Tim.6.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.9"
∷ word (π ∷ α ∷ γ ∷ ί ∷ δ ∷ α ∷ []) "1Tim.6.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.9"
∷ word (ἐ ∷ π ∷ ι ∷ θ ∷ υ ∷ μ ∷ ί ∷ α ∷ ς ∷ []) "1Tim.6.9"
∷ word (π ∷ ο ∷ ∙λ ∷ ∙λ ∷ ὰ ∷ ς ∷ []) "1Tim.6.9"
∷ word (ἀ ∷ ν ∷ ο ∷ ή ∷ τ ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.6.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.9"
∷ word (β ∷ ∙λ ∷ α ∷ β ∷ ε ∷ ρ ∷ ά ∷ ς ∷ []) "1Tim.6.9"
∷ word (α ∷ ἵ ∷ τ ∷ ι ∷ ν ∷ ε ∷ ς ∷ []) "1Tim.6.9"
∷ word (β ∷ υ ∷ θ ∷ ί ∷ ζ ∷ ο ∷ υ ∷ σ ∷ ι ∷ []) "1Tim.6.9"
∷ word (τ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.6.9"
∷ word (ἀ ∷ ν ∷ θ ∷ ρ ∷ ώ ∷ π ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.6.9"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.6.9"
∷ word (ὄ ∷ ∙λ ∷ ε ∷ θ ∷ ρ ∷ ο ∷ ν ∷ []) "1Tim.6.9"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.9"
∷ word (ἀ ∷ π ∷ ώ ∷ ∙λ ∷ ε ∷ ι ∷ α ∷ ν ∷ []) "1Tim.6.9"
∷ word (ῥ ∷ ί ∷ ζ ∷ α ∷ []) "1Tim.6.10"
∷ word (γ ∷ ὰ ∷ ρ ∷ []) "1Tim.6.10"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.6.10"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.6.10"
∷ word (κ ∷ α ∷ κ ∷ ῶ ∷ ν ∷ []) "1Tim.6.10"
∷ word (ἐ ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.6.10"
∷ word (ἡ ∷ []) "1Tim.6.10"
∷ word (φ ∷ ι ∷ ∙λ ∷ α ∷ ρ ∷ γ ∷ υ ∷ ρ ∷ ί ∷ α ∷ []) "1Tim.6.10"
∷ word (ἧ ∷ ς ∷ []) "1Tim.6.10"
∷ word (τ ∷ ι ∷ ν ∷ ε ∷ ς ∷ []) "1Tim.6.10"
∷ word (ὀ ∷ ρ ∷ ε ∷ γ ∷ ό ∷ μ ∷ ε ∷ ν ∷ ο ∷ ι ∷ []) "1Tim.6.10"
∷ word (ἀ ∷ π ∷ ε ∷ π ∷ ∙λ ∷ α ∷ ν ∷ ή ∷ θ ∷ η ∷ σ ∷ α ∷ ν ∷ []) "1Tim.6.10"
∷ word (ἀ ∷ π ∷ ὸ ∷ []) "1Tim.6.10"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.6.10"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.6.10"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.10"
∷ word (ἑ ∷ α ∷ υ ∷ τ ∷ ο ∷ ὺ ∷ ς ∷ []) "1Tim.6.10"
∷ word (π ∷ ε ∷ ρ ∷ ι ∷ έ ∷ π ∷ ε ∷ ι ∷ ρ ∷ α ∷ ν ∷ []) "1Tim.6.10"
∷ word (ὀ ∷ δ ∷ ύ ∷ ν ∷ α ∷ ι ∷ ς ∷ []) "1Tim.6.10"
∷ word (π ∷ ο ∷ ∙λ ∷ ∙λ ∷ α ∷ ῖ ∷ ς ∷ []) "1Tim.6.10"
∷ word (Σ ∷ ὺ ∷ []) "1Tim.6.11"
∷ word (δ ∷ έ ∷ []) "1Tim.6.11"
∷ word (ὦ ∷ []) "1Tim.6.11"
∷ word (ἄ ∷ ν ∷ θ ∷ ρ ∷ ω ∷ π ∷ ε ∷ []) "1Tim.6.11"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.6.11"
∷ word (τ ∷ α ∷ ῦ ∷ τ ∷ α ∷ []) "1Tim.6.11"
∷ word (φ ∷ ε ∷ ῦ ∷ γ ∷ ε ∷ []) "1Tim.6.11"
∷ word (δ ∷ ί ∷ ω ∷ κ ∷ ε ∷ []) "1Tim.6.11"
∷ word (δ ∷ ὲ ∷ []) "1Tim.6.11"
∷ word (δ ∷ ι ∷ κ ∷ α ∷ ι ∷ ο ∷ σ ∷ ύ ∷ ν ∷ η ∷ ν ∷ []) "1Tim.6.11"
∷ word (ε ∷ ὐ ∷ σ ∷ έ ∷ β ∷ ε ∷ ι ∷ α ∷ ν ∷ []) "1Tim.6.11"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.6.11"
∷ word (ἀ ∷ γ ∷ ά ∷ π ∷ η ∷ ν ∷ []) "1Tim.6.11"
∷ word (ὑ ∷ π ∷ ο ∷ μ ∷ ο ∷ ν ∷ ή ∷ ν ∷ []) "1Tim.6.11"
∷ word (π ∷ ρ ∷ α ∷ ϋ ∷ π ∷ α ∷ θ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.6.11"
∷ word (ἀ ∷ γ ∷ ω ∷ ν ∷ ί ∷ ζ ∷ ο ∷ υ ∷ []) "1Tim.6.12"
∷ word (τ ∷ ὸ ∷ ν ∷ []) "1Tim.6.12"
∷ word (κ ∷ α ∷ ∙λ ∷ ὸ ∷ ν ∷ []) "1Tim.6.12"
∷ word (ἀ ∷ γ ∷ ῶ ∷ ν ∷ α ∷ []) "1Tim.6.12"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.6.12"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.6.12"
∷ word (ἐ ∷ π ∷ ι ∷ ∙λ ∷ α ∷ β ∷ ο ∷ ῦ ∷ []) "1Tim.6.12"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.6.12"
∷ word (α ∷ ἰ ∷ ω ∷ ν ∷ ί ∷ ο ∷ υ ∷ []) "1Tim.6.12"
∷ word (ζ ∷ ω ∷ ῆ ∷ ς ∷ []) "1Tim.6.12"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.6.12"
∷ word (ἣ ∷ ν ∷ []) "1Tim.6.12"
∷ word (ἐ ∷ κ ∷ ∙λ ∷ ή ∷ θ ∷ η ∷ ς ∷ []) "1Tim.6.12"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.12"
∷ word (ὡ ∷ μ ∷ ο ∷ ∙λ ∷ ό ∷ γ ∷ η ∷ σ ∷ α ∷ ς ∷ []) "1Tim.6.12"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.6.12"
∷ word (κ ∷ α ∷ ∙λ ∷ ὴ ∷ ν ∷ []) "1Tim.6.12"
∷ word (ὁ ∷ μ ∷ ο ∷ ∙λ ∷ ο ∷ γ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.6.12"
∷ word (ἐ ∷ ν ∷ ώ ∷ π ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.6.12"
∷ word (π ∷ ο ∷ ∙λ ∷ ∙λ ∷ ῶ ∷ ν ∷ []) "1Tim.6.12"
∷ word (μ ∷ α ∷ ρ ∷ τ ∷ ύ ∷ ρ ∷ ω ∷ ν ∷ []) "1Tim.6.12"
∷ word (π ∷ α ∷ ρ ∷ α ∷ γ ∷ γ ∷ έ ∷ ∙λ ∷ ∙λ ∷ ω ∷ []) "1Tim.6.13"
∷ word (σ ∷ ο ∷ ι ∷ []) "1Tim.6.13"
∷ word (ἐ ∷ ν ∷ ώ ∷ π ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.6.13"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.6.13"
∷ word (θ ∷ ε ∷ ο ∷ ῦ ∷ []) "1Tim.6.13"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.6.13"
∷ word (ζ ∷ ῳ ∷ ο ∷ γ ∷ ο ∷ ν ∷ ο ∷ ῦ ∷ ν ∷ τ ∷ ο ∷ ς ∷ []) "1Tim.6.13"
∷ word (τ ∷ ὰ ∷ []) "1Tim.6.13"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ α ∷ []) "1Tim.6.13"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.13"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.6.13"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.6.13"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.6.13"
∷ word (μ ∷ α ∷ ρ ∷ τ ∷ υ ∷ ρ ∷ ή ∷ σ ∷ α ∷ ν ∷ τ ∷ ο ∷ ς ∷ []) "1Tim.6.13"
∷ word (ἐ ∷ π ∷ ὶ ∷ []) "1Tim.6.13"
∷ word (Π ∷ ο ∷ ν ∷ τ ∷ ί ∷ ο ∷ υ ∷ []) "1Tim.6.13"
∷ word (Π ∷ ι ∷ ∙λ ∷ ά ∷ τ ∷ ο ∷ υ ∷ []) "1Tim.6.13"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.6.13"
∷ word (κ ∷ α ∷ ∙λ ∷ ὴ ∷ ν ∷ []) "1Tim.6.13"
∷ word (ὁ ∷ μ ∷ ο ∷ ∙λ ∷ ο ∷ γ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.6.13"
∷ word (τ ∷ η ∷ ρ ∷ ῆ ∷ σ ∷ α ∷ ί ∷ []) "1Tim.6.14"
∷ word (σ ∷ ε ∷ []) "1Tim.6.14"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.6.14"
∷ word (ἐ ∷ ν ∷ τ ∷ ο ∷ ∙λ ∷ ὴ ∷ ν ∷ []) "1Tim.6.14"
∷ word (ἄ ∷ σ ∷ π ∷ ι ∷ ∙λ ∷ ο ∷ ν ∷ []) "1Tim.6.14"
∷ word (ἀ ∷ ν ∷ ε ∷ π ∷ ί ∷ ∙λ ∷ η ∷ μ ∷ π ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.6.14"
∷ word (μ ∷ έ ∷ χ ∷ ρ ∷ ι ∷ []) "1Tim.6.14"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.6.14"
∷ word (ἐ ∷ π ∷ ι ∷ φ ∷ α ∷ ν ∷ ε ∷ ί ∷ α ∷ ς ∷ []) "1Tim.6.14"
∷ word (τ ∷ ο ∷ ῦ ∷ []) "1Tim.6.14"
∷ word (κ ∷ υ ∷ ρ ∷ ί ∷ ο ∷ υ ∷ []) "1Tim.6.14"
∷ word (ἡ ∷ μ ∷ ῶ ∷ ν ∷ []) "1Tim.6.14"
∷ word (Ἰ ∷ η ∷ σ ∷ ο ∷ ῦ ∷ []) "1Tim.6.14"
∷ word (Χ ∷ ρ ∷ ι ∷ σ ∷ τ ∷ ο ∷ ῦ ∷ []) "1Tim.6.14"
∷ word (ἣ ∷ ν ∷ []) "1Tim.6.15"
∷ word (κ ∷ α ∷ ι ∷ ρ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.6.15"
∷ word (ἰ ∷ δ ∷ ί ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.6.15"
∷ word (δ ∷ ε ∷ ί ∷ ξ ∷ ε ∷ ι ∷ []) "1Tim.6.15"
∷ word (ὁ ∷ []) "1Tim.6.15"
∷ word (μ ∷ α ∷ κ ∷ ά ∷ ρ ∷ ι ∷ ο ∷ ς ∷ []) "1Tim.6.15"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.15"
∷ word (μ ∷ ό ∷ ν ∷ ο ∷ ς ∷ []) "1Tim.6.15"
∷ word (δ ∷ υ ∷ ν ∷ ά ∷ σ ∷ τ ∷ η ∷ ς ∷ []) "1Tim.6.15"
∷ word (ὁ ∷ []) "1Tim.6.15"
∷ word (β ∷ α ∷ σ ∷ ι ∷ ∙λ ∷ ε ∷ ὺ ∷ ς ∷ []) "1Tim.6.15"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.6.15"
∷ word (β ∷ α ∷ σ ∷ ι ∷ ∙λ ∷ ε ∷ υ ∷ ό ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.6.15"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.15"
∷ word (κ ∷ ύ ∷ ρ ∷ ι ∷ ο ∷ ς ∷ []) "1Tim.6.15"
∷ word (τ ∷ ῶ ∷ ν ∷ []) "1Tim.6.15"
∷ word (κ ∷ υ ∷ ρ ∷ ι ∷ ε ∷ υ ∷ ό ∷ ν ∷ τ ∷ ω ∷ ν ∷ []) "1Tim.6.15"
∷ word (ὁ ∷ []) "1Tim.6.16"
∷ word (μ ∷ ό ∷ ν ∷ ο ∷ ς ∷ []) "1Tim.6.16"
∷ word (ἔ ∷ χ ∷ ω ∷ ν ∷ []) "1Tim.6.16"
∷ word (ἀ ∷ θ ∷ α ∷ ν ∷ α ∷ σ ∷ ί ∷ α ∷ ν ∷ []) "1Tim.6.16"
∷ word (φ ∷ ῶ ∷ ς ∷ []) "1Tim.6.16"
∷ word (ο ∷ ἰ ∷ κ ∷ ῶ ∷ ν ∷ []) "1Tim.6.16"
∷ word (ἀ ∷ π ∷ ρ ∷ ό ∷ σ ∷ ι ∷ τ ∷ ο ∷ ν ∷ []) "1Tim.6.16"
∷ word (ὃ ∷ ν ∷ []) "1Tim.6.16"
∷ word (ε ∷ ἶ ∷ δ ∷ ε ∷ ν ∷ []) "1Tim.6.16"
∷ word (ο ∷ ὐ ∷ δ ∷ ε ∷ ὶ ∷ ς ∷ []) "1Tim.6.16"
∷ word (ἀ ∷ ν ∷ θ ∷ ρ ∷ ώ ∷ π ∷ ω ∷ ν ∷ []) "1Tim.6.16"
∷ word (ο ∷ ὐ ∷ δ ∷ ὲ ∷ []) "1Tim.6.16"
∷ word (ἰ ∷ δ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.6.16"
∷ word (δ ∷ ύ ∷ ν ∷ α ∷ τ ∷ α ∷ ι ∷ []) "1Tim.6.16"
∷ word (ᾧ ∷ []) "1Tim.6.16"
∷ word (τ ∷ ι ∷ μ ∷ ὴ ∷ []) "1Tim.6.16"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.16"
∷ word (κ ∷ ρ ∷ ά ∷ τ ∷ ο ∷ ς ∷ []) "1Tim.6.16"
∷ word (α ∷ ἰ ∷ ώ ∷ ν ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.6.16"
∷ word (ἀ ∷ μ ∷ ή ∷ ν ∷ []) "1Tim.6.16"
∷ word (Τ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.6.17"
∷ word (π ∷ ∙λ ∷ ο ∷ υ ∷ σ ∷ ί ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.6.17"
∷ word (ἐ ∷ ν ∷ []) "1Tim.6.17"
∷ word (τ ∷ ῷ ∷ []) "1Tim.6.17"
∷ word (ν ∷ ῦ ∷ ν ∷ []) "1Tim.6.17"
∷ word (α ∷ ἰ ∷ ῶ ∷ ν ∷ ι ∷ []) "1Tim.6.17"
∷ word (π ∷ α ∷ ρ ∷ ά ∷ γ ∷ γ ∷ ε ∷ ∙λ ∷ ∙λ ∷ ε ∷ []) "1Tim.6.17"
∷ word (μ ∷ ὴ ∷ []) "1Tim.6.17"
∷ word (ὑ ∷ ψ ∷ η ∷ ∙λ ∷ ο ∷ φ ∷ ρ ∷ ο ∷ ν ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.6.17"
∷ word (μ ∷ η ∷ δ ∷ ὲ ∷ []) "1Tim.6.17"
∷ word (ἠ ∷ ∙λ ∷ π ∷ ι ∷ κ ∷ έ ∷ ν ∷ α ∷ ι ∷ []) "1Tim.6.17"
∷ word (ἐ ∷ π ∷ ὶ ∷ []) "1Tim.6.17"
∷ word (π ∷ ∙λ ∷ ο ∷ ύ ∷ τ ∷ ο ∷ υ ∷ []) "1Tim.6.17"
∷ word (ἀ ∷ δ ∷ η ∷ ∙λ ∷ ό ∷ τ ∷ η ∷ τ ∷ ι ∷ []) "1Tim.6.17"
∷ word (ἀ ∷ ∙λ ∷ ∙λ ∷ []) "1Tim.6.17"
∷ word (ἐ ∷ π ∷ ὶ ∷ []) "1Tim.6.17"
∷ word (θ ∷ ε ∷ ῷ ∷ []) "1Tim.6.17"
∷ word (τ ∷ ῷ ∷ []) "1Tim.6.17"
∷ word (π ∷ α ∷ ρ ∷ έ ∷ χ ∷ ο ∷ ν ∷ τ ∷ ι ∷ []) "1Tim.6.17"
∷ word (ἡ ∷ μ ∷ ῖ ∷ ν ∷ []) "1Tim.6.17"
∷ word (π ∷ ά ∷ ν ∷ τ ∷ α ∷ []) "1Tim.6.17"
∷ word (π ∷ ∙λ ∷ ο ∷ υ ∷ σ ∷ ί ∷ ω ∷ ς ∷ []) "1Tim.6.17"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.6.17"
∷ word (ἀ ∷ π ∷ ό ∷ ∙λ ∷ α ∷ υ ∷ σ ∷ ι ∷ ν ∷ []) "1Tim.6.17"
∷ word (ἀ ∷ γ ∷ α ∷ θ ∷ ο ∷ ε ∷ ρ ∷ γ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.6.18"
∷ word (π ∷ ∙λ ∷ ο ∷ υ ∷ τ ∷ ε ∷ ῖ ∷ ν ∷ []) "1Tim.6.18"
∷ word (ἐ ∷ ν ∷ []) "1Tim.6.18"
∷ word (ἔ ∷ ρ ∷ γ ∷ ο ∷ ι ∷ ς ∷ []) "1Tim.6.18"
∷ word (κ ∷ α ∷ ∙λ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.6.18"
∷ word (ε ∷ ὐ ∷ μ ∷ ε ∷ τ ∷ α ∷ δ ∷ ό ∷ τ ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.6.18"
∷ word (ε ∷ ἶ ∷ ν ∷ α ∷ ι ∷ []) "1Tim.6.18"
∷ word (κ ∷ ο ∷ ι ∷ ν ∷ ω ∷ ν ∷ ι ∷ κ ∷ ο ∷ ύ ∷ ς ∷ []) "1Tim.6.18"
∷ word (ἀ ∷ π ∷ ο ∷ θ ∷ η ∷ σ ∷ α ∷ υ ∷ ρ ∷ ί ∷ ζ ∷ ο ∷ ν ∷ τ ∷ α ∷ ς ∷ []) "1Tim.6.19"
∷ word (ἑ ∷ α ∷ υ ∷ τ ∷ ο ∷ ῖ ∷ ς ∷ []) "1Tim.6.19"
∷ word (θ ∷ ε ∷ μ ∷ έ ∷ ∙λ ∷ ι ∷ ο ∷ ν ∷ []) "1Tim.6.19"
∷ word (κ ∷ α ∷ ∙λ ∷ ὸ ∷ ν ∷ []) "1Tim.6.19"
∷ word (ε ∷ ἰ ∷ ς ∷ []) "1Tim.6.19"
∷ word (τ ∷ ὸ ∷ []) "1Tim.6.19"
∷ word (μ ∷ έ ∷ ∙λ ∷ ∙λ ∷ ο ∷ ν ∷ []) "1Tim.6.19"
∷ word (ἵ ∷ ν ∷ α ∷ []) "1Tim.6.19"
∷ word (ἐ ∷ π ∷ ι ∷ ∙λ ∷ ά ∷ β ∷ ω ∷ ν ∷ τ ∷ α ∷ ι ∷ []) "1Tim.6.19"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.6.19"
∷ word (ὄ ∷ ν ∷ τ ∷ ω ∷ ς ∷ []) "1Tim.6.19"
∷ word (ζ ∷ ω ∷ ῆ ∷ ς ∷ []) "1Tim.6.19"
∷ word (Ὦ ∷ []) "1Tim.6.20"
∷ word (Τ ∷ ι ∷ μ ∷ ό ∷ θ ∷ ε ∷ ε ∷ []) "1Tim.6.20"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.6.20"
∷ word (π ∷ α ∷ ρ ∷ α ∷ θ ∷ ή ∷ κ ∷ η ∷ ν ∷ []) "1Tim.6.20"
∷ word (φ ∷ ύ ∷ ∙λ ∷ α ∷ ξ ∷ ο ∷ ν ∷ []) "1Tim.6.20"
∷ word (ἐ ∷ κ ∷ τ ∷ ρ ∷ ε ∷ π ∷ ό ∷ μ ∷ ε ∷ ν ∷ ο ∷ ς ∷ []) "1Tim.6.20"
∷ word (τ ∷ ὰ ∷ ς ∷ []) "1Tim.6.20"
∷ word (β ∷ ε ∷ β ∷ ή ∷ ∙λ ∷ ο ∷ υ ∷ ς ∷ []) "1Tim.6.20"
∷ word (κ ∷ ε ∷ ν ∷ ο ∷ φ ∷ ω ∷ ν ∷ ί ∷ α ∷ ς ∷ []) "1Tim.6.20"
∷ word (κ ∷ α ∷ ὶ ∷ []) "1Tim.6.20"
∷ word (ἀ ∷ ν ∷ τ ∷ ι ∷ θ ∷ έ ∷ σ ∷ ε ∷ ι ∷ ς ∷ []) "1Tim.6.20"
∷ word (τ ∷ ῆ ∷ ς ∷ []) "1Tim.6.20"
∷ word (ψ ∷ ε ∷ υ ∷ δ ∷ ω ∷ ν ∷ ύ ∷ μ ∷ ο ∷ υ ∷ []) "1Tim.6.20"
∷ word (γ ∷ ν ∷ ώ ∷ σ ∷ ε ∷ ω ∷ ς ∷ []) "1Tim.6.20"
∷ word (ἥ ∷ ν ∷ []) "1Tim.6.21"
∷ word (τ ∷ ι ∷ ν ∷ ε ∷ ς ∷ []) "1Tim.6.21"
∷ word (ἐ ∷ π ∷ α ∷ γ ∷ γ ∷ ε ∷ ∙λ ∷ ∙λ ∷ ό ∷ μ ∷ ε ∷ ν ∷ ο ∷ ι ∷ []) "1Tim.6.21"
∷ word (π ∷ ε ∷ ρ ∷ ὶ ∷ []) "1Tim.6.21"
∷ word (τ ∷ ὴ ∷ ν ∷ []) "1Tim.6.21"
∷ word (π ∷ ί ∷ σ ∷ τ ∷ ι ∷ ν ∷ []) "1Tim.6.21"
∷ word (ἠ ∷ σ ∷ τ ∷ ό ∷ χ ∷ η ∷ σ ∷ α ∷ ν ∷ []) "1Tim.6.21"
∷ word (Ἡ ∷ []) "1Tim.6.21"
∷ word (χ ∷ ά ∷ ρ ∷ ι ∷ ς ∷ []) "1Tim.6.21"
∷ word (μ ∷ ε ∷ θ ∷ []) "1Tim.6.21"
∷ word (ὑ ∷ μ ∷ ῶ ∷ ν ∷ []) "1Tim.6.21"
∷ []
| 47.752185
| 92
| 0.336972
|
0dea82be1e24d2f6cd79792e2ff76042be139beb
| 3,099
|
agda
|
Agda
|
examples/lib/Data/Fin.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
examples/lib/Data/Fin.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
examples/lib/Data/Fin.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
module Data.Fin where
open import Data.Nat hiding (_==_; _<_)
open import Data.Bool
open import Logic.Identity
open import Logic.Base
data Fin : Nat -> Set where
fzero : {n : Nat} -> Fin (suc n)
fsuc : {n : Nat} -> Fin n -> Fin (suc n)
pred : {n : Nat} -> Fin (suc (suc n)) -> Fin (suc n)
pred fzero = fzero
pred (fsuc i) = i
fzero≠fsuc : {n : Nat}{i : Fin n} -> fzero ≢ fsuc i
fzero≠fsuc ()
fsuc-inj : {n : Nat}{i j : Fin n} -> fsuc i ≡ fsuc j -> i ≡ j
fsuc-inj refl = refl
_==_ : {n : Nat}(i j : Fin n) -> (i ≡ j) \/ (i ≢ j)
fzero == fzero = \/-IL refl
fzero == fsuc j = \/-IR fzero≠fsuc
fsuc i == fzero = \/-IR (sym≢ fzero≠fsuc)
fsuc i == fsuc j = aux i j (i == j)
where
aux : {n : Nat}(i j : Fin n) -> (i ≡ j) \/ (i ≢ j) -> (fsuc i ≡ fsuc j) \/ (fsuc i ≢ fsuc j)
aux i .i (\/-IL refl) = \/-IL refl
aux i j (\/-IR i≠j) = \/-IR \si=sj -> i≠j (fsuc-inj si=sj)
_<_ : {n : Nat} -> Fin n -> Fin n -> Bool
_ < fzero = false
fzero < fsuc j = true
fsuc i < fsuc j = i < j
fromNat : (n : Nat) -> Fin (suc n)
fromNat zero = fzero
fromNat (suc n) = fsuc (fromNat n)
liftSuc : {n : Nat} -> Fin n -> Fin (suc n)
liftSuc fzero = fzero
liftSuc (fsuc i) = fsuc (liftSuc i)
lift+ : {n : Nat}(m : Nat) -> Fin n -> Fin (m + n)
lift+ zero i = i
lift+ (suc m) i = liftSuc (lift+ m i)
thin : {n : Nat} -> Fin (suc n) -> Fin n -> Fin (suc n)
thin fzero i = fsuc i
thin (fsuc j) fzero = fzero
thin (fsuc j) (fsuc i) = fsuc (thin j i)
-- Two elements of Fin n are either the same or one is the thinning of
-- something with respect to the other.
data ThinView : {n : Nat}(i j : Fin n) -> Set where
same : {n : Nat}{i : Fin n} -> ThinView i i
diff : {n : Nat}{i : Fin (suc n)}(j : Fin n) -> ThinView i (thin i j)
thinView : {n : Nat}(i j : Fin n) -> ThinView i j
thinView {suc _} fzero fzero = same
thinView {suc _} fzero (fsuc j) = diff j
thinView {suc zero} (fsuc ()) fzero
thinView {suc (suc _)} (fsuc i) fzero = diff fzero
thinView (fsuc i) (fsuc j) = aux i j (thinView i j)
where
aux : {n : Nat}(i j : Fin n) -> ThinView i j -> ThinView (fsuc i) (fsuc j)
aux i .i same = same
aux i .(thin i j) (diff j) = diff (fsuc j)
thin-ij≠i : {n : Nat}(i : Fin (suc n))(j : Fin n) -> thin i j ≢ i
thin-ij≠i fzero j ()
thin-ij≠i (fsuc i) fzero ()
thin-ij≠i (fsuc i) (fsuc j) eq = thin-ij≠i i j (fsuc-inj eq)
-- Thickening.
-- thin i (thick i j) ≡ j ?
-- thick i (thin i j) ≡ j
thick : {n : Nat}(i j : Fin (suc n)) -> i ≢ j -> Fin n
thick i j i≠j = thick' i j i≠j (thinView i j) where
thick' : {n : Nat}(i j : Fin (suc n)) -> i ≢ j -> ThinView i j -> Fin n
thick' i .i i≠i same = elim-False (i≠i refl)
thick' i .(thin i j) _ (diff j) = j
-- thin∘thick=id : {n : Nat}(i j : Fin (suc n))(p : i ≢ j) ->
-- thin i (thick i j p) ≡ j
-- thin∘thick=id i j p = ?
--
-- thick∘thin=id : {n : Nat}(i : Fin (suc n))(j : Fin n) ->
-- thick i (thin i j) (sym≢ (thin-ij≠i i j)) ≡ j
-- thick∘thin=id i j = ?
--
| 32.968085
| 96
| 0.516618
|
1165fdaae48621990fc7f0a84c06691366a2b107
| 29,213
|
agda
|
Agda
|
prototyping/Properties/StrictMode.agda
|
EtiTheSpirit/luau
|
d37d0c857ba543ea47f0b8fce5678f7aadf5239e
|
[
"MIT"
] | null | null | null |
prototyping/Properties/StrictMode.agda
|
EtiTheSpirit/luau
|
d37d0c857ba543ea47f0b8fce5678f7aadf5239e
|
[
"MIT"
] | null | null | null |
prototyping/Properties/StrictMode.agda
|
EtiTheSpirit/luau
|
d37d0c857ba543ea47f0b8fce5678f7aadf5239e
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --rewriting #-}
module Properties.StrictMode where
import Agda.Builtin.Equality.Rewrite
open import Agda.Builtin.Equality using (_≡_; refl)
open import FFI.Data.Either using (Either; Left; Right; mapL; mapR; mapLR; swapLR; cond)
open import FFI.Data.Maybe using (Maybe; just; nothing)
open import Luau.Heap using (Heap; Object; function_is_end; defn; alloc; ok; next; lookup-not-allocated) renaming (_≡_⊕_↦_ to _≡ᴴ_⊕_↦_; _[_] to _[_]ᴴ; ∅ to ∅ᴴ)
open import Luau.StrictMode using (Warningᴱ; Warningᴮ; Warningᴼ; Warningᴴ; UnallocatedAddress; UnboundVariable; FunctionCallMismatch; app₁; app₂; BinOpMismatch₁; BinOpMismatch₂; bin₁; bin₂; BlockMismatch; block₁; return; LocalVarMismatch; local₁; local₂; FunctionDefnMismatch; function₁; function₂; heap; expr; block; addr)
open import Luau.Substitution using (_[_/_]ᴮ; _[_/_]ᴱ; _[_/_]ᴮunless_; var_[_/_]ᴱwhenever_)
open import Luau.Subtyping using (_≮:_; witness; unknown; never; scalar; function; scalar-function; scalar-function-ok; scalar-function-err; scalar-scalar; function-scalar; function-ok; function-err; left; right; _,_; Tree; Language; ¬Language)
open import Luau.Syntax using (Expr; yes; var; val; var_∈_; _⟨_⟩∈_; _$_; addr; number; bool; string; binexp; nil; function_is_end; block_is_end; done; return; local_←_; _∙_; fun; arg; name; ==; ~=)
open import Luau.Type using (Type; strict; nil; number; boolean; string; _⇒_; never; unknown; _∩_; _∪_; tgt; _≡ᵀ_; _≡ᴹᵀ_)
open import Luau.TypeCheck(strict) using (_⊢ᴮ_∈_; _⊢ᴱ_∈_; _⊢ᴴᴮ_▷_∈_; _⊢ᴴᴱ_▷_∈_; nil; var; addr; app; function; block; done; return; local; orUnknown; srcBinOp; tgtBinOp)
open import Luau.Var using (_≡ⱽ_)
open import Luau.Addr using (_≡ᴬ_)
open import Luau.VarCtxt using (VarCtxt; ∅; _⋒_; _↦_; _⊕_↦_; _⊝_; ⊕-lookup-miss; ⊕-swap; ⊕-over) renaming (_[_] to _[_]ⱽ)
open import Luau.VarCtxt using (VarCtxt; ∅)
open import Properties.Remember using (remember; _,_)
open import Properties.Equality using (_≢_; sym; cong; trans; subst₁)
open import Properties.Dec using (Dec; yes; no)
open import Properties.Contradiction using (CONTRADICTION; ¬)
open import Properties.Functions using (_∘_)
open import Properties.Subtyping using (unknown-≮:; ≡-trans-≮:; ≮:-trans-≡; never-tgt-≮:; tgt-never-≮:; src-unknown-≮:; unknown-src-≮:; ≮:-trans; ≮:-refl; scalar-≢-impl-≮:; function-≮:-scalar; scalar-≮:-function; function-≮:-never; unknown-≮:-scalar; scalar-≮:-never; unknown-≮:-never)
open import Properties.TypeCheck(strict) using (typeOfᴼ; typeOfᴹᴼ; typeOfⱽ; typeOfᴱ; typeOfᴮ; typeCheckᴱ; typeCheckᴮ; typeCheckᴼ; typeCheckᴴ)
open import Luau.OpSem using (_⟦_⟧_⟶_; _⊢_⟶*_⊣_; _⊢_⟶ᴮ_⊣_; _⊢_⟶ᴱ_⊣_; app₁; app₂; function; beta; return; block; done; local; subst; binOp₀; binOp₁; binOp₂; refl; step; +; -; *; /; <; >; ==; ~=; <=; >=; ··)
open import Luau.RuntimeError using (BinOpError; RuntimeErrorᴱ; RuntimeErrorᴮ; FunctionMismatch; BinOpMismatch₁; BinOpMismatch₂; UnboundVariable; SEGV; app₁; app₂; bin₁; bin₂; block; local; return; +; -; *; /; <; >; <=; >=; ··)
open import Luau.RuntimeType using (RuntimeType; valueType; number; string; boolean; nil; function)
src = Luau.Type.src strict
data _⊑_ (H : Heap yes) : Heap yes → Set where
refl : (H ⊑ H)
snoc : ∀ {H′ a O} → (H′ ≡ᴴ H ⊕ a ↦ O) → (H ⊑ H′)
rednᴱ⊑ : ∀ {H H′ M M′} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → (H ⊑ H′)
rednᴮ⊑ : ∀ {H H′ B B′} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → (H ⊑ H′)
rednᴱ⊑ (function a p) = snoc p
rednᴱ⊑ (app₁ s) = rednᴱ⊑ s
rednᴱ⊑ (app₂ p s) = rednᴱ⊑ s
rednᴱ⊑ (beta O v p q) = refl
rednᴱ⊑ (block s) = rednᴮ⊑ s
rednᴱ⊑ (return v) = refl
rednᴱ⊑ done = refl
rednᴱ⊑ (binOp₀ p) = refl
rednᴱ⊑ (binOp₁ s) = rednᴱ⊑ s
rednᴱ⊑ (binOp₂ s) = rednᴱ⊑ s
rednᴮ⊑ (local s) = rednᴱ⊑ s
rednᴮ⊑ (subst v) = refl
rednᴮ⊑ (function a p) = snoc p
rednᴮ⊑ (return s) = rednᴱ⊑ s
data LookupResult (H : Heap yes) a V : Set where
just : (H [ a ]ᴴ ≡ just V) → LookupResult H a V
nothing : (H [ a ]ᴴ ≡ nothing) → LookupResult H a V
lookup-⊑-nothing : ∀ {H H′} a → (H ⊑ H′) → (H′ [ a ]ᴴ ≡ nothing) → (H [ a ]ᴴ ≡ nothing)
lookup-⊑-nothing {H} a refl p = p
lookup-⊑-nothing {H} a (snoc defn) p with a ≡ᴬ next H
lookup-⊑-nothing {H} a (snoc defn) p | yes refl = refl
lookup-⊑-nothing {H} a (snoc o) p | no q = trans (lookup-not-allocated o q) p
heap-weakeningᴱ : ∀ Γ H M {H′ U} → (H ⊑ H′) → (typeOfᴱ H′ Γ M ≮: U) → (typeOfᴱ H Γ M ≮: U)
heap-weakeningᴱ Γ H (var x) h p = p
heap-weakeningᴱ Γ H (val nil) h p = p
heap-weakeningᴱ Γ H (val (addr a)) refl p = p
heap-weakeningᴱ Γ H (val (addr a)) (snoc {a = b} q) p with a ≡ᴬ b
heap-weakeningᴱ Γ H (val (addr a)) (snoc {a = a} defn) p | yes refl = unknown-≮: p
heap-weakeningᴱ Γ H (val (addr a)) (snoc {a = b} q) p | no r = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ (lookup-not-allocated q r))) p
heap-weakeningᴱ Γ H (val (number x)) h p = p
heap-weakeningᴱ Γ H (val (bool x)) h p = p
heap-weakeningᴱ Γ H (val (string x)) h p = p
heap-weakeningᴱ Γ H (M $ N) h p = never-tgt-≮: (heap-weakeningᴱ Γ H M h (tgt-never-≮: p))
heap-weakeningᴱ Γ H (function f ⟨ var x ∈ T ⟩∈ U is B end) h p = p
heap-weakeningᴱ Γ H (block var b ∈ T is B end) h p = p
heap-weakeningᴱ Γ H (binexp M op N) h p = p
heap-weakeningᴮ : ∀ Γ H B {H′ U} → (H ⊑ H′) → (typeOfᴮ H′ Γ B ≮: U) → (typeOfᴮ H Γ B ≮: U)
heap-weakeningᴮ Γ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h p = heap-weakeningᴮ (Γ ⊕ f ↦ (T ⇒ U)) H B h p
heap-weakeningᴮ Γ H (local var x ∈ T ← M ∙ B) h p = heap-weakeningᴮ (Γ ⊕ x ↦ T) H B h p
heap-weakeningᴮ Γ H (return M ∙ B) h p = heap-weakeningᴱ Γ H M h p
heap-weakeningᴮ Γ H done h p = p
substitutivityᴱ : ∀ {Γ T U} H M v x → (typeOfᴱ H Γ (M [ v / x ]ᴱ) ≮: U) → Either (typeOfᴱ H (Γ ⊕ x ↦ T) M ≮: U) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴱ-whenever : ∀ {Γ T U} H v x y (r : Dec(x ≡ y)) → (typeOfᴱ H Γ (var y [ v / x ]ᴱwhenever r) ≮: U) → Either (typeOfᴱ H (Γ ⊕ x ↦ T) (var y) ≮: U) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴮ : ∀ {Γ T U} H B v x → (typeOfᴮ H Γ (B [ v / x ]ᴮ) ≮: U) → Either (typeOfᴮ H (Γ ⊕ x ↦ T) B ≮: U) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴮ-unless : ∀ {Γ T U V} H B v x y (r : Dec(x ≡ y)) → (typeOfᴮ H (Γ ⊕ y ↦ U) (B [ v / x ]ᴮunless r) ≮: V) → Either (typeOfᴮ H ((Γ ⊕ x ↦ T) ⊕ y ↦ U) B ≮: V) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴮ-unless-yes : ∀ {Γ Γ′ T V} H B v x y (r : x ≡ y) → (Γ′ ≡ Γ) → (typeOfᴮ H Γ (B [ v / x ]ᴮunless yes r) ≮: V) → Either (typeOfᴮ H Γ′ B ≮: V) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴮ-unless-no : ∀ {Γ Γ′ T V} H B v x y (r : x ≢ y) → (Γ′ ≡ Γ ⊕ x ↦ T) → (typeOfᴮ H Γ (B [ v / x ]ᴮunless no r) ≮: V) → Either (typeOfᴮ H Γ′ B ≮: V) (typeOfᴱ H ∅ (val v) ≮: T)
substitutivityᴱ H (var y) v x p = substitutivityᴱ-whenever H v x y (x ≡ⱽ y) p
substitutivityᴱ H (val w) v x p = Left p
substitutivityᴱ H (binexp M op N) v x p = Left p
substitutivityᴱ H (M $ N) v x p = mapL never-tgt-≮: (substitutivityᴱ H M v x (tgt-never-≮: p))
substitutivityᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x p = Left p
substitutivityᴱ H (block var b ∈ T is B end) v x p = Left p
substitutivityᴱ-whenever H v x x (yes refl) q = swapLR (≮:-trans q)
substitutivityᴱ-whenever H v x y (no p) q = Left (≡-trans-≮: (cong orUnknown (sym (⊕-lookup-miss x y _ _ p))) q)
substitutivityᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x p = substitutivityᴮ-unless H B v x f (x ≡ⱽ f) p
substitutivityᴮ H (local var y ∈ T ← M ∙ B) v x p = substitutivityᴮ-unless H B v x y (x ≡ⱽ y) p
substitutivityᴮ H (return M ∙ B) v x p = substitutivityᴱ H M v x p
substitutivityᴮ H done v x p = Left p
substitutivityᴮ-unless H B v x y (yes p) q = substitutivityᴮ-unless-yes H B v x y p (⊕-over p) q
substitutivityᴮ-unless H B v x y (no p) q = substitutivityᴮ-unless-no H B v x y p (⊕-swap p) q
substitutivityᴮ-unless-yes H B v x y refl refl p = Left p
substitutivityᴮ-unless-no H B v x y p refl q = substitutivityᴮ H B v x q
binOpPreservation : ∀ H {op v w x} → (v ⟦ op ⟧ w ⟶ x) → (tgtBinOp op ≡ typeOfᴱ H ∅ (val x))
binOpPreservation H (+ m n) = refl
binOpPreservation H (- m n) = refl
binOpPreservation H (/ m n) = refl
binOpPreservation H (* m n) = refl
binOpPreservation H (< m n) = refl
binOpPreservation H (> m n) = refl
binOpPreservation H (<= m n) = refl
binOpPreservation H (>= m n) = refl
binOpPreservation H (== v w) = refl
binOpPreservation H (~= v w) = refl
binOpPreservation H (·· v w) = refl
reflect-subtypingᴱ : ∀ H M {H′ M′ T} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → (typeOfᴱ H′ ∅ M′ ≮: T) → Either (typeOfᴱ H ∅ M ≮: T) (Warningᴱ H (typeCheckᴱ H ∅ M))
reflect-subtypingᴮ : ∀ H B {H′ B′ T} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → (typeOfᴮ H′ ∅ B′ ≮: T) → Either (typeOfᴮ H ∅ B ≮: T) (Warningᴮ H (typeCheckᴮ H ∅ B))
reflect-subtypingᴱ H (M $ N) (app₁ s) p = mapLR never-tgt-≮: app₁ (reflect-subtypingᴱ H M s (tgt-never-≮: p))
reflect-subtypingᴱ H (M $ N) (app₂ v s) p = Left (never-tgt-≮: (heap-weakeningᴱ ∅ H M (rednᴱ⊑ s) (tgt-never-≮: p)))
reflect-subtypingᴱ H (M $ N) (beta (function f ⟨ var y ∈ T ⟩∈ U is B end) v refl q) p = Left (≡-trans-≮: (cong tgt (cong orUnknown (cong typeOfᴹᴼ q))) p)
reflect-subtypingᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) p = Left p
reflect-subtypingᴱ H (block var b ∈ T is B end) (block s) p = Left p
reflect-subtypingᴱ H (block var b ∈ T is return (val v) ∙ B end) (return v) p = mapR BlockMismatch (swapLR (≮:-trans p))
reflect-subtypingᴱ H (block var b ∈ T is done end) done p = mapR BlockMismatch (swapLR (≮:-trans p))
reflect-subtypingᴱ H (binexp M op N) (binOp₀ s) p = Left (≡-trans-≮: (binOpPreservation H s) p)
reflect-subtypingᴱ H (binexp M op N) (binOp₁ s) p = Left p
reflect-subtypingᴱ H (binexp M op N) (binOp₂ s) p = Left p
reflect-subtypingᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a defn) p = mapLR (heap-weakeningᴮ _ _ B (snoc defn)) (CONTRADICTION ∘ ≮:-refl) (substitutivityᴮ _ B (addr a) f p)
reflect-subtypingᴮ H (local var x ∈ T ← M ∙ B) (local s) p = Left (heap-weakeningᴮ (x ↦ T) H B (rednᴱ⊑ s) p)
reflect-subtypingᴮ H (local var x ∈ T ← M ∙ B) (subst v) p = mapR LocalVarMismatch (substitutivityᴮ H B v x p)
reflect-subtypingᴮ H (return M ∙ B) (return s) p = mapR return (reflect-subtypingᴱ H M s p)
reflect-substitutionᴱ : ∀ {Γ T} H M v x → Warningᴱ H (typeCheckᴱ H Γ (M [ v / x ]ᴱ)) → Either (Warningᴱ H (typeCheckᴱ H (Γ ⊕ x ↦ T) M)) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴱ-whenever : ∀ {Γ T} H v x y (p : Dec(x ≡ y)) → Warningᴱ H (typeCheckᴱ H Γ (var y [ v / x ]ᴱwhenever p)) → Either (Warningᴱ H (typeCheckᴱ H (Γ ⊕ x ↦ T) (var y))) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴮ : ∀ {Γ T} H B v x → Warningᴮ H (typeCheckᴮ H Γ (B [ v / x ]ᴮ)) → Either (Warningᴮ H (typeCheckᴮ H (Γ ⊕ x ↦ T) B)) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴮ-unless : ∀ {Γ T U} H B v x y (r : Dec(x ≡ y)) → Warningᴮ H (typeCheckᴮ H (Γ ⊕ y ↦ U) (B [ v / x ]ᴮunless r)) → Either (Warningᴮ H (typeCheckᴮ H ((Γ ⊕ x ↦ T) ⊕ y ↦ U) B)) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴮ-unless-yes : ∀ {Γ Γ′ T} H B v x y (r : x ≡ y) → (Γ′ ≡ Γ) → Warningᴮ H (typeCheckᴮ H Γ (B [ v / x ]ᴮunless yes r)) → Either (Warningᴮ H (typeCheckᴮ H Γ′ B)) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴮ-unless-no : ∀ {Γ Γ′ T} H B v x y (r : x ≢ y) → (Γ′ ≡ Γ ⊕ x ↦ T) → Warningᴮ H (typeCheckᴮ H Γ (B [ v / x ]ᴮunless no r)) → Either (Warningᴮ H (typeCheckᴮ H Γ′ B)) (Either (Warningᴱ H (typeCheckᴱ H ∅ (val v))) (typeOfᴱ H ∅ (val v) ≮: T))
reflect-substitutionᴱ H (var y) v x W = reflect-substitutionᴱ-whenever H v x y (x ≡ⱽ y) W
reflect-substitutionᴱ H (val (addr a)) v x (UnallocatedAddress r) = Left (UnallocatedAddress r)
reflect-substitutionᴱ H (M $ N) v x (FunctionCallMismatch p) with substitutivityᴱ H N v x p
reflect-substitutionᴱ H (M $ N) v x (FunctionCallMismatch p) | Right W = Right (Right W)
reflect-substitutionᴱ H (M $ N) v x (FunctionCallMismatch p) | Left q with substitutivityᴱ H M v x (src-unknown-≮: q)
reflect-substitutionᴱ H (M $ N) v x (FunctionCallMismatch p) | Left q | Left r = Left ((FunctionCallMismatch ∘ unknown-src-≮: q) r)
reflect-substitutionᴱ H (M $ N) v x (FunctionCallMismatch p) | Left q | Right W = Right (Right W)
reflect-substitutionᴱ H (M $ N) v x (app₁ W) = mapL app₁ (reflect-substitutionᴱ H M v x W)
reflect-substitutionᴱ H (M $ N) v x (app₂ W) = mapL app₂ (reflect-substitutionᴱ H N v x W)
reflect-substitutionᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x (FunctionDefnMismatch q) = mapLR FunctionDefnMismatch Right (substitutivityᴮ-unless H B v x y (x ≡ⱽ y) q)
reflect-substitutionᴱ H (function f ⟨ var y ∈ T ⟩∈ U is B end) v x (function₁ W) = mapL function₁ (reflect-substitutionᴮ-unless H B v x y (x ≡ⱽ y) W)
reflect-substitutionᴱ H (block var b ∈ T is B end) v x (BlockMismatch q) = mapLR BlockMismatch Right (substitutivityᴮ H B v x q)
reflect-substitutionᴱ H (block var b ∈ T is B end) v x (block₁ W′) = mapL block₁ (reflect-substitutionᴮ H B v x W′)
reflect-substitutionᴱ H (binexp M op N) v x (BinOpMismatch₁ q) = mapLR BinOpMismatch₁ Right (substitutivityᴱ H M v x q)
reflect-substitutionᴱ H (binexp M op N) v x (BinOpMismatch₂ q) = mapLR BinOpMismatch₂ Right (substitutivityᴱ H N v x q)
reflect-substitutionᴱ H (binexp M op N) v x (bin₁ W) = mapL bin₁ (reflect-substitutionᴱ H M v x W)
reflect-substitutionᴱ H (binexp M op N) v x (bin₂ W) = mapL bin₂ (reflect-substitutionᴱ H N v x W)
reflect-substitutionᴱ-whenever H a x x (yes refl) (UnallocatedAddress p) = Right (Left (UnallocatedAddress p))
reflect-substitutionᴱ-whenever H v x y (no p) (UnboundVariable q) = Left (UnboundVariable (trans (sym (⊕-lookup-miss x y _ _ p)) q))
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x (FunctionDefnMismatch q) = mapLR FunctionDefnMismatch Right (substitutivityᴮ-unless H C v x y (x ≡ⱽ y) q)
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x (function₁ W) = mapL function₁ (reflect-substitutionᴮ-unless H C v x y (x ≡ⱽ y) W)
reflect-substitutionᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) v x (function₂ W) = mapL function₂ (reflect-substitutionᴮ-unless H B v x f (x ≡ⱽ f) W)
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x (LocalVarMismatch q) = mapLR LocalVarMismatch Right (substitutivityᴱ H M v x q)
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x (local₁ W) = mapL local₁ (reflect-substitutionᴱ H M v x W)
reflect-substitutionᴮ H (local var y ∈ T ← M ∙ B) v x (local₂ W) = mapL local₂ (reflect-substitutionᴮ-unless H B v x y (x ≡ⱽ y) W)
reflect-substitutionᴮ H (return M ∙ B) v x (return W) = mapL return (reflect-substitutionᴱ H M v x W)
reflect-substitutionᴮ-unless H B v x y (yes p) W = reflect-substitutionᴮ-unless-yes H B v x y p (⊕-over p) W
reflect-substitutionᴮ-unless H B v x y (no p) W = reflect-substitutionᴮ-unless-no H B v x y p (⊕-swap p) W
reflect-substitutionᴮ-unless-yes H B v x x refl refl W = Left W
reflect-substitutionᴮ-unless-no H B v x y p refl W = reflect-substitutionᴮ H B v x W
reflect-weakeningᴱ : ∀ Γ H M {H′} → (H ⊑ H′) → Warningᴱ H′ (typeCheckᴱ H′ Γ M) → Warningᴱ H (typeCheckᴱ H Γ M)
reflect-weakeningᴮ : ∀ Γ H B {H′} → (H ⊑ H′) → Warningᴮ H′ (typeCheckᴮ H′ Γ B) → Warningᴮ H (typeCheckᴮ H Γ B)
reflect-weakeningᴱ Γ H (var x) h (UnboundVariable p) = (UnboundVariable p)
reflect-weakeningᴱ Γ H (val (addr a)) h (UnallocatedAddress p) = UnallocatedAddress (lookup-⊑-nothing a h p)
reflect-weakeningᴱ Γ H (M $ N) h (FunctionCallMismatch p) = FunctionCallMismatch (heap-weakeningᴱ Γ H N h (unknown-src-≮: p (heap-weakeningᴱ Γ H M h (src-unknown-≮: p))))
reflect-weakeningᴱ Γ H (M $ N) h (app₁ W) = app₁ (reflect-weakeningᴱ Γ H M h W)
reflect-weakeningᴱ Γ H (M $ N) h (app₂ W) = app₂ (reflect-weakeningᴱ Γ H N h W)
reflect-weakeningᴱ Γ H (binexp M op N) h (BinOpMismatch₁ p) = BinOpMismatch₁ (heap-weakeningᴱ Γ H M h p)
reflect-weakeningᴱ Γ H (binexp M op N) h (BinOpMismatch₂ p) = BinOpMismatch₂ (heap-weakeningᴱ Γ H N h p)
reflect-weakeningᴱ Γ H (binexp M op N) h (bin₁ W′) = bin₁ (reflect-weakeningᴱ Γ H M h W′)
reflect-weakeningᴱ Γ H (binexp M op N) h (bin₂ W′) = bin₂ (reflect-weakeningᴱ Γ H N h W′)
reflect-weakeningᴱ Γ H (function f ⟨ var y ∈ T ⟩∈ U is B end) h (FunctionDefnMismatch p) = FunctionDefnMismatch (heap-weakeningᴮ (Γ ⊕ y ↦ T) H B h p)
reflect-weakeningᴱ Γ H (function f ⟨ var y ∈ T ⟩∈ U is B end) h (function₁ W) = function₁ (reflect-weakeningᴮ (Γ ⊕ y ↦ T) H B h W)
reflect-weakeningᴱ Γ H (block var b ∈ T is B end) h (BlockMismatch p) = BlockMismatch (heap-weakeningᴮ Γ H B h p)
reflect-weakeningᴱ Γ H (block var b ∈ T is B end) h (block₁ W) = block₁ (reflect-weakeningᴮ Γ H B h W)
reflect-weakeningᴮ Γ H (return M ∙ B) h (return W) = return (reflect-weakeningᴱ Γ H M h W)
reflect-weakeningᴮ Γ H (local var y ∈ T ← M ∙ B) h (LocalVarMismatch p) = LocalVarMismatch (heap-weakeningᴱ Γ H M h p)
reflect-weakeningᴮ Γ H (local var y ∈ T ← M ∙ B) h (local₁ W) = local₁ (reflect-weakeningᴱ Γ H M h W)
reflect-weakeningᴮ Γ H (local var y ∈ T ← M ∙ B) h (local₂ W) = local₂ (reflect-weakeningᴮ (Γ ⊕ y ↦ T) H B h W)
reflect-weakeningᴮ Γ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (FunctionDefnMismatch p) = FunctionDefnMismatch (heap-weakeningᴮ (Γ ⊕ x ↦ T) H C h p)
reflect-weakeningᴮ Γ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (function₁ W) = function₁ (reflect-weakeningᴮ (Γ ⊕ x ↦ T) H C h W)
reflect-weakeningᴮ Γ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) h (function₂ W) = function₂ (reflect-weakeningᴮ (Γ ⊕ f ↦ (T ⇒ U)) H B h W)
reflect-weakeningᴼ : ∀ H O {H′} → (H ⊑ H′) → Warningᴼ H′ (typeCheckᴼ H′ O) → Warningᴼ H (typeCheckᴼ H O)
reflect-weakeningᴼ H (just function f ⟨ var x ∈ T ⟩∈ U is B end) h (FunctionDefnMismatch p) = FunctionDefnMismatch (heap-weakeningᴮ (x ↦ T) H B h p)
reflect-weakeningᴼ H (just function f ⟨ var x ∈ T ⟩∈ U is B end) h (function₁ W) = function₁ (reflect-weakeningᴮ (x ↦ T) H B h W)
reflectᴱ : ∀ H M {H′ M′} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → Warningᴱ H′ (typeCheckᴱ H′ ∅ M′) → Either (Warningᴱ H (typeCheckᴱ H ∅ M)) (Warningᴴ H (typeCheckᴴ H))
reflectᴮ : ∀ H B {H′ B′} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → Warningᴮ H′ (typeCheckᴮ H′ ∅ B′) → Either (Warningᴮ H (typeCheckᴮ H ∅ B)) (Warningᴴ H (typeCheckᴴ H))
reflectᴱ H (M $ N) (app₁ s) (FunctionCallMismatch p) = cond (Left ∘ FunctionCallMismatch ∘ heap-weakeningᴱ ∅ H N (rednᴱ⊑ s) ∘ unknown-src-≮: p) (Left ∘ app₁) (reflect-subtypingᴱ H M s (src-unknown-≮: p))
reflectᴱ H (M $ N) (app₁ s) (app₁ W′) = mapL app₁ (reflectᴱ H M s W′)
reflectᴱ H (M $ N) (app₁ s) (app₂ W′) = Left (app₂ (reflect-weakeningᴱ ∅ H N (rednᴱ⊑ s) W′))
reflectᴱ H (M $ N) (app₂ p s) (FunctionCallMismatch q) = cond (λ r → Left (FunctionCallMismatch (unknown-src-≮: r (heap-weakeningᴱ ∅ H M (rednᴱ⊑ s) (src-unknown-≮: r))))) (Left ∘ app₂) (reflect-subtypingᴱ H N s q)
reflectᴱ H (M $ N) (app₂ p s) (app₁ W′) = Left (app₁ (reflect-weakeningᴱ ∅ H M (rednᴱ⊑ s) W′))
reflectᴱ H (M $ N) (app₂ p s) (app₂ W′) = mapL app₂ (reflectᴱ H N s W′)
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) with substitutivityᴮ H B v x q
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) | Left r = Right (addr a p (FunctionDefnMismatch r))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (BlockMismatch q) | Right r = Left (FunctionCallMismatch (≮:-trans-≡ r ((cong src (cong orUnknown (cong typeOfᴹᴼ (sym p)))))))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) with reflect-substitutionᴮ _ B v x W′
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | Left W = Right (addr a p (function₁ W))
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | Right (Left W) = Left (app₂ W)
reflectᴱ H (val (addr a) $ N) (beta (function f ⟨ var x ∈ T ⟩∈ U is B end) v refl p) (block₁ W′) | Right (Right q) = Left (FunctionCallMismatch (≮:-trans-≡ q (cong src (cong orUnknown (cong typeOfᴹᴼ (sym p))))))
reflectᴱ H (block var b ∈ T is B end) (block s) (BlockMismatch p) = Left (cond BlockMismatch block₁ (reflect-subtypingᴮ H B s p))
reflectᴱ H (block var b ∈ T is B end) (block s) (block₁ W′) = mapL block₁ (reflectᴮ H B s W′)
reflectᴱ H (block var b ∈ T is B end) (return v) W′ = Left (block₁ (return W′))
reflectᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) (UnallocatedAddress ())
reflectᴱ H (binexp M op N) (binOp₀ ()) (UnallocatedAddress p)
reflectᴱ H (binexp M op N) (binOp₁ s) (BinOpMismatch₁ p) = Left (cond BinOpMismatch₁ bin₁ (reflect-subtypingᴱ H M s p))
reflectᴱ H (binexp M op N) (binOp₁ s) (BinOpMismatch₂ p) = Left (BinOpMismatch₂ (heap-weakeningᴱ ∅ H N (rednᴱ⊑ s) p))
reflectᴱ H (binexp M op N) (binOp₁ s) (bin₁ W′) = mapL bin₁ (reflectᴱ H M s W′)
reflectᴱ H (binexp M op N) (binOp₁ s) (bin₂ W′) = Left (bin₂ (reflect-weakeningᴱ ∅ H N (rednᴱ⊑ s) W′))
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₁ p) = Left (BinOpMismatch₁ (heap-weakeningᴱ ∅ H M (rednᴱ⊑ s) p))
reflectᴱ H (binexp M op N) (binOp₂ s) (BinOpMismatch₂ p) = Left (cond BinOpMismatch₂ bin₂ (reflect-subtypingᴱ H N s p))
reflectᴱ H (binexp M op N) (binOp₂ s) (bin₁ W′) = Left (bin₁ (reflect-weakeningᴱ ∅ H M (rednᴱ⊑ s) W′))
reflectᴱ H (binexp M op N) (binOp₂ s) (bin₂ W′) = mapL bin₂ (reflectᴱ H N s W′)
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (LocalVarMismatch p) = Left (cond LocalVarMismatch local₁ (reflect-subtypingᴱ H M s p))
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (local₁ W′) = mapL local₁ (reflectᴱ H M s W′)
reflectᴮ H (local var x ∈ T ← M ∙ B) (local s) (local₂ W′) = Left (local₂ (reflect-weakeningᴮ (x ↦ T) H B (rednᴱ⊑ s) W′))
reflectᴮ H (local var x ∈ T ← M ∙ B) (subst v) W′ = Left (cond local₂ (cond local₁ LocalVarMismatch) (reflect-substitutionᴮ H B v x W′))
reflectᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) W′ with reflect-substitutionᴮ _ B (addr a) f W′
reflectᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) W′ | Left W = Left (function₂ (reflect-weakeningᴮ (f ↦ (T ⇒ U)) H B (snoc defn) W))
reflectᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) W′ | Right (Left (UnallocatedAddress ()))
reflectᴮ H (function f ⟨ var y ∈ T ⟩∈ U is C end ∙ B) (function a defn) W′ | Right (Right p) = CONTRADICTION (≮:-refl p)
reflectᴮ H (return M ∙ B) (return s) (return W′) = mapL return (reflectᴱ H M s W′)
reflectᴴᴱ : ∀ H M {H′ M′} → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → Warningᴴ H′ (typeCheckᴴ H′) → Either (Warningᴱ H (typeCheckᴱ H ∅ M)) (Warningᴴ H (typeCheckᴴ H))
reflectᴴᴮ : ∀ H B {H′ B′} → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → Warningᴴ H′ (typeCheckᴴ H′) → Either (Warningᴮ H (typeCheckᴮ H ∅ B)) (Warningᴴ H (typeCheckᴴ H))
reflectᴴᴱ H (M $ N) (app₁ s) W = mapL app₁ (reflectᴴᴱ H M s W)
reflectᴴᴱ H (M $ N) (app₂ v s) W = mapL app₂ (reflectᴴᴱ H N s W)
reflectᴴᴱ H (M $ N) (beta O v refl p) W = Right W
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a p) (addr b refl W) with b ≡ᴬ a
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) (addr b refl (FunctionDefnMismatch p)) | yes refl = Left (FunctionDefnMismatch (heap-weakeningᴮ (x ↦ T) H B (snoc defn) p))
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a defn) (addr b refl (function₁ W)) | yes refl = Left (function₁ (reflect-weakeningᴮ (x ↦ T) H B (snoc defn) W))
reflectᴴᴱ H (function f ⟨ var x ∈ T ⟩∈ U is B end) (function a p) (addr b refl W) | no q = Right (addr b (lookup-not-allocated p q) (reflect-weakeningᴼ H _ (snoc p) W))
reflectᴴᴱ H (block var b ∈ T is B end) (block s) W = mapL block₁ (reflectᴴᴮ H B s W)
reflectᴴᴱ H (block var b ∈ T is return (val v) ∙ B end) (return v) W = Right W
reflectᴴᴱ H (block var b ∈ T is done end) done W = Right W
reflectᴴᴱ H (binexp M op N) (binOp₀ s) W = Right W
reflectᴴᴱ H (binexp M op N) (binOp₁ s) W = mapL bin₁ (reflectᴴᴱ H M s W)
reflectᴴᴱ H (binexp M op N) (binOp₂ s) W = mapL bin₂ (reflectᴴᴱ H N s W)
reflectᴴᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a p) (addr b refl W) with b ≡ᴬ a
reflectᴴᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a defn) (addr b refl (FunctionDefnMismatch p)) | yes refl = Left (FunctionDefnMismatch (heap-weakeningᴮ (x ↦ T) H C (snoc defn) p))
reflectᴴᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a defn) (addr b refl (function₁ W)) | yes refl = Left (function₁ (reflect-weakeningᴮ (x ↦ T) H C (snoc defn) W))
reflectᴴᴮ H (function f ⟨ var x ∈ T ⟩∈ U is C end ∙ B) (function a p) (addr b refl W) | no q = Right (addr b (lookup-not-allocated p q) (reflect-weakeningᴼ H _ (snoc p) W))
reflectᴴᴮ H (local var x ∈ T ← M ∙ B) (local s) W = mapL local₁ (reflectᴴᴱ H M s W)
reflectᴴᴮ H (local var x ∈ T ← M ∙ B) (subst v) W = Right W
reflectᴴᴮ H (return M ∙ B) (return s) W = mapL return (reflectᴴᴱ H M s W)
reflect* : ∀ H B {H′ B′} → (H ⊢ B ⟶* B′ ⊣ H′) → Either (Warningᴮ H′ (typeCheckᴮ H′ ∅ B′)) (Warningᴴ H′ (typeCheckᴴ H′)) → Either (Warningᴮ H (typeCheckᴮ H ∅ B)) (Warningᴴ H (typeCheckᴴ H))
reflect* H B refl W = W
reflect* H B (step s t) W = cond (reflectᴮ H B s) (reflectᴴᴮ H B s) (reflect* _ _ t W)
isntNumber : ∀ H v → (valueType v ≢ number) → (typeOfᴱ H ∅ (val v) ≮: number)
isntNumber H nil p = scalar-≢-impl-≮: nil number (λ ())
isntNumber H (addr a) p with remember (H [ a ]ᴴ)
isntNumber H (addr a) p | (just (function f ⟨ var x ∈ T ⟩∈ U is B end) , q) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ q)) (function-≮:-scalar number)
isntNumber H (addr a) p | (nothing , q) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ q)) (unknown-≮:-scalar number)
isntNumber H (number x) p = CONTRADICTION (p refl)
isntNumber H (bool x) p = scalar-≢-impl-≮: boolean number (λ ())
isntNumber H (string x) p = scalar-≢-impl-≮: string number (λ ())
isntString : ∀ H v → (valueType v ≢ string) → (typeOfᴱ H ∅ (val v) ≮: string)
isntString H nil p = scalar-≢-impl-≮: nil string (λ ())
isntString H (addr a) p with remember (H [ a ]ᴴ)
isntString H (addr a) p | (just (function f ⟨ var x ∈ T ⟩∈ U is B end) , q) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ q)) (function-≮:-scalar string)
isntString H (addr a) p | (nothing , q) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ q)) (unknown-≮:-scalar string)
isntString H (number x) p = scalar-≢-impl-≮: number string (λ ())
isntString H (bool x) p = scalar-≢-impl-≮: boolean string (λ ())
isntString H (string x) p = CONTRADICTION (p refl)
isntFunction : ∀ H v {T U} → (valueType v ≢ function) → (typeOfᴱ H ∅ (val v) ≮: (T ⇒ U))
isntFunction H nil p = scalar-≮:-function nil
isntFunction H (addr a) p = CONTRADICTION (p refl)
isntFunction H (number x) p = scalar-≮:-function number
isntFunction H (bool x) p = scalar-≮:-function boolean
isntFunction H (string x) p = scalar-≮:-function string
isntEmpty : ∀ H v → (typeOfᴱ H ∅ (val v) ≮: never)
isntEmpty H nil = scalar-≮:-never nil
isntEmpty H (addr a) with remember (H [ a ]ᴴ)
isntEmpty H (addr a) | (just (function f ⟨ var x ∈ T ⟩∈ U is B end) , p) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ p)) function-≮:-never
isntEmpty H (addr a) | (nothing , p) = ≡-trans-≮: (cong orUnknown (cong typeOfᴹᴼ p)) unknown-≮:-never
isntEmpty H (number x) = scalar-≮:-never number
isntEmpty H (bool x) = scalar-≮:-never boolean
isntEmpty H (string x) = scalar-≮:-never string
runtimeBinOpWarning : ∀ H {op} v → BinOpError op (valueType v) → (typeOfᴱ H ∅ (val v) ≮: srcBinOp op)
runtimeBinOpWarning H v (+ p) = isntNumber H v p
runtimeBinOpWarning H v (- p) = isntNumber H v p
runtimeBinOpWarning H v (* p) = isntNumber H v p
runtimeBinOpWarning H v (/ p) = isntNumber H v p
runtimeBinOpWarning H v (< p) = isntNumber H v p
runtimeBinOpWarning H v (> p) = isntNumber H v p
runtimeBinOpWarning H v (<= p) = isntNumber H v p
runtimeBinOpWarning H v (>= p) = isntNumber H v p
runtimeBinOpWarning H v (·· p) = isntString H v p
runtimeWarningᴱ : ∀ H M → RuntimeErrorᴱ H M → Warningᴱ H (typeCheckᴱ H ∅ M)
runtimeWarningᴮ : ∀ H B → RuntimeErrorᴮ H B → Warningᴮ H (typeCheckᴮ H ∅ B)
runtimeWarningᴱ H (var x) UnboundVariable = UnboundVariable refl
runtimeWarningᴱ H (val (addr a)) (SEGV p) = UnallocatedAddress p
runtimeWarningᴱ H (M $ N) (FunctionMismatch v w p) = FunctionCallMismatch (unknown-src-≮: (isntEmpty H w) (isntFunction H v p))
runtimeWarningᴱ H (M $ N) (app₁ err) = app₁ (runtimeWarningᴱ H M err)
runtimeWarningᴱ H (M $ N) (app₂ err) = app₂ (runtimeWarningᴱ H N err)
runtimeWarningᴱ H (block var b ∈ T is B end) (block err) = block₁ (runtimeWarningᴮ H B err)
runtimeWarningᴱ H (binexp M op N) (BinOpMismatch₁ v w p) = BinOpMismatch₁ (runtimeBinOpWarning H v p)
runtimeWarningᴱ H (binexp M op N) (BinOpMismatch₂ v w p) = BinOpMismatch₂ (runtimeBinOpWarning H w p)
runtimeWarningᴱ H (binexp M op N) (bin₁ err) = bin₁ (runtimeWarningᴱ H M err)
runtimeWarningᴱ H (binexp M op N) (bin₂ err) = bin₂ (runtimeWarningᴱ H N err)
runtimeWarningᴮ H (local var x ∈ T ← M ∙ B) (local err) = local₁ (runtimeWarningᴱ H M err)
runtimeWarningᴮ H (return M ∙ B) (return err) = return (runtimeWarningᴱ H M err)
wellTypedProgramsDontGoWrong : ∀ H′ B B′ → (∅ᴴ ⊢ B ⟶* B′ ⊣ H′) → (RuntimeErrorᴮ H′ B′) → Warningᴮ ∅ᴴ (typeCheckᴮ ∅ᴴ ∅ B)
wellTypedProgramsDontGoWrong H′ B B′ t err with reflect* ∅ᴴ B t (Left (runtimeWarningᴮ H′ B′ err))
wellTypedProgramsDontGoWrong H′ B B′ t err | Right (addr a refl ())
wellTypedProgramsDontGoWrong H′ B B′ t err | Left W = W
| 83.704871
| 323
| 0.653168
|
4e50e3e14843875b4a09b6d3b022ceaafb4e6cdc
| 1,822
|
agda
|
Agda
|
test/Succeed/Issue3435.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/Issue3435.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/Issue3435.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
module _ where
infix -1 _■
infixr -2 step-∼
postulate
Transitive : {A : Set} (P Q : A → A → Set) → Set
step-∼ : ∀ {A} {P Q : A → A → Set}
⦃ t : Transitive P Q ⦄ x {y z} →
Q y z → P x y → Q x z
syntax step-∼ x Qyz Pxy = x ∼⟨ Pxy ⟩ Qyz
infix 4 _≈_
postulate
Proc : Set
_≈_ : Proc → Proc → Set
_■ : ∀ x → x ≈ x
instance trans : Transitive _≈_ _≈_
module DummyInstances where
postulate
R₁ R₂ R₃ R₄ R₅ : Proc → Proc → Set
postulate
instance
transitive₁₁ : Transitive R₁ R₁
transitive₁₂ : Transitive R₁ R₂
transitive₁₃ : Transitive R₁ R₃
transitive₁₄ : Transitive R₁ R₄
transitive₁₅ : Transitive R₁ R₅
transitive₂₁ : Transitive R₂ R₁
transitive₂₂ : Transitive R₂ R₂
transitive₂₃ : Transitive R₂ R₃
transitive₂₄ : Transitive R₂ R₄
transitive₂₅ : Transitive R₂ R₅
transitive₃₁ : Transitive R₃ R₁
transitive₃₂ : Transitive R₃ R₂
transitive₃₃ : Transitive R₃ R₃
transitive₃₄ : Transitive R₃ R₄
transitive₃₅ : Transitive R₃ R₅
transitive₄₁ : Transitive R₄ R₁
transitive₄₂ : Transitive R₄ R₂
transitive₄₃ : Transitive R₄ R₃
transitive₄₄ : Transitive R₄ R₄
transitive₄₅ : Transitive R₄ R₅
transitive₅₁ : Transitive R₅ R₁
transitive₅₂ : Transitive R₅ R₂
transitive₅₃ : Transitive R₅ R₃
transitive₅₄ : Transitive R₅ R₄
transitive₅₅ : Transitive R₅ R₅
postulate
comm : ∀ {P} → P ≈ P
P : Proc
cong : P ≈ P
cong =
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ∼⟨ comm ⟩
P ■
| 21.690476
| 50
| 0.576839
|
ccf80f30ea51d5b1b7741d1443c45de7b66de7b2
| 2,540
|
agda
|
Agda
|
src/PiCalculus/LinearTypeSystem/Strengthening.agda
|
guilhermehas/typing-linear-pi
|
0fc3cf6bcc0cd07d4511dbe98149ac44e6a38b1a
|
[
"MIT"
] | 26
|
2020-05-02T23:32:11.000Z
|
2022-03-14T15:18:23.000Z
|
src/PiCalculus/LinearTypeSystem/Strengthening.agda
|
guilhermehas/typing-linear-pi
|
0fc3cf6bcc0cd07d4511dbe98149ac44e6a38b1a
|
[
"MIT"
] | 1
|
2022-03-15T09:16:14.000Z
|
2022-03-15T09:16:14.000Z
|
src/PiCalculus/LinearTypeSystem/Strengthening.agda
|
guilhermehas/typing-linear-pi
|
0fc3cf6bcc0cd07d4511dbe98149ac44e6a38b1a
|
[
"MIT"
] | 3
|
2021-01-25T13:57:13.000Z
|
2022-03-14T16:24:07.000Z
|
{-# OPTIONS --safe #-} -- --without-K #-}
open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl; cong)
open import Function using (_∘_)
import Data.Empty as Empty
import Data.Product as Product
import Data.Product.Properties as Productₚ
import Data.Unit as Unit
import Data.Nat as Nat
import Data.Vec as Vec
import Data.Vec.Properties as Vecₚ
import Data.Bool as Bool
import Data.Fin as Fin
import Data.Vec.Relation.Unary.All as All
open Empty using (⊥-elim)
open Nat using (ℕ; zero; suc)
open Vec using (Vec; []; _∷_)
open All using (All; []; _∷_)
open Fin using (Fin ; zero ; suc)
open Product using (_,_; proj₁; proj₂)
import PiCalculus.Syntax
open PiCalculus.Syntax.Scoped
open import PiCalculus.Semantics
open import PiCalculus.LinearTypeSystem.Algebras
module PiCalculus.LinearTypeSystem.Strengthening (Ω : Algebras) where
open Algebras Ω
open import PiCalculus.LinearTypeSystem Ω
open import PiCalculus.LinearTypeSystem.ContextLemmas Ω
private
variable
n : ℕ
idxs : Idxs n
idx idx' : Idx
t t' : Type
i j : Fin n
P Q : Scoped n
∋-strengthen : {γ : PreCtx (suc n)} {idxs : Idxs (suc n)} {Γ Θ : Ctx idxs} {m' : Usage idx' ²}
→ (i : Fin (suc n))
→ (i≢j : i ≢ j)
→ γ ; Γ ∋[ j ] t' ; m' ▹ Θ
→ Vec.remove γ i ; ctx-remove Γ i ∋[ Fin.punchOut i≢j ] t' ; m' ▹ ctx-remove Θ i
∋-strengthen zero i≢x (zero , zero _) = ⊥-elim (i≢x refl)
∋-strengthen zero i≢x (suc t , suc x) = t , x
∋-strengthen {γ = _ -, _ -, _} {_ -, _ -, _} {_ -, _ -, _} (suc i) i≢x (zero , zero xyz) = zero , zero xyz
∋-strengthen {γ = _ -, _ -, _} {_ -, _ -, _} {_ -, _ -, _} {_ -, _ -, _} (suc i) i≢x (suc t , suc x) = there (∋-strengthen i (i≢x ∘ cong suc) (t , x))
⊢-strengthen : {P : Scoped (suc n)} {γ : PreCtx (suc n)} {idxs : Idxs (suc n)} {Γ Θ : Ctx idxs}
→ (i : Fin (suc n))
→ (uP : Unused i P)
→ γ ; Γ ⊢ P ▹ Θ
→ Vec.remove γ i ; ctx-remove Γ i ⊢ lower i P uP ▹ ctx-remove Θ i
⊢-strengthen i uP 𝟘 = 𝟘
⊢-strengthen {γ = _ -, _} {Γ = _ -, _} {Θ = _ -, _} i uP (ν t m μ ⊢P)
= ν t m μ (⊢-strengthen (suc i) uP ⊢P)
⊢-strengthen {γ = _ -, _} {Γ = _ -, _} {Θ = _ -, _} i (i≢x , uP) (_⦅⦆_ {Ξ = _ -, _} x ⊢P)
= ∋-strengthen i i≢x x ⦅⦆ ⊢-strengthen (suc i) uP ⊢P
⊢-strengthen {γ = _ -, _} i (i≢x , i≢y , uP) (x ⟨ y ⟩ ⊢P)
= ∋-strengthen i i≢x x ⟨ ∋-strengthen i i≢y y ⟩ ⊢-strengthen i uP ⊢P
⊢-strengthen {γ = _ -, _} i (uP , uQ) (⊢P ∥ ⊢Q)
= ⊢-strengthen i uP ⊢P ∥ ⊢-strengthen i uQ ⊢Q
| 37.910448
| 150
| 0.571654
|
4ece549f0d9ed7a25f7a6603588bddaf73564e1d
| 5,388
|
agda
|
Agda
|
src/Pts/Reduction/Cbv.agda
|
asr/pts-agda
|
d701c2688e4a88eb81bdd9d458f9a2fcf81d5a43
|
[
"BSD-3-Clause"
] | 21
|
2016-05-13T12:11:10.000Z
|
2021-08-31T10:47:57.000Z
|
src/Pts/Reduction/Cbv.agda
|
asr/pts-agda
|
d701c2688e4a88eb81bdd9d458f9a2fcf81d5a43
|
[
"BSD-3-Clause"
] | 1
|
2017-08-21T14:48:09.000Z
|
2017-08-21T16:01:50.000Z
|
src/Pts/Reduction/Cbv.agda
|
asr/pts-agda
|
d701c2688e4a88eb81bdd9d458f9a2fcf81d5a43
|
[
"BSD-3-Clause"
] | 4
|
2017-08-20T10:29:44.000Z
|
2019-08-11T23:28:33.000Z
|
------------------------------------------------------------------------
-- Call-by-value (CBV) reduction in pure type systems (PTS)
------------------------------------------------------------------------
module Pts.Reduction.Cbv where
open import Data.Fin.Substitution
open import Data.Fin.Substitution.ExtraLemmas
open import Data.Star using (map; gmap)
import Relation.Binary.EquivalenceClosure as EqClos
import Relation.Binary.PropositionalEquality as PropEq
open import Relation.Binary.Reduction
open import Pts.Syntax
open import Pts.Reduction.Full as Full hiding (reduction)
-- All remaining submodules are parametrized by a given set of sorts.
module _ {Sort : Set} where
open Syntax Sort
open Substitution Sort using (_[_])
----------------------------------------------------------------------
-- Call-by-value (CBV) reduction and equivalence relations
-- Untyped values with up to n free variables.
data Val {n} : Term n → Set where
sort : ∀ s → Val (sort s) -- sort
Π : ∀ a b → Val (Π a b) -- dependent product
ƛ : ∀ a b → Val (ƛ a b) -- abstraction
infixl 9 _·₁_ _·₂_
infix 5 _→v_
-- One-step CBV reduction.
data _→v_ {n} : Term n → Term n → Set where
cont : ∀ a b {c} (v : Val c) → (ƛ a b) · c →v b [ c ]
_·₁_ : ∀ {a₁ a₂} → a₁ →v a₂ → ∀ b → a₁ · b →v a₂ · b
_·₂_ : ∀ {a b₁ b₂} (v : Val a) → b₁ →v b₂ → a · b₁ →v a · b₂
reduction : Reduction Term
reduction = record { _→1_ = _→v_ }
-- CBV reduction and equivalence.
open Reduction reduction public renaming (_→*_ to _→v*_; _↔_ to _≡v_)
----------------------------------------------------------------------
-- Substitutions in CBV reductions/equivalence
--
-- The applications _/→v_, _/→v*_ and _/≡v_ below may be considered
-- substitution lemmas, i.e. they establish the commutativity of the
-- respective reductions/equivalence with substitutions.
-- Application of generic substitutions to the
-- reductions/equivalence.
record CbvSubstApp {T} (l : Lift T Term) : Set where
open Lift l
open SubstApp Sort l
open PropEq hiding ([_])
-- Substitutions commute.
field /-sub-↑ : ∀ {m n} a b (σ : Sub T m n) →
a [ b ] / σ ≡ (a / σ ↑) [ b / σ ]
infixl 8 _/Val_ _/→v_
-- Application of substitutions preserves values.
_/Val_ : ∀ {m n a} → Val a → (σ : Sub T m n) → Val (a / σ)
sort s /Val σ = sort s
Π a b /Val σ = Π (a / σ) (b / σ ↑)
ƛ a b /Val σ = ƛ (a / σ) (b / σ ↑)
-- Substitution commutes with one-step reduction.
_/→v_ : ∀ {m n a b} → a →v b → (σ : Sub T m n) → a / σ →v b / σ
cont a b c /→v σ =
subst (_→v_ _) (sym (/-sub-↑ b _ σ)) (cont (a / σ) (b / σ ↑) (c /Val σ))
a₁→a₂ ·₁ b /→v σ = (a₁→a₂ /→v σ) ·₁ (b / σ)
a ·₂ b₁→b₂ /→v σ = (a /Val σ) ·₂ (b₁→b₂ /→v σ)
redSubstApp : RedSubstApp reduction (record { _/_ = _/_ })
redSubstApp = record { _/→1_ = _/→v_ }
open RedSubstApp redSubstApp public
hiding (_/→1_) renaming (_/→*_ to _/→v*_; _/↔_ to _/≡v_)
-- Term substitutions in reductions/equivalences.
module CbvSubstitution where
open Substitution Sort
using (termSubst; weaken; sub-commutes; varLiftSubLemmas)
-- Application of renamings to reductions/equivalences.
varSubstApp : CbvSubstApp (TermSubst.varLift termSubst)
varSubstApp = record { /-sub-↑ = /-sub-↑ }
where open LiftSubLemmas varLiftSubLemmas
private module V = CbvSubstApp varSubstApp
-- Weakening of one-step CBV reductions.
weaken-→v : ∀ {n} {a b : Term n} → a →v b → weaken a →v weaken b
weaken-→v a→b = a→b V./→v VarSubst.wk
-- Weakening of CBV reductions.
weaken-→v* : ∀ {n} {a b : Term n} → a →v* b → weaken a →v* weaken b
weaken-→v* = gmap weaken weaken-→v
-- Weakening of equivalences.
weaken-≡v : ∀ {n} {a b : Term n} → a ≡v b → weaken a ≡v weaken b
weaken-≡v = EqClos.gmap weaken weaken-→v
-- Application of term substitutions to reductions/equivalences.
termSubstApp : CbvSubstApp (TermSubst.termLift termSubst)
termSubstApp = record { /-sub-↑ = λ a _ _ → sub-commutes a }
open CbvSubstApp termSubstApp public
----------------------------------------------------------------------
-- Properties of the CBV reductions/equivalence
-- Inclusions.
→v⇒→v* = →1⇒→* reduction
→v*⇒≡v = →*⇒↔ reduction
→v⇒≡v = →1⇒↔ reduction
-- CBV reduction is a preorder.
→v*-predorder = →*-predorder reduction
-- Preorder reasoning for CBV reduction.
module →v*-Reasoning = →*-Reasoning reduction
-- Terms together with CBV equivalence form a setoid.
≡v-setoid = ↔-setoid reduction
-- Equational reasoning for CBV equivalence.
module ≡v-Reasoning = ↔-Reasoning reduction
----------------------------------------------------------------------
-- Relationships between CBV reduction and full β-reduction
-- One-step CBV reduction implies one-step β-reduction.
→v⇒→β : ∀ {n} {a b : Term n} → a →v b → a →β b
→v⇒→β (cont a b c) = cont a b _
→v⇒→β (a₁→a₂ ·₁ b) = →v⇒→β a₁→a₂ ·₁ b
→v⇒→β (a ·₂ b₁→b₂) = _ ·₂ →v⇒→β b₁→b₂
-- CBV reduction implies parallel reduction.
→v*⇒→β* : ∀ {n} {a b : Term n} → a →v* b → a →β* b
→v*⇒→β* = map →v⇒→β
-- CBV equivalence implies parallel equivalence.
≡v⇒≡p : ∀ {n} {a b : Term n} → a ≡v b → a ≡β b
≡v⇒≡p = EqClos.map →v⇒→β
| 34.987013
| 78
| 0.559948
|
ccc52f366eb056b8d74befc718c4443b2951da93
| 7,845
|
agda
|
Agda
|
agda/course/2017-conor_mcbride_cs410/HC-Lec2.agda
|
haroldcarr/learn-haskell-coq-ml-etc
|
3dc7abca7ad868316bb08f31c77fbba0d3910225
|
[
"Unlicense"
] | 36
|
2015-01-29T14:37:15.000Z
|
2021-07-30T06:55:03.000Z
|
agda/course/2017-conor_mcbride_cs410/HC-Lec2.agda
|
haroldcarr/learn-haskell-coq-ml-etc
|
3dc7abca7ad868316bb08f31c77fbba0d3910225
|
[
"Unlicense"
] | null | null | null |
agda/course/2017-conor_mcbride_cs410/HC-Lec2.agda
|
haroldcarr/learn-haskell-coq-ml-etc
|
3dc7abca7ad868316bb08f31c77fbba0d3910225
|
[
"Unlicense"
] | 8
|
2015-04-13T21:40:15.000Z
|
2021-09-21T15:58:10.000Z
|
module HC-Lec2 where
open import HC-Lec1
-- ==============================================================================
-- Lecture 4 : Sigma, Difference, Vector Take
-- https://www.youtube.com/watch?v=OZeDRtRmgkw
-- 43:14
data Vec (X : Set) : Nat -> Set where
[] : Vec X zero
_::_ : {n : Nat} -> X -> Vec X n -> Vec X (suc n)
infixr 4 _::_
vTake : (m n : Nat) -> m >= n -> {X : Set} -> Vec X m -> Vec X n
vTake m zero m>=n xs = []
vTake (suc m) (suc n) m>=n (x :: xs) = x :: vTake m n m>=n xs
vTake32 : Set
vTake32 = vTake 3 2 <> (1 :: 2 :: 3 :: []) == (1 :: 2 :: [])
-- 47:35 : taking ALL elements is an identity
vTakeIdFact : (n : Nat) {X : Set} (xs : Vec X n)
-> vTake n n (refl->= n) xs == xs
vTakeIdFact .0 [] = refl []
vTakeIdFact (suc n) (x :: xs) rewrite vTakeIdFact n xs = refl (x :: xs)
-- 48:17 : taking p elements from Vm is same as taking n elements from Vm, forming Vn
-- then taking p elments from Vn
vTakeCpFact : (m n p : Nat) (m>=n : m >= n) (n>=p : n >= p) {X : Set} (xs : Vec X m)
-> vTake m p (trans->= m n p m>=n n>=p) xs
== vTake n p n>=p (vTake m n m>=n xs)
vTakeCpFact m n zero m>=n n>=p _ = refl []
vTakeCpFact (suc m) (suc n) (suc p) m>=n n>=p (x :: xs)
rewrite vTakeCpFact m n p m>=n n>=p xs
= refl (x :: (vTake n p n>=p (vTake m n m>=n xs)))
-- 48:54
-- vTakeIdFact : reflexivity turns into identity
-- vTakeCpFact : transitivity turns into composition
-- ==============================================================================
-- Lecture 5 : How Rewrite Works
-- https://www.youtube.com/watch?v=b5salYMZoyM
-- 3:34
vTake53 : Vec Nat 3
vTake53 = vTake 5 3 <> (1 :: 2 :: 3 :: 4 :: 5 :: [])
-- 5:30
vTake' : ∀ {m : Nat} {X : Set}
-> (n : Nat) -> m >= n -> Vec X m
-> Vec X n
vTake' {m} zero m>=n xs = []
vTake' {suc m} (suc n) m>=n (x :: xs) = x :: vTake' {m} n m>=n xs
{-
-- 7:45
rigid symbols : constructors (value and type)
- if you are trying to tell if two usages of constructors match each other,
you can compare them component-wise
- no defined computational meaning - they are what they are
- e.g., Vec Nat 3
non-rigid
- e.g., >=
- can compute
-- 15:48
vTake : think of as turning a '>=' proof into a vector operation.
- In comes a proof on numbers, out comes an operation on vectors.
vTakeIdFact : identity proof on numbers turns into identity operation on vectors
vTakeCpFact : proof of transitivity on numbers turns into composition operation on vectors
-- 24:08 : best practice : use record (instead of data) when possible : agda is more aggressive
-- 24:28 : HOW REWRITE WORKS
Rewrite is shorthand for
- abstract the LHS of the equation using 'with'
- abstract the proof of the equation using 'with'
- then pattern matching on the proof
-}
------------------------------------------------------------------------------
-- Splittings (which bear some relationship to <= from ex1)
-- 39:00
data _<[_]>_ : Nat -> Nat -> Nat -> Set where
zzz : zero <[ zero ]> zero
lll : {l m r : Nat} -> l <[ m ]> r
-> suc l <[ suc m ]> r
rrr : {l m r : Nat} -> l <[ m ]> r
-> l <[ suc m ]> suc r
-- xzzz : Set
-- xzzz = zero <[ zero ]> zero
-- x1z1 : Set
-- x1z1 = 1 <[ zero ]> 1
-- x159 : Set
-- x159 = 1 <[ 5 ]> 9
-- x951 : Set
-- x951 = 9 <[ 5 ]> 1
-- 41:08
-- combine two vectors into one according to given instructions
-- this is kind of a "double-sided" '<='
{- collection
* <--- *
* ---> *
* ---> *
* <--- *
* ---> *
3 from left 2 from right
-}
_>[_]<_ : {X : Set} {l m r : Nat}
-> Vec X l
-> l <[ m ]> r -- instructions
-> Vec X r
-> Vec X m
-- why is rrr the first line?
-- 29:49 https://www.youtube.com/watch?v=RW4aC_6n0yQ
-- do NOT pattern match on vector first (LHS of first clause)
-- pattern match on instructions first
-- i.e., no pattern match on xl, so goes to try to match instruction : >[ rrr mmm ]<
xl >[ rrr mmm ]< (x :: xr) = x :: (xl >[ mmm ]< xr)
(x :: xl) >[ lll mmm ]< xr = x :: (xl >[ mmm ]< xr)
[] >[ zzz ]< [] = []
v6rl : Vec Nat 6
v6rl = (0 :: 2 :: 3 :: []) >[ rrr (rrr (rrr (lll (lll (lll zzz))))) ]< (7 :: 8 :: 9 :: [])
_ : v6rl == (7 :: 8 :: 9 :: 0 :: 2 :: 3 :: [])
_ = refl (7 :: 8 :: 9 :: 0 :: 2 :: 3 :: [])
v6 : Vec Nat 6
v6 = (0 :: 2 :: 3 :: []) >[ lll (rrr (lll (rrr (lll (rrr zzz))))) ]< (7 :: 8 :: 9 :: [])
_ : v6 == (0 :: 7 :: 2 :: 8 :: 3 :: 9 :: [])
_ = refl (0 :: 7 :: 2 :: 8 :: 3 :: 9 :: [])
-- 44:27
-- split a vector into two vectors according to given instructions
-- reverses '<[ m ]>' - instructions for taking things apart
data FindSplit {X : Set} {l m r : Nat}
(nnn : l <[ m ]> r) : (xs : Vec X m) -> Set where
splitBits : (xl : Vec X l) (xr : Vec X r) -> FindSplit nnn (xl >[ nnn ]< xr)
-- proves FindSplit
findSplit : {X : Set} {l m r : Nat} (nnn : l <[ m ]> r) (xs : Vec X m) -> FindSplit nnn xs
findSplit zzz [] = splitBits [] []
findSplit (lll nnn) (x :: xs) with findSplit nnn xs
-- FindSplit (lll nnn) (x :: (xl >[ nnn ]< xr))
findSplit (lll nnn) (x :: .(xl >[ nnn ]< xr)) | splitBits xl xr = splitBits (x :: xl) xr
findSplit (rrr nnn) (x :: xs) with findSplit nnn xs
-- FindSplit (rrr nnn) (x :: (xl >[ nnn ]< xr))
findSplit (rrr nnn) (x :: .(xl >[ nnn ]< xr)) | splitBits xl xr = splitBits xl (x :: xr)
-- ==============================================================================
-- https://www.youtube.com/watch?v=RW4aC_6n0yQ
-- 5:08
{-
The o' <= constructor : you can keep increasing the RHS
oz -- stop
os -- take this one and keep going
o' -- skip this one and keep going
Tabulating the ways of choosing N things from M things
A path is a way to get a specific embedding.
The numbers in parenthesis shows the number of paths to a specific embedding (Pascal's triangle).
oz
0<=0
(1)
/ \
/ \
/ \
o' os
0<=1 1<=1
(1) (1)
/ \ / \
/ \ / \
/ \ / \
o' os o' os
0<=2 1<=2 2<=2
(1) (2) (2)
/ \ / \ / \
/ \ / \ / \
/ \ / \ / \
o' os o' os o' os
0<=3 1<=3 2<=3 3<=3
(1) (3) (3) (1)
witnesses to M choose N
read a value in a set of this type as instructions for choosing
-}
-- 14:58
-- 'findSplit' (above)
-- 23:20
-- last clause of 'findSplit'
-- 29:49 : the same ERROR I had before changing order of clauses in _>[_]<_
-- 34:22 : rule of thumb
-- if there is one column of args, where on every line is a constructor then no change
-- otherwise, choose ordering carefully
-- 35:52 : final order of clauses of of _>[_]<_ -- tidy to have nil case at top or bottom
-- 40:15 shows how agda/haskell does case splitting on _>[_]<_
| 35.022321
| 97
| 0.446781
|
3777d8e7f93f2435ae7e840e4d4b9ae062bde8a0
| 906
|
agda
|
Agda
|
src/Web/Semantic/DL/KB/Model.agda
|
bblfish/agda-web-semantic
|
38fbc3af7062ba5c3d7d289b2b4bcfb995d99057
|
[
"MIT"
] | 1
|
2022-02-22T09:43:23.000Z
|
2022-02-22T09:43:23.000Z
|
src/Web/Semantic/DL/KB/Model.agda
|
bblfish/agda-web-semantic
|
38fbc3af7062ba5c3d7d289b2b4bcfb995d99057
|
[
"MIT"
] | null | null | null |
src/Web/Semantic/DL/KB/Model.agda
|
bblfish/agda-web-semantic
|
38fbc3af7062ba5c3d7d289b2b4bcfb995d99057
|
[
"MIT"
] | null | null | null |
open import Data.Product using ( _×_ ; _,_ )
open import Web.Semantic.DL.ABox.Model using ( _⊨a_ ; ⊨a-resp-≲ )
open import Web.Semantic.DL.ABox.Interp using ( Interp ; ⌊_⌋ )
open import Web.Semantic.DL.ABox.Interp.Morphism using ( _≃_ ; ≃⌊_⌋ ; ≃-impl-≲ )
open import Web.Semantic.DL.KB using ( KB ; tbox ; abox )
open import Web.Semantic.DL.Signature using ( Signature )
open import Web.Semantic.DL.TBox.Model using ( _⊨t_ ; ⊨t-resp-≃ )
module Web.Semantic.DL.KB.Model {Σ : Signature} {X : Set} where
infixr 2 _⊨_
{- An interpretation entails a knowledge base
if it entails the tbox and the abox of the KB -}
_⊨_ : Interp Σ X → KB Σ X → Set
I ⊨ K = (⌊ I ⌋ ⊨t tbox K) × (I ⊨a abox K)
Interps : KB Σ X → Interp Σ X → Set
Interps K I = I ⊨ K
⊨-resp-≃ : ∀ {I J} → (I ≃ J) → ∀ K → (I ⊨ K) → (J ⊨ K)
⊨-resp-≃ I≃J K (I⊨T , I⊨A) =
(⊨t-resp-≃ ≃⌊ I≃J ⌋ (tbox K) I⊨T , ⊨a-resp-≲ (≃-impl-≲ I≃J) (abox K) I⊨A)
| 37.75
| 80
| 0.609272
|
140051dbeac6304f678a5a552a7d9442499e1b0d
| 381
|
agda
|
Agda
|
test/Fail/Errors/UnknownATP.agda
|
asr/apia
|
a66c5ddca2ab470539fd68c42c4fbd45f720d682
|
[
"MIT"
] | 10
|
2015-09-03T20:54:16.000Z
|
2019-12-03T13:44:25.000Z
|
test/Fail/Errors/UnknownATP.agda
|
asr/apia
|
a66c5ddca2ab470539fd68c42c4fbd45f720d682
|
[
"MIT"
] | 121
|
2015-01-25T13:22:12.000Z
|
2018-04-22T06:01:44.000Z
|
test/Fail/Errors/UnknownATP.agda
|
asr/apia
|
a66c5ddca2ab470539fd68c42c4fbd45f720d682
|
[
"MIT"
] | 4
|
2016-05-10T23:06:19.000Z
|
2016-08-03T03:54:55.000Z
|
-- Testing the error when using an unknown ATP. See the .flags file.
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
postulate
D : Set
_≡_ : D → D → Set
a b : D
postulate p : a ≡ b
{-# ATP axiom p #-}
postulate foo : a ≡ b
{-# ATP prove foo #-}
| 21.166667
| 68
| 0.524934
|
ccde33ef6f402577fbbc988a2da8b2f57a3b3859
| 215
|
agda
|
Agda
|
Cubical/Categories/NaturalTransformation.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 301
|
2018-10-17T18:00:24.000Z
|
2022-03-24T02:10:47.000Z
|
Cubical/Categories/NaturalTransformation.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 584
|
2018-10-15T09:49:02.000Z
|
2022-03-30T12:09:17.000Z
|
Cubical/Categories/NaturalTransformation.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 134
|
2018-11-16T06:11:03.000Z
|
2022-03-23T16:22:13.000Z
|
{-# OPTIONS --safe #-}
module Cubical.Categories.NaturalTransformation where
open import Cubical.Categories.NaturalTransformation.Base public
open import Cubical.Categories.NaturalTransformation.Properties public
| 30.714286
| 70
| 0.846512
|
1462b56fae015a50ba80a74964ec63d986b5fa66
| 850
|
agda
|
Agda
|
test/Fail/Issue1435-helper.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/Issue1435-helper.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/Issue1435-helper.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
-- Jesper, 2015-12-18: the helper function shouldn't be accepted, since it
-- matches on a heterogeneous equality and the equation between the types
-- Box A and Box B cannot be solved without injective type constructors.
data Box (A : Set) : Set where
[_] : A → Box A
data _≡_ (A : Set) : Set → Set₁ where
refl : A ≡ A
data _≅_ {A : Set₁} (x : A) : {B : Set₁} → B → Set₂ where
refl : x ≅ x
data C : Set → Set₁ where
c₁ c₂ : (A : Set) → C (Box A)
data D : {A : Set} → C A → Set₂ where
d₁ : (A : Set) → D (c₁ A)
d₂ : (A : Set) → D (c₂ A)
D-elim-c₁-helper :
(P : {A B : Set} {c : C A} →
D c → A ≡ Box B → c ≅ c₁ B → Set₂) →
((A : Set) → P (d₁ A) refl refl) →
{A B : Set} {c : C A}
(x : D c) (eq₂ : c ≅ c₁ B) (eq₁ : A ≡ Box B) → P x eq₁ eq₂
D-elim-c₁-helper P p (d₂ A) () _
D-elim-c₁-helper P p (d₁ A) refl refl = p A
| 29.310345
| 74
| 0.545882
|
2ec7392ae786ad75ce1f625ede3b8ddaffc62127
| 11,352
|
agda
|
Agda
|
Cubical/Categories/Presheaf/KanExtension.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | 1
|
2022-02-05T01:25:26.000Z
|
2022-02-05T01:25:26.000Z
|
Cubical/Categories/Presheaf/KanExtension.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | null | null | null |
Cubical/Categories/Presheaf/KanExtension.agda
|
FernandoLarrain/cubical
|
9acdecfa6437ec455568be4e5ff04849cc2bc13b
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --safe --experimental-lossy-unification #-}
{-
Kan extension of a functor C → D to a functor PreShv C ℓ → PreShv D ℓ left or right adjoint to
precomposition.
-}
module Cubical.Categories.Presheaf.KanExtension where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.HLevels
open import Cubical.Functions.FunExtEquiv
open import Cubical.HITs.SetQuotients
open import Cubical.Categories.Category
open import Cubical.Categories.Functor
open import Cubical.Categories.NaturalTransformation
open import Cubical.Categories.Adjoint
open import Cubical.Categories.Presheaf.Base
open import Cubical.Categories.Instances.Functors
open import Cubical.Categories.Instances.Sets
{-
Left Kan extension of a functor C → D to a functor PreShv C ℓ → PreShv D ℓ left adjoint to precomposition.
-}
module Lan {ℓC ℓC' ℓD ℓD'} ℓS
{C : Category ℓC ℓC'} {D : Category ℓD ℓD'}
(F : Functor C D)
where
open Functor
open NatTrans
private
module C = Category C
module D = Category D
{-
We want the category SET ℓ we're mapping into to be large enough that the coend will take presheaves
Cᵒᵖ → Set ℓ to presheaves Dᵒᵖ → Set ℓ, otherwise we get no adjunction with precomposition.
So we must have ℓC,ℓC',ℓD' ≤ ℓ; the parameter ℓS allows ℓ to be larger than their maximum.
-}
ℓ = ℓ-max (ℓ-max (ℓ-max ℓC ℓC') ℓD') ℓS
module _ (G : Functor (C ^op) (SET ℓ)) where
-- Definition of the coend
module _ (d : D.ob) where
Raw : Type ℓ
Raw = Σ[ c ∈ C.ob ] Σ[ g ∈ D.Hom[ d , F ⟅ c ⟆ ] ] G .F-ob c .fst
data _≈_ : (u v : Raw) → Type ℓ where
shift : {c c' : C.ob} (g : D.Hom[ d , F ⟅ c ⟆ ]) (f : C.Hom[ c , c' ]) (a : (G ⟅ c' ⟆) .fst)
→ (c' , (g D.⋆ F ⟪ f ⟫) , a) ≈ (c , g , (G ⟪ f ⟫) a)
Quo = Raw / _≈_
pattern shift/ g f a i = eq/ _ _ (shift g f a) i
-- Action of Quo on arrows in D
mapR : {d d' : D.ob} (h : D.Hom[ d' , d ]) → Quo d → Quo d'
mapR h [ c , g , a ] = [ c , h D.⋆ g , a ]
mapR h (shift/ g f a i) =
hcomp
(λ j → λ
{ (i = i0) → [ _ , D.⋆Assoc h g (F ⟪ f ⟫) j , a ]
; (i = i1) → [ _ , h D.⋆ g , (G ⟪ f ⟫) a ]
})
(shift/ (h D.⋆ g) f a i)
mapR h (squash/ t u p q i j) =
squash/ (mapR h t) (mapR h u) (cong (mapR h) p) (cong (mapR h) q) i j
mapRId : (d : D.ob) → mapR (D.id {x = d}) ≡ idfun (Quo d)
mapRId d =
funExt (elimProp (λ _ → squash/ _ _) (λ (c , g , a) i → [ c , D.⋆IdL g i , a ]))
mapR∘ : {d d' d'' : D.ob}
(h' : D.Hom[ d'' , d' ]) (h : D.Hom[ d' , d ])
→ mapR (h' D.⋆ h) ≡ mapR h' ∘ mapR h
mapR∘ h' h =
funExt (elimProp (λ _ → squash/ _ _) (λ (c , g , a) i → [ c , D.⋆Assoc h' h g i , a ]))
LanOb : Functor (C ^op) (SET ℓ) → Functor (D ^op) (SET _)
LanOb G .F-ob d .fst = Quo G d
LanOb G .F-ob d .snd = squash/
LanOb G .F-hom = mapR G
LanOb G .F-id {d} = mapRId G d
LanOb G .F-seq h h' = mapR∘ G h' h
-- Action of Quo on arrows in Cᵒᵖ → Set
module _ {G G' : Functor (C ^op) (SET ℓ)} (α : NatTrans G G') where
mapL : (d : D.ob) → Quo G d → Quo G' d
mapL d [ c , g , a ] = [ c , g , α .N-ob c a ]
mapL d (shift/ g f a i) =
hcomp
(λ j → λ
{ (i = i0) → [ _ , (g D.⋆ F ⟪ f ⟫) , α .N-ob _ a ]
; (i = i1) → [ _ , g , funExt⁻ (α .N-hom f) a (~ j) ]
})
(shift/ g f ((α ⟦ _ ⟧) a) i)
mapL d (squash/ t u p q i j) =
squash/ (mapL d t) (mapL d u) (cong (mapL d) p) (cong (mapL d) q) i j
mapLR : {d d' : D.ob} (h : D.Hom[ d' , d ])
→ mapL d' ∘ mapR G h ≡ mapR G' h ∘ mapL d
mapLR h = funExt (elimProp (λ _ → squash/ _ _) (λ _ → refl))
mapLId : (G : Functor (C ^op) (SET ℓ))
(d : D.ob) → mapL (idTrans G) d ≡ idfun (Quo G d)
mapLId G d = funExt (elimProp (λ _ → squash/ _ _) (λ _ → refl))
mapL∘ : {G G' G'' : Functor (C ^op) (SET ℓ)}
(β : NatTrans G' G'') (α : NatTrans G G')
(d : D.ob) → mapL (seqTrans α β) d ≡ mapL β d ∘ mapL α d
mapL∘ β α d = funExt (elimProp (λ _ → squash/ _ _) (λ _ → refl))
LanHom : {G G' : Functor (C ^op) (SET ℓ)}
→ NatTrans G G' → NatTrans (LanOb G) (LanOb G')
LanHom α .N-ob = mapL α
LanHom α .N-hom = mapLR α
-- Definition of the left Kan extension functor
Lan : Functor (FUNCTOR (C ^op) (SET ℓ)) (FUNCTOR (D ^op) (SET ℓ))
Lan .F-ob = LanOb
Lan .F-hom = LanHom
Lan .F-id {G} = makeNatTransPath (funExt (mapLId G))
Lan .F-seq α β = makeNatTransPath (funExt (mapL∘ β α))
-- Adjunction between the left Kan extension and precomposition
private
F* = precomposeF (SET ℓ) (F ^opF)
open UnitCounit
η : 𝟙⟨ FUNCTOR (C ^op) (SET ℓ) ⟩ ⇒ funcComp F* Lan
η .N-ob G .N-ob c a = [ c , D.id , a ]
η .N-ob G .N-hom {c'} {c} f =
funExt λ a →
[ c , D.id , (G ⟪ f ⟫) a ]
≡⟨ sym (shift/ D.id f a) ⟩
[ c' , (D.id D.⋆ F ⟪ f ⟫) , a ]
≡[ i ]⟨ [ c' , lem i , a ] ⟩
[ c' , (F ⟪ f ⟫ D.⋆ D.id) , a ]
∎
where
lem : D.id D.⋆ F ⟪ f ⟫ ≡ F ⟪ f ⟫ D.⋆ D.id
lem = D.⋆IdL (F ⟪ f ⟫) ∙ sym (D.⋆IdR (F ⟪ f ⟫))
η .N-hom f = makeNatTransPath refl
ε : funcComp Lan F* ⇒ 𝟙⟨ FUNCTOR (D ^op) (SET ℓ) ⟩
ε .N-ob H .N-ob d =
elim
(λ _ → (H ⟅ d ⟆) .snd)
(λ (c , g , a) → (H ⟪ g ⟫) a)
(λ {_ _ (shift g f a) i → H .F-seq (F ⟪ f ⟫) g i a})
ε .N-ob H .N-hom g' =
funExt (elimProp (λ _ → (H ⟅ _ ⟆) .snd _ _) (λ (c , g , a) → funExt⁻ (H .F-seq g g') a))
ε .N-hom {H} {H'} α =
makeNatTransPath
(funExt₂ λ d →
elimProp (λ _ → (H' ⟅ _ ⟆) .snd _ _)
(λ (c , g , a) → sym (funExt⁻ (α .N-hom g) a)))
Δ₁ : ∀ G → seqTrans (Lan ⟪ η ⟦ G ⟧ ⟫) (ε ⟦ Lan ⟅ G ⟆ ⟧) ≡ idTrans _
Δ₁ G =
makeNatTransPath
(funExt₂ λ d →
elimProp (λ _ → squash/ _ _)
(λ (c , g , a) →
[ c , g D.⋆ D.id , a ]
≡[ i ]⟨ [ c , (g D.⋆ F .F-id (~ i)) , a ] ⟩
[ c , g D.⋆ (F ⟪ C.id ⟫) , a ]
≡⟨ shift/ g C.id a ⟩
[ c , g , (G ⟪ C.id ⟫) a ]
≡[ i ]⟨ [ c , g , G .F-id i a ] ⟩
[ c , g , a ]
∎))
Δ₂ : ∀ H → seqTrans (η ⟦ F* ⟅ H ⟆ ⟧) (F* ⟪ ε ⟦ H ⟧ ⟫) ≡ idTrans _
Δ₂ H = makeNatTransPath (funExt λ c → H .F-id)
adj : Lan ⊣ F*
adj = make⊣ η ε Δ₁ Δ₂
{-
Right Kan extension of a functor C → D to a functor PreShv C ℓ → PreShv D ℓ right adjoint to precomposition.
-}
module Ran {ℓC ℓC' ℓD ℓD'} ℓS
{C : Category ℓC ℓC'} {D : Category ℓD ℓD'}
(F : Functor C D)
where
open Functor
open NatTrans
private
module C = Category C
module D = Category D
{-
We want the category SET ℓ we're mapping into to be large enough that the coend will take presheaves
Cᵒᵖ → Set ℓ to presheaves Dᵒᵖ → Set ℓ, otherwise we get no adjunction with precomposition.
So we must have ℓC,ℓC',ℓD' ≤ ℓ; the parameter ℓS allows ℓ to be larger than their maximum.
-}
ℓ = ℓ-max (ℓ-max (ℓ-max ℓC ℓC') ℓD') ℓS
module _ (G : Functor (C ^op) (SET ℓ)) where
-- Definition of the end
record End (d : D.ob) : Type ℓ where
field
fun : (c : C.ob) (g : D.Hom[ F ⟅ c ⟆ , d ]) → G .F-ob c .fst
coh : {c c' : C.ob} (f : C.Hom[ c , c' ]) (g : D.Hom[ F ⟅ c' ⟆ , d ])
→ fun c (F ⟪ f ⟫ ⋆⟨ D ⟩ g) ≡ (G ⟪ f ⟫) (fun c' g)
open End
end≡ : {d : D.ob} {x x' : End d} → (∀ c g → x .fun c g ≡ x' .fun c g) → x ≡ x'
end≡ h i .fun c g = h c g i
end≡ {_} {x} {x'} h i .coh f g =
isSet→isSet' (G .F-ob _ .snd)
(x .coh f g)
(x' .coh f g)
(h _ (F ⟪ f ⟫ ⋆⟨ D ⟩ g))
(cong (G ⟪ f ⟫) (h _ g))
i
-- Action of End on arrows in D
mapR : {d d' : D.ob} (h : D.Hom[ d' , d ]) → End d → End d'
mapR h x .fun c g = x .fun c (g ⋆⟨ D ⟩ h)
mapR h x .coh f g = cong (x .fun _) (D.⋆Assoc (F ⟪ f ⟫) g h) ∙ x .coh f (g ⋆⟨ D ⟩ h)
mapRId : (d : D.ob) → mapR (D.id {x = d}) ≡ idfun (End d)
mapRId h = funExt λ x → end≡ λ c g → cong (x .fun c) (D.⋆IdR g)
mapR∘ : {d d' d'' : D.ob}
(h' : D.Hom[ d'' , d' ]) (h : D.Hom[ d' , d ])
→ mapR (h' D.⋆ h) ≡ mapR h' ∘ mapR h
mapR∘ h' h = funExt λ x → end≡ λ c g → cong (x .fun c) (sym (D.⋆Assoc g h' h))
open End
RanOb : Functor (C ^op) (SET ℓ) → Functor (D ^op) (SET _)
RanOb G .F-ob d .fst = End G d
RanOb G .F-ob d .snd =
-- We use that End is equivalent to a Σ-type to prove its HLevel more easily
isOfHLevelRetract 2
{B =
Σ[ z ∈ ((c : C.ob) (g : D.Hom[ F ⟅ c ⟆ , d ]) → G .F-ob c .fst) ]
({c c' : C.ob} (f : C.Hom[ c , c' ]) (g : D.Hom[ F ⟅ c' ⟆ , d ])
→ z c (F ⟪ f ⟫ ⋆⟨ D ⟩ g) ≡ (G ⟪ f ⟫) (z c' g))
}
(λ x → λ where .fst → x .fun; .snd → x .coh)
(λ σ → λ where .fun → σ .fst; .coh → σ .snd)
(λ _ → refl)
(isSetΣ
(isSetΠ2 λ _ _ → G .F-ob _ .snd)
(λ _ → isProp→isSet
(isPropImplicitΠ λ _ → isPropImplicitΠ λ _ → isPropΠ2 λ _ _ → G .F-ob _ .snd _ _)))
RanOb G .F-hom = mapR G
RanOb G .F-id {d} = mapRId G d
RanOb G .F-seq h h' = mapR∘ G h' h
-- Action of End on arrows in Cᵒᵖ → Set
module _ {G G' : Functor (C ^op) (SET ℓ)} (α : NatTrans G G') where
mapL : (d : D.ob) → End G d → End G' d
mapL d x .fun c g = (α ⟦ c ⟧) (x .fun c g)
mapL d x .coh f g =
cong (α ⟦ _ ⟧) (x .coh f g)
∙ funExt⁻ (α .N-hom f) (x .fun _ g)
mapLR : {d d' : D.ob} (h : D.Hom[ d' , d ])
→ mapL d' ∘ mapR G h ≡ mapR G' h ∘ mapL d
mapLR h = funExt λ _ → end≡ _ λ _ _ → refl
mapLId : (G : Functor (C ^op) (SET ℓ))
(d : D.ob) → mapL (idTrans G) d ≡ idfun (End G d)
mapLId G d = funExt λ _ → end≡ _ λ _ _ → refl
mapL∘ : {G G' G'' : Functor (C ^op) (SET ℓ)}
(β : NatTrans G' G'') (α : NatTrans G G')
(d : D.ob) → mapL (seqTrans α β) d ≡ mapL β d ∘ mapL α d
mapL∘ β α d = funExt λ _ → end≡ _ λ _ _ → refl
RanHom : {G G' : Functor (C ^op) (SET ℓ)}
→ NatTrans G G' → NatTrans (RanOb G) (RanOb G')
RanHom α .N-ob = mapL α
RanHom α .N-hom = mapLR α
-- Definition of the right Kan extension functor
Ran : Functor (FUNCTOR (C ^op) (SET ℓ)) (FUNCTOR (D ^op) (SET ℓ))
Ran .F-ob = RanOb
Ran .F-hom = RanHom
Ran .F-id {G} = makeNatTransPath (funExt (mapLId G))
Ran .F-seq α β = makeNatTransPath (funExt (mapL∘ β α))
-- Adjunction between precomposition and right Kan extension
private
F* = precomposeF (SET ℓ) (F ^opF)
open UnitCounit
η : 𝟙⟨ FUNCTOR (D ^op) (SET ℓ) ⟩ ⇒ (funcComp Ran F*)
η .N-ob G .N-ob d a .fun c g = (G ⟪ g ⟫) a
η .N-ob G .N-ob d a .coh f g = funExt⁻ (G .F-seq g (F ⟪ f ⟫)) a
η .N-ob G .N-hom h = funExt λ a → end≡ _ λ c g → sym (funExt⁻ (G .F-seq h g) a)
η .N-hom {G} {G'} α =
makeNatTransPath (funExt₂ λ d a → end≡ _ λ c g → sym (funExt⁻ (α .N-hom g) a))
ε : funcComp F* Ran ⇒ 𝟙⟨ FUNCTOR (C ^op) (SET ℓ) ⟩
ε .N-ob H .N-ob c x = x .fun c D.id
ε .N-ob H .N-hom {c} {c'} g =
funExt λ x →
cong (x .fun c') (D.⋆IdL _ ∙ sym (D.⋆IdR _)) ∙ x .coh g D.id
ε .N-hom {H} {H'} α = makeNatTransPath refl
Δ₁ : ∀ G → seqTrans (F* ⟪ η ⟦ G ⟧ ⟫) (ε ⟦ F* ⟅ G ⟆ ⟧) ≡ idTrans _
Δ₁ G = makeNatTransPath (funExt₂ λ c a → funExt⁻ (G .F-id) a)
Δ₂ : ∀ H → seqTrans (η ⟦ Ran ⟅ H ⟆ ⟧) (Ran ⟪ ε ⟦ H ⟧ ⟫) ≡ idTrans _
Δ₂ H = makeNatTransPath (funExt₂ λ c x → end≡ _ λ c' g → cong (x .fun c') (D.⋆IdL g))
adj : F* ⊣ Ran
adj = make⊣ η ε Δ₁ Δ₂
| 33.192982
| 110
| 0.498855
|
306f1e645769a69f1c54bac4024aacf3011afef2
| 9,568
|
agda
|
Agda
|
Cubical/Experiments/ZariskiLatticeBasicOpens.agda
|
howsiyu/cubical
|
1b9c97a2140fe96fe636f4c66beedfd7b8096e8f
|
[
"MIT"
] | null | null | null |
Cubical/Experiments/ZariskiLatticeBasicOpens.agda
|
howsiyu/cubical
|
1b9c97a2140fe96fe636f4c66beedfd7b8096e8f
|
[
"MIT"
] | null | null | null |
Cubical/Experiments/ZariskiLatticeBasicOpens.agda
|
howsiyu/cubical
|
1b9c97a2140fe96fe636f4c66beedfd7b8096e8f
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --safe --experimental-lossy-unification #-}
module Cubical.Experiments.ZariskiLatticeBasicOpens where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Powerset
open import Cubical.Foundations.Transport
open import Cubical.Foundations.Structure
open import Cubical.Functions.FunExtEquiv
import Cubical.Data.Empty as ⊥
open import Cubical.Data.Bool
open import Cubical.Data.Nat renaming ( _+_ to _+ℕ_ ; _·_ to _·ℕ_ ; _^_ to _^ℕ_
; +-comm to +ℕ-comm ; +-assoc to +ℕ-assoc
; ·-assoc to ·ℕ-assoc ; ·-comm to ·ℕ-comm)
open import Cubical.Data.Sigma.Base
open import Cubical.Data.Sigma.Properties
open import Cubical.Data.FinData
open import Cubical.Relation.Nullary
open import Cubical.Relation.Binary
open import Cubical.Relation.Binary.Poset
open import Cubical.Algebra.Ring
open import Cubical.Algebra.Algebra
open import Cubical.Algebra.CommRing
open import Cubical.Algebra.CommRing.Localisation.Base
open import Cubical.Algebra.CommRing.Localisation.UniversalProperty
open import Cubical.Algebra.CommRing.Localisation.InvertingElements
open import Cubical.Algebra.CommAlgebra.Base
open import Cubical.Algebra.CommAlgebra.Properties
open import Cubical.Algebra.CommAlgebra.Localisation
open import Cubical.Algebra.RingSolver.Reflection
open import Cubical.Algebra.Semilattice
open import Cubical.HITs.SetQuotients as SQ
open import Cubical.HITs.PropositionalTruncation as PT
open Iso
open BinaryRelation
open isEquivRel
private
variable
ℓ ℓ' : Level
module Presheaf (A' : CommRing ℓ) where
open CommRingStr (snd A') renaming (_·_ to _·r_ ; ·Comm to ·r-comm ; ·Assoc to ·rAssoc
; ·Lid to ·rLid ; ·Rid to ·rRid)
open Exponentiation A'
open CommRingTheory A'
open InvertingElementsBase A'
open isMultClosedSubset
open CommAlgebraStr ⦃...⦄
private
A = fst A'
A[1/_] : A → CommAlgebra A' ℓ
A[1/ x ] = AlgLoc.S⁻¹RAsCommAlg A' [ x ⁿ|n≥0] (powersFormMultClosedSubset _)
A[1/_]ˣ : (x : A) → ℙ (fst A[1/ x ])
A[1/ x ]ˣ = (CommAlgebra→CommRing A[1/ x ]) ˣ
_≼_ : A → A → Type ℓ
x ≼ y = ∃[ n ∈ ℕ ] Σ[ z ∈ A ] x ^ n ≡ z ·r y -- rad(x) ⊆ rad(y)
-- ≼ is a pre-order:
Refl≼ : isRefl _≼_
Refl≼ x = PT.∣ 1 , 1r , ·r-comm _ _ ∣
Trans≼ : isTrans _≼_
Trans≼ x y z = map2 Trans≼Σ
where
Trans≼Σ : Σ[ n ∈ ℕ ] Σ[ a ∈ A ] x ^ n ≡ a ·r y
→ Σ[ n ∈ ℕ ] Σ[ a ∈ A ] y ^ n ≡ a ·r z
→ Σ[ n ∈ ℕ ] Σ[ a ∈ A ] x ^ n ≡ a ·r z
Trans≼Σ (n , a , p) (m , b , q) = n ·ℕ m , (a ^ m ·r b) , path
where
path : x ^ (n ·ℕ m) ≡ a ^ m ·r b ·r z
path = x ^ (n ·ℕ m) ≡⟨ ^-rdist-·ℕ x n m ⟩
(x ^ n) ^ m ≡⟨ cong (_^ m) p ⟩
(a ·r y) ^ m ≡⟨ ^-ldist-· a y m ⟩
a ^ m ·r y ^ m ≡⟨ cong (a ^ m ·r_) q ⟩
a ^ m ·r (b ·r z) ≡⟨ ·rAssoc _ _ _ ⟩
a ^ m ·r b ·r z ∎
R : A → A → Type ℓ
R x y = x ≼ y × y ≼ x -- rad(x) ≡ rad(y)
RequivRel : isEquivRel R
RequivRel .reflexive x = Refl≼ x , Refl≼ x
RequivRel .symmetric _ _ Rxy = (Rxy .snd) , (Rxy .fst)
RequivRel .transitive _ _ _ Rxy Ryz = Trans≼ _ _ _ (Rxy .fst) (Ryz .fst)
, Trans≼ _ _ _ (Ryz .snd) (Rxy .snd)
RpropValued : isPropValued R
RpropValued x y = isProp× isPropPropTrunc isPropPropTrunc
powerIs≽ : (x a : A) → x ∈ [ a ⁿ|n≥0] → a ≼ x
powerIs≽ x a = map powerIs≽Σ
where
powerIs≽Σ : Σ[ n ∈ ℕ ] (x ≡ a ^ n) → Σ[ n ∈ ℕ ] Σ[ z ∈ A ] (a ^ n ≡ z ·r x)
powerIs≽Σ (n , p) = n , 1r , sym p ∙ sym (·rLid _)
module ≼ToLoc (x y : A) where
private
instance
_ = snd A[1/ x ]
lemma : x ≼ y → y ⋆ 1a ∈ A[1/ x ]ˣ -- y/1 ∈ A[1/x]ˣ
lemma = PT.rec (A[1/ x ]ˣ (y ⋆ 1a) .snd) lemmaΣ
where
path1 : (y z : A) → 1r ·r (y ·r 1r ·r z) ·r 1r ≡ z ·r y
path1 = solve A'
path2 : (xn : A) → xn ≡ 1r ·r 1r ·r (1r ·r 1r ·r xn)
path2 = solve A'
lemmaΣ : Σ[ n ∈ ℕ ] Σ[ a ∈ A ] x ^ n ≡ a ·r y → y ⋆ 1a ∈ A[1/ x ]ˣ
lemmaΣ (n , z , p) = [ z , (x ^ n) , PT.∣ n , refl ∣ ] -- xⁿ≡zy → y⁻¹ ≡ z/xⁿ
, eq/ _ _ ((1r , powersFormMultClosedSubset _ .containsOne)
, (path1 _ _ ∙∙ sym p ∙∙ path2 _))
module ≼PowerToLoc (x y : A) (x≼y : x ≼ y) where
private
[yⁿ|n≥0] = [ y ⁿ|n≥0]
instance
_ = snd A[1/ x ]
lemma : ∀ (s : A) → s ∈ [yⁿ|n≥0] → s ⋆ 1a ∈ A[1/ x ]ˣ
lemma _ s∈[yⁿ|n≥0] = ≼ToLoc.lemma _ _ (Trans≼ _ y _ x≼y (powerIs≽ _ _ s∈[yⁿ|n≥0]))
𝓞ᴰ : A / R → CommAlgebra A' ℓ
𝓞ᴰ = rec→Gpd.fun isGroupoidCommAlgebra (λ a → A[1/ a ]) RCoh LocPathProp
where
RCoh : ∀ a b → R a b → A[1/ a ] ≡ A[1/ b ]
RCoh a b (a≼b , b≼a) = fst (isContrS₁⁻¹R≡S₂⁻¹R (≼PowerToLoc.lemma _ _ b≼a)
(≼PowerToLoc.lemma _ _ a≼b))
where
open AlgLocTwoSubsets A' [ a ⁿ|n≥0] (powersFormMultClosedSubset _)
[ b ⁿ|n≥0] (powersFormMultClosedSubset _)
LocPathProp : ∀ a b → isProp (A[1/ a ] ≡ A[1/ b ])
LocPathProp a b = isPropS₁⁻¹R≡S₂⁻¹R
where
open AlgLocTwoSubsets A' [ a ⁿ|n≥0] (powersFormMultClosedSubset _)
[ b ⁿ|n≥0] (powersFormMultClosedSubset _)
-- The quotient A/R corresponds to the basic opens of the Zariski topology.
-- Multiplication lifts to the quotient and corresponds to intersection
-- of basic opens, i.e. we get a meet-semilattice with:
_∧/_ : A / R → A / R → A / R
_∧/_ = setQuotSymmBinOp (RequivRel .reflexive) (RequivRel .transitive) _·r_
(λ a b → subst (λ x → R (a ·r b) x) (·r-comm a b) (RequivRel .reflexive (a ·r b))) ·r-lcoh
where
·r-lcoh-≼ : (x y z : A) → x ≼ y → (x ·r z) ≼ (y ·r z)
·r-lcoh-≼ x y z = map ·r-lcoh-≼Σ
where
path : (x z a y zn : A) → x ·r z ·r (a ·r y ·r zn) ≡ x ·r zn ·r a ·r (y ·r z)
path = solve A'
·r-lcoh-≼Σ : Σ[ n ∈ ℕ ] Σ[ a ∈ A ] x ^ n ≡ a ·r y
→ Σ[ n ∈ ℕ ] Σ[ a ∈ A ] (x ·r z) ^ n ≡ a ·r (y ·r z)
·r-lcoh-≼Σ (n , a , p) = suc n , (x ·r z ^ n ·r a) , (cong (x ·r z ·r_) (^-ldist-· _ _ _)
∙∙ cong (λ v → x ·r z ·r (v ·r z ^ n)) p
∙∙ path _ _ _ _ _)
·r-lcoh : (x y z : A) → R x y → R (x ·r z) (y ·r z)
·r-lcoh x y z Rxy = ·r-lcoh-≼ x y z (Rxy .fst) , ·r-lcoh-≼ y x z (Rxy .snd)
BasicOpens : Semilattice ℓ
BasicOpens = makeSemilattice [ 1r ] _∧/_ squash/
(elimProp3 (λ _ _ _ → squash/ _ _) λ _ _ _ → cong [_] (·rAssoc _ _ _))
(elimProp (λ _ → squash/ _ _) λ _ → cong [_] (·rRid _))
(elimProp (λ _ → squash/ _ _) λ _ → cong [_] (·rLid _))
(elimProp2 (λ _ _ → squash/ _ _) λ _ _ → cong [_] (·r-comm _ _))
(elimProp (λ _ → squash/ _ _) λ a → eq/ _ _ -- R a a²
(∣ 1 , a , ·rRid _ ∣ , ∣ 2 , 1r , cong (a ·r_) (·rRid a) ∙ sym (·rLid _) ∣))
-- The induced partial order
open MeetSemilattice BasicOpens renaming (_≤_ to _≼/_ ; IndPoset to BasicOpensAsPoset)
-- coincides with our ≼
≼/CoincidesWith≼ : ∀ (x y : A) → ([ x ] ≼/ [ y ]) ≡ (x ≼ y)
≼/CoincidesWith≼ x y = [ x ] ≼/ [ y ] -- ≡⟨ refl ⟩ [ x ·r y ] ≡ [ x ]
≡⟨ isoToPath (isEquivRel→effectiveIso RpropValued RequivRel _ _) ⟩
R (x ·r y) x
≡⟨ isoToPath Σ-swap-Iso ⟩
R x (x ·r y)
≡⟨ hPropExt (RpropValued _ _) isPropPropTrunc ·To≼ ≼To· ⟩
x ≼ y ∎
where
x≼xy→x≼yΣ : Σ[ n ∈ ℕ ] Σ[ z ∈ A ] x ^ n ≡ z ·r (x ·r y)
→ Σ[ n ∈ ℕ ] Σ[ z ∈ A ] x ^ n ≡ z ·r y
x≼xy→x≼yΣ (n , z , p) = n , (z ·r x) , p ∙ ·rAssoc _ _ _
·To≼ : R x (x ·r y) → x ≼ y
·To≼ (x≼xy , _) = PT.map x≼xy→x≼yΣ x≼xy
x≼y→x≼xyΣ : Σ[ n ∈ ℕ ] Σ[ z ∈ A ] x ^ n ≡ z ·r y
→ Σ[ n ∈ ℕ ] Σ[ z ∈ A ] x ^ n ≡ z ·r (x ·r y)
x≼y→x≼xyΣ (n , z , p) = suc n , z , cong (x ·r_) p ∙ ·CommAssocl _ _ _
≼To· : x ≼ y → R x ( x ·r y)
≼To· x≼y = PT.map x≼y→x≼xyΣ x≼y , PT.∣ 1 , y , ·rRid _ ∙ ·r-comm _ _ ∣
open IsPoset
open PosetStr
Refl≼/ : isRefl _≼/_
Refl≼/ = BasicOpensAsPoset .snd .isPoset .is-refl
Trans≼/ : isTrans _≼/_
Trans≼/ = BasicOpensAsPoset .snd .isPoset .is-trans
-- The restrictions:
ρᴰᴬ : (a b : A) → a ≼ b → isContr (CommAlgebraHom A[1/ b ] A[1/ a ])
ρᴰᴬ _ b a≼b = A[1/b]HasUniversalProp _ (≼PowerToLoc.lemma _ _ a≼b)
where
open AlgLoc A' [ b ⁿ|n≥0] (powersFormMultClosedSubset _)
renaming (S⁻¹RHasAlgUniversalProp to A[1/b]HasUniversalProp)
ρᴰᴬId : ∀ (a : A) (r : a ≼ a) → ρᴰᴬ a a r .fst ≡ idAlgHom
ρᴰᴬId a r = ρᴰᴬ a a r .snd _
ρᴰᴬComp : ∀ (a b c : A) (l : a ≼ b) (m : b ≼ c)
→ ρᴰᴬ a c (Trans≼ _ _ _ l m) .fst ≡ ρᴰᴬ a b l .fst ∘a ρᴰᴬ b c m .fst
ρᴰᴬComp a _ c l m = ρᴰᴬ a c (Trans≼ _ _ _ l m) .snd _
ρᴰ : (x y : A / R) → x ≼/ y → CommAlgebraHom (𝓞ᴰ y) (𝓞ᴰ x)
ρᴰ = elimContr2 λ _ _ → isContrΠ
λ [a]≼/[b] → ρᴰᴬ _ _ (transport (≼/CoincidesWith≼ _ _) [a]≼/[b])
ρᴰId : ∀ (x : A / R) (r : x ≼/ x) → ρᴰ x x r ≡ idAlgHom
ρᴰId = SQ.elimProp (λ _ → isPropΠ (λ _ → isSetAlgebraHom _ _ _ _))
λ a r → ρᴰᴬId a (transport (≼/CoincidesWith≼ _ _) r)
ρᴰComp : ∀ (x y z : A / R) (l : x ≼/ y) (m : y ≼/ z)
→ ρᴰ x z (Trans≼/ _ _ _ l m) ≡ ρᴰ x y l ∘a ρᴰ y z m
ρᴰComp = SQ.elimProp3 (λ _ _ _ → isPropΠ2 (λ _ _ → isSetAlgebraHom _ _ _ _))
λ a b c _ _ → sym (ρᴰᴬ a c _ .snd _) ∙ ρᴰᴬComp a b c _ _
| 38.272
| 100
| 0.534176
|
43cad849307a16e785df19b686f498cc1f9d5dd8
| 212
|
agda
|
Agda
|
src/Trees.agda
|
ice1k/Theorems
|
7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc
|
[
"Apache-2.0"
] | 1
|
2020-04-15T15:28:03.000Z
|
2020-04-15T15:28:03.000Z
|
src/Trees.agda
|
ice1k/Theorems
|
7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc
|
[
"Apache-2.0"
] | null | null | null |
src/Trees.agda
|
ice1k/Theorems
|
7dc0ea4782a5ff960fe31bdcb8718ce478eaddbc
|
[
"Apache-2.0"
] | null | null | null |
module Trees where
open import Data.Unit using (⊤)
data BinTree {a} (A : Set a) : Set a where
Empty : A → BinTree A
Node : A → BinTree A → BinTree A → BinTree A
BareBinTree : Set
BareBinTree = BinTree ⊤
| 17.666667
| 47
| 0.660377
|
7391211816b721681a5face2901feb93eba0c14f
| 5,243
|
agda
|
Agda
|
Univalence/OldUnivalence/SimpleHoTT.agda
|
JacquesCarette/pi-dual
|
003835484facfde0b770bc2b3d781b42b76184c1
|
[
"BSD-2-Clause"
] | 14
|
2015-08-18T21:40:15.000Z
|
2021-05-05T01:07:57.000Z
|
Univalence/OldUnivalence/SimpleHoTT.agda
|
JacquesCarette/pi-dual
|
003835484facfde0b770bc2b3d781b42b76184c1
|
[
"BSD-2-Clause"
] | 4
|
2018-06-07T16:27:41.000Z
|
2021-10-29T20:41:23.000Z
|
Univalence/OldUnivalence/SimpleHoTT.agda
|
JacquesCarette/pi-dual
|
003835484facfde0b770bc2b3d781b42b76184c1
|
[
"BSD-2-Clause"
] | 3
|
2016-05-29T01:56:33.000Z
|
2019-09-10T09:47:13.000Z
|
{-# OPTIONS --without-K #-}
module SimpleHoTT where
open import Data.Empty
open import Data.Sum renaming (map to _⊎→_)
open import Function renaming (_∘_ to _○_)
infixr 8 _∘_ -- path composition
infix 4 _≡_ -- propositional equality
infix 2 _∎ -- equational reasoning for paths
infixr 2 _≡⟨_⟩_ -- equational reasoning for paths
------------------------------------------------------------------------------
-- Equivalences a la HoTT (using HoTT paths and path induction)
-- Our own version of refl that makes 'a' explicit
data _≡_ {ℓ} {A : Set ℓ} : (a b : A) → Set ℓ where
refl : (a : A) → (a ≡ a)
-- not sure where else to put this [Z]
hetType : {A B : Set} → (a : A) → A ≡ B → B
hetType a (refl _) = a
-- J
pathInd : ∀ {u ℓ} → {A : Set u} →
(C : {x y : A} → x ≡ y → Set ℓ) →
(c : (x : A) → C (refl x)) →
({x y : A} (p : x ≡ y) → C p)
pathInd C c (refl x) = c x
basedPathInd : {A : Set} → (a : A) → (C : (x : A) → (a ≡ x) → Set) →
C a (refl a) → ((x : A) (p : a ≡ x) → C x p)
basedPathInd a C c .a (refl .a) = c
! : ∀ {u} → {A : Set u} {x y : A} → (x ≡ y) → (y ≡ x)
! = pathInd (λ {x} {y} _ → y ≡ x) refl
_∘_ : ∀ {u} → {A : Set u} → {x y z : A} → (x ≡ y) → (y ≡ z) → (x ≡ z)
_∘_ {u} {A} {x} {y} {z} p q =
pathInd {u}
(λ {x} {y} p → ((z : A) → (q : y ≡ z) → (x ≡ z)))
(λ x z q → pathInd (λ {x} {z} _ → x ≡ z) refl {x} {z} q)
{x} {y} p z q
-- p = p . refl
unitTransR : {A : Set} {x y : A} → (p : x ≡ y) → (p ≡ p ∘ refl y)
unitTransR {A} {x} {y} p =
pathInd
(λ {x} {y} p → p ≡ p ∘ (refl y))
(λ x → refl (refl x))
{x} {y} p
-- p = refl . p
unitTransL : {A : Set} {x y : A} → (p : x ≡ y) → (p ≡ refl x ∘ p)
unitTransL {A} {x} {y} p =
pathInd
(λ {x} {y} p → p ≡ (refl x) ∘ p)
(λ x → refl (refl x))
{x} {y} p
ap : ∀ {ℓ ℓ'} → {A : Set ℓ} {B : Set ℓ'} {x y : A} →
(f : A → B) → (x ≡ y) → (f x ≡ f y)
ap {ℓ} {ℓ'} {A} {B} {x} {y} f p =
pathInd -- on p
(λ {x} {y} p → f x ≡ f y)
(λ x → refl (f x))
{x} {y} p
ap2 : ∀ {ℓ ℓ' ℓ''} → {A : Set ℓ} {B : Set ℓ'} {C : Set ℓ''}
{x₁ y₁ : A} {x₂ y₂ : B} →
(f : A → B → C) → (x₁ ≡ y₁) → (x₂ ≡ y₂) → (f x₁ x₂ ≡ f y₁ y₂)
ap2 {ℓ} {ℓ'} {ℓ''} {A} {B} {C} {x₁} {y₁} {x₂} {y₂} f p₁ p₂ =
pathInd -- on p₁
(λ {x₁} {y₁} p₁ → f x₁ x₂ ≡ f y₁ y₂)
(λ x →
pathInd -- on p₂
(λ {x₂} {y₂} p₂ → f x x₂ ≡ f x y₂)
(λ y → refl (f x y))
{x₂} {y₂} p₂)
{x₁} {y₁} p₁
-- Abbreviations for path compositions
_≡⟨_⟩_ : ∀ {u} → {A : Set u} (x : A) {y z : A} → (x ≡ y) → (y ≡ z) → (x ≡ z)
_ ≡⟨ p ⟩ q = p ∘ q
bydef : ∀ {u} → {A : Set u} {x : A} → (x ≡ x)
bydef {u} {A} {x} = refl x
_∎ : ∀ {u} → {A : Set u} (x : A) → x ≡ x
_∎ x = refl x
-- Transport; Lifting
transport : ∀ {ℓ ℓ'} → {A : Set ℓ} {x y : A} →
(P : A → Set ℓ') → (p : x ≡ y) → P x → P y
transport {ℓ} {ℓ'} {A} {x} {y} P p =
pathInd -- on p
(λ {x} {y} p → (P x → P y))
(λ _ → id)
{x} {y} p
-- Lemma 2.3.10
transport-f : ∀ {ℓ ℓ' ℓ''} → {A : Set ℓ} {B : Set ℓ'} {x y : A} →
(f : A → B) → (P : B → Set ℓ'') →
(p : x ≡ y) → (u : P (f x)) →
transport (P ○ f) p u ≡ transport P (ap f p) u
transport-f {ℓ} {ℓ'} {ℓ''} {A} {B} {x} {y} f P p u =
pathInd -- on p
(λ {x} {y} p → (u : P (f x)) →
transport (P ○ f) p u ≡ transport P (ap f p) u)
(λ x u → refl u)
{x} {y} p u
-- Lemma 2.11.2
transportIdR : {A : Set} {a y z : A} → (p : y ≡ z) → (q : a ≡ y) →
transport (λ x → a ≡ x) p q ≡ q ∘ p
transportIdR {A} {a} {y} {z} p q =
pathInd
(λ {y} {z} p → (q : a ≡ y) → transport (λ x → a ≡ x) p q ≡ q ∘ p)
(λ y q → transport (λ x → a ≡ x) (refl y) q
≡⟨ bydef ⟩
q
≡⟨ unitTransR q ⟩
q ∘ refl y ∎)
{y} {z} p q
transportIdL : {A : Set} {a y z : A} → (p : y ≡ z) → (q : y ≡ a) →
transport (λ x → x ≡ a) p q ≡ ! p ∘ q
transportIdL {A} {a} {y} {z} p q =
pathInd
(λ {y} {z} p → (q : y ≡ a) → transport (λ x → x ≡ a) p q ≡ ! p ∘ q)
(λ y q → transport (λ x → x ≡ a) (refl y) q
≡⟨ bydef ⟩
q
≡⟨ unitTransL q ⟩
! (refl y) ∘ q ∎)
{y} {z} p q
transportIdRefl : {A : Set} {y z : A} → (p : y ≡ z) → (q : y ≡ y) →
transport (λ x → x ≡ x) p q ≡ ! p ∘ q ∘ p
transportIdRefl {A} {y} {z} p q =
pathInd
(λ {y} {z} p → (q : y ≡ y) → transport (λ x → x ≡ x) p q ≡ ! p ∘ q ∘ p)
(λ y q → transport (λ x → x ≡ x) (refl y) q
≡⟨ bydef ⟩
q
≡⟨ unitTransR q ⟩
q ∘ refl y
≡⟨ unitTransL (q ∘ refl y) ⟩
! (refl y) ∘ q ∘ refl y ∎)
{y} {z} p q
-- tools for coproducts (Sec. 2.12)
indCP : {A B : Set} → (C : A ⊎ B → Set) →
((a : A) → C (inj₁ a)) → ((b : B) → C (inj₂ b)) → ((x : A ⊎ B) → C x)
indCP C f g (inj₁ a) = f a
indCP C f g (inj₂ b) = g b
code : {A B : Set} → (a₀ : A) → A ⊎ B → Set
code a₀ (inj₁ a) = a₀ ≡ a
code a₀ (inj₂ b) = ⊥
encode : {A B : Set} → (a₀ : A) → (x : A ⊎ B) → (p : inj₁ a₀ ≡ x) → code a₀ x
encode {A} {B} a₀ x p = transport (code a₀) p (refl a₀)
decode : {A B : Set} → (a₀ : A) → (x : A ⊎ B) → (c : code a₀ x) → inj₁ a₀ ≡ x
decode a₀ (inj₁ a) c = ap inj₁ c
decode a₀ (inj₂ b) ()
| 29.96
| 78
| 0.400343
|
731d4f62d17502b2854eea6208f48efb4f79585c
| 815
|
agda
|
Agda
|
test/Succeed/Issue450.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 3
|
2015-03-28T14:51:03.000Z
|
2015-12-07T20:14:00.000Z
|
test/Succeed/Issue450.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 3
|
2018-11-14T15:31:44.000Z
|
2019-04-01T19:39:26.000Z
|
test/Succeed/Issue450.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1
|
2019-03-05T20:02:38.000Z
|
2019-03-05T20:02:38.000Z
|
module Issue450 where
open import Common.Level
open import Common.Coinduction
data _≡_ {A : Set}(x : A) : A → Set where
refl : x ≡ x
data Wrap (A : Set) : Set where
con : A -> Wrap A
out : forall {A} -> Wrap A -> A
out (con x) = x
out' : forall {A} -> ∞ (Wrap A) -> A
out' y = out (♭ y)
inn : forall {A} -> A -> ∞ (Wrap A)
inn y = ♯ (con y)
prf : (A : Set)(x : A) → out' (inn x) ≡ x
prf A x = refl
test : forall {A : Set}{x : A} -> out (con x) ≡ x
test = refl
-- these work
test1 : forall {A}{x : A} -> out' (inn x) ≡ x
test1 {A} {x} = test
test2 : forall {A}{x : A} -> out' (inn x) ≡ x
test2 {A} {x} = test {A}
-- but the following ones won't typecheck
test3 : forall {A}{x : A} -> out' (inn x) ≡ x
test3 {A} {x} = test {A} {x}
test4 : forall {A}{x : A} -> out' (inn x) ≡ x
test4 {A} {x} = refl
| 19.404762
| 49
| 0.52638
|
0dbc72c2f9fa975a98a02b696ac8b18e4e77ffbd
| 1,042
|
agda
|
Agda
|
test/Succeed/Issue899.agda
|
alex-mckenna/agda
|
78b62cd24bbd570271a7153e44ad280e52ef3e29
|
[
"BSD-3-Clause"
] | 1
|
2016-03-17T01:45:59.000Z
|
2016-03-17T01:45:59.000Z
|
test/Succeed/Issue899.agda
|
andersk/agda
|
56928ff709dcb931cb9a48c4790e5ed3739e3032
|
[
"BSD-3-Clause"
] | null | null | null |
test/Succeed/Issue899.agda
|
andersk/agda
|
56928ff709dcb931cb9a48c4790e5ed3739e3032
|
[
"BSD-3-Clause"
] | 1
|
2019-03-05T20:02:38.000Z
|
2019-03-05T20:02:38.000Z
|
-- Andreas, 2013-11-07
-- Instance candidates are now considered modulo judgemental equality.
module Issue899 where
postulate
A B : Set
f : {{ x : A }} → B
instance a : A
instance
a' : A
a' = a
test : B
test = f
{- The previous code fails with the following message:
Resolve implicit argument _x_257 : A. Candidates: [a : A, a : A]
There are indeed two values in scope of type A (a and a'), but given
that they are definitionally equal, Agda should not complain about it
but just pick any one of them. -}
-- Andreas, 2017-07-28: the other example now also works, thanks to G. Brunerie
record Eq (A : Set) : Set₁ where
field
_==_ : A → A → Set
record Ord (A : Set) : Set₁ where
field
{{eq}} : Eq A
_<_ : A → A → Set
postulate
N : Set
eqN : N → N → Set
ordN : N → N → Set
instance
EqN : Eq N
EqN = record {_==_ = eqN}
OrdN : Ord N
OrdN = record {_<_ = ordN}
ordToEq : {A : Set} → Ord A → Eq A
ordToEq o = Ord.eq o
postulate
f2 : (A : Set) {{e : Eq A}} → Set → Set
test2 = f2 N N
| 18.607143
| 79
| 0.614203
|
14eb157b9126663cbc143cc0f5b2769ff3e92338
| 33
|
agda
|
Agda
|
Categories/Preorder.agda
|
copumpkin/categories
|
36f4181d751e2ecb54db219911d8c69afe8ba892
|
[
"BSD-3-Clause"
] | 98
|
2015-04-15T14:57:33.000Z
|
2022-03-08T05:20:36.000Z
|
Categories/Preorder.agda
|
p-pavel/categories
|
e41aef56324a9f1f8cf3cd30b2db2f73e01066f2
|
[
"BSD-3-Clause"
] | 19
|
2015-05-23T06:47:10.000Z
|
2019-08-09T16:31:40.000Z
|
Categories/Preorder.agda
|
p-pavel/categories
|
e41aef56324a9f1f8cf3cd30b2db2f73e01066f2
|
[
"BSD-3-Clause"
] | 23
|
2015-02-05T13:03:09.000Z
|
2021-11-11T13:50:56.000Z
|
module Categories.Preorder where
| 16.5
| 32
| 0.878788
|
14435461c35e8cdeb1157a0b492e95dd516cdf3f
| 40,156
|
agda
|
Agda
|
Definition/LogicalRelation/Substitution/Introductions/CastPi.agda
|
CoqHott/logrel-mltt
|
e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04
|
[
"MIT"
] | 2
|
2018-06-21T08:39:01.000Z
|
2022-01-17T16:13:53.000Z
|
Definition/LogicalRelation/Substitution/Introductions/CastPi.agda
|
CoqHott/logrel-mltt
|
e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04
|
[
"MIT"
] | null | null | null |
Definition/LogicalRelation/Substitution/Introductions/CastPi.agda
|
CoqHott/logrel-mltt
|
e0eeebc4aa5ed791ce3e7c0dc9531bd113dfcc04
|
[
"MIT"
] | 2
|
2022-01-26T14:55:51.000Z
|
2022-02-15T19:42:19.000Z
|
{-# OPTIONS --safe #-}
open import Definition.Typed.EqualityRelation
module Definition.LogicalRelation.Substitution.Introductions.CastPi {{eqrel : EqRelSet}} where
open EqRelSet {{...}}
open import Definition.Untyped as U hiding (wk)
open import Definition.Untyped.Properties
open import Definition.Typed
open import Definition.Typed.Properties
open import Definition.Typed.Weakening as T hiding (wk; wkTerm; wkEqTerm)
open import Definition.Typed.RedSteps
open import Definition.LogicalRelation
open import Definition.LogicalRelation.ShapeView
open import Definition.LogicalRelation.Irrelevance
open import Definition.LogicalRelation.Weakening
open import Definition.LogicalRelation.Properties
open import Definition.LogicalRelation.Application
open import Definition.LogicalRelation.Substitution
open import Definition.LogicalRelation.Substitution.Properties
open import Definition.LogicalRelation.Substitution.Irrelevance as S
open import Definition.LogicalRelation.Substitution.Reflexivity
open import Definition.LogicalRelation.Substitution.Introductions.Sigma
open import Definition.LogicalRelation.Substitution.Introductions.Fst
open import Definition.LogicalRelation.Substitution.Introductions.Snd
open import Definition.LogicalRelation.Substitution.Introductions.Pi
open import Definition.LogicalRelation.Substitution.Introductions.Lambda
open import Definition.LogicalRelation.Substitution.Introductions.Application
open import Definition.LogicalRelation.Substitution.Introductions.Cast
open import Definition.LogicalRelation.Substitution.Introductions.Id
open import Definition.LogicalRelation.Substitution.Introductions.IdUPiPi
open import Definition.LogicalRelation.Substitution.Introductions.Transp
open import Definition.LogicalRelation.Substitution.Introductions.SingleSubst
open import Definition.LogicalRelation.Substitution.MaybeEmbed
open import Definition.LogicalRelation.Substitution.Introductions.Universe
open import Definition.LogicalRelation.Substitution.Reduction
open import Definition.LogicalRelation.Substitution.Weakening
open import Definition.LogicalRelation.Substitution.Conversion
open import Definition.LogicalRelation.Substitution.ProofIrrelevance
open import Definition.LogicalRelation.Fundamental.Variable
open import Tools.Product
import Tools.PropositionalEquality as PE
wk2d : Term → Term
wk2d = U.wk (lift (lift (step id)))
wk1f-cast-subst : ∀ σ f A' A rA e →
(wk1 (subst σ f) ∘ cast ⁰ (wk1 (subst σ A')) (wk1 (subst σ A)) (Idsym (Univ rA ⁰) (wk1 (subst σ A)) (wk1 (subst σ A')) (fst (wk1 (subst σ e)))) (var 0) ^ ⁰)
PE.≡
subst (repeat liftSubst (repeat liftSubst σ 1) 0) (wk1 f ∘ cast ⁰ (wk1 A') (wk1 A) (Idsym (Univ rA ⁰) (wk1 A) (wk1 A') (fst (wk1 e))) (var 0) ^ ⁰)
wk1f-cast-subst σ f A' A rA e = PE.cong₂ (λ X Y → X ∘ Y ^ ⁰) (PE.sym (Idsym-subst-lemma σ f))
(PE.cong₃ (λ X Y Z → cast ⁰ X Y Z (var 0)) (PE.sym (Idsym-subst-lemma σ A')) (PE.sym (Idsym-subst-lemma σ A))
(PE.trans (PE.cong₃ (λ X Y Z → Idsym (Univ rA ⁰) X Y Z) (PE.sym (Idsym-subst-lemma σ A)) (PE.sym (Idsym-subst-lemma σ A')) (PE.sym (Idsym-subst-lemma σ (fst e))))
(PE.sym (subst-Idsym (liftSubst σ) (Univ rA ⁰) (wk1 A) (wk1 A') (fst (wk1 e))))))
B-cast-subst : ∀ σ A' A rA e B →
subst (liftSubst σ) B [ cast ⁰ (wk1 (subst σ A')) (wk1 (subst σ A)) (Idsym (Univ rA ⁰) (wk1 (subst σ A)) (wk1 (subst σ A')) (fst (wk1 (subst σ e)))) (var 0) ]↑
PE.≡
subst (repeat liftSubst (repeat liftSubst σ 1) 0) (B [ cast ⁰ (wk1 A') (wk1 A) (Idsym (Univ rA ⁰) (wk1 A) (wk1 A') (fst (wk1 e))) (var 0) ]↑)
B-cast-subst σ A′ A rA e B = PE.trans (PE.cong (λ X → (subst (liftSubst σ) B) [ X ]↑)
(PE.cong₃ (λ X Y Z → cast ⁰ X Y Z (var 0)) (PE.sym (Idsym-subst-lemma σ A′)) (PE.sym (Idsym-subst-lemma σ A))
(PE.trans (PE.cong₃ (λ X Y Z → Idsym (Univ rA ⁰) X Y Z) (PE.sym (Idsym-subst-lemma σ A)) (PE.sym (Idsym-subst-lemma σ A′)) (PE.sym (Idsym-subst-lemma σ (fst e))))
(PE.sym (subst-Idsym (liftSubst σ) (Univ rA ⁰) (wk1 A) (wk1 A′) (fst (wk1 e)))))))
(PE.sym ((singleSubstLift↑ σ B _)))
wk2d11-111 : ∀ A → wk2d (wk1 (wk1 A)) PE.≡ wk1 (wk1 (wk1 A))
wk2d11-111 A = PE.trans (wk-comp (lift (lift (step id))) (step id) (wk1 A))
(PE.trans (wk-comp (step (lift (step id))) (step id) A)
(PE.trans (PE.sym (wk-comp (step (step id)) (step id) A)) (PE.sym (wk-comp (step id) (step id) (wk1 A)))))
wk2d1d-1d1d : ∀ A → wk2d (wk1d A) PE.≡ wk1d (wk1d A)
wk2d1d-1d1d A = PE.trans (wk-comp (lift (lift (step id))) (lift (step id)) A)
(PE.trans PE.refl (PE.sym (wk-comp (lift (step id)) (lift (step id)) A)))
wk1∃-aux : ∀ A A' rA B B' → wk1 (∃ Id (Univ rA ⁰) A A' ▹ (Π wk1 A' ^ rA ° ⁰ ▹
Id (U ⁰) (wk1d B [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A))
(Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑)
(wk1d B') ° ¹ ° ¹))
PE.≡
∃ Id (Univ rA ⁰) (wk1 A) (wk1 A') ▹ (Π wk1 (wk1 A') ^ rA ° ⁰ ▹
Id (U ⁰) (wk2d (wk1d B) [ cast ⁰ (wk2d (wk1 (wk1 A'))) (wk2d (wk1 (wk1 A)))
(Idsym (Univ rA ⁰) (wk2d (wk1 (wk1 A))) (wk2d (wk1 (wk1 A'))) (var 1)) (var 0) ]↑)
(wk1d (wk1d B')) ° ¹ ° ¹)
wk1∃-aux A A' rA B B' = PE.cong₃ (λ X Y Z → ∃ Id (Univ rA ⁰) (wk1 A) (wk1 A') ▹ Π X ^ rA ° ⁰ ▹ Id (U ⁰) Y Z ° ¹ ° ¹)
(PE.trans (wk-comp (lift (step id)) (step id) A') (PE.sym (wk-comp (step id) (step id) A')))
(PE.trans (wk-β↑ (wk1d B)) (PE.cong₃ (λ X Y Z → wk2d (wk1d B) [ cast ⁰ X Y Z (var 0) ]↑)
PE.refl PE.refl (wk-Idsym (lift (lift (step id))) (Univ rA ⁰) _ _ (var 1)) ))
(wk2d1d-1d1d B')
wk1∃ : ∀ A A' rA B B' → wk1 (∃ Id (Univ rA ⁰) A A' ▹ (Π wk1 A' ^ rA ° ⁰ ▹
Id (U ⁰) (wk1d B [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A))
(Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑)
(wk1d B') ° ¹ ° ¹))
PE.≡
∃ Id (Univ rA ⁰) (wk1 A) (wk1 A') ▹ (Π wk1 (wk1 A') ^ rA ° ⁰ ▹
Id (U ⁰) (wk1d (wk1d B) [ cast ⁰ (wk1 (wk1 (wk1 A'))) (wk1 (wk1 (wk1 A)))
(Idsym (Univ rA ⁰) (wk1 (wk1 (wk1 A))) (wk1 (wk1 (wk1 A'))) (var 1)) (var 0) ]↑)
(wk1d (wk1d B')) ° ¹ ° ¹)
wk1∃ A A' rA B B' = PE.trans (wk1∃-aux A A' rA B B') (PE.cong₃ (λ X Y Z → ∃ Id (Univ rA ⁰) (wk1 A) (wk1 A') ▹ Π (wk1 (wk1 A')) ^ rA ° ⁰ ▹ Id (U ⁰) (X [ Y ]↑) Z ° ¹ ° ¹)
(wk2d1d-1d1d B) (PE.cong₃ (λ X Y Z → cast ⁰ X Y Z (var 0)) (wk2d11-111 A') (wk2d11-111 A)
(PE.cong₂ (λ X Y → Idsym (Univ rA ⁰) X Y (var 1)) (wk2d11-111 A) (wk2d11-111 A'))) PE.refl )
snd-cast-subst : ∀ A A' rA B B' e → Π wk1 (wk1 A') ^ rA ° ⁰ ▹
Id (U ⁰) (wk1d (wk1d B) [ cast ⁰ (wk1 (wk1 (wk1 A'))) (wk1 (wk1 (wk1 A))) (Idsym (Univ rA ⁰) (wk1 (wk1 (wk1 A))) (wk1 (wk1 (wk1 A'))) (var 1)) (var 0) ]↑)
(wk1d (wk1d B')) ° ¹ ° ¹ [ fst (wk1 e) ]
PE.≡
Π (wk1 A') ^ rA ° ⁰ ▹
Id (U ⁰) (wk1d B [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (fst (wk1 (wk1 e)))) (var 0) ]↑)
(wk1d B') ° ¹ ° ¹
snd-cast-subst A A' rA B B' e = PE.cong₃ (λ X Y Z → Π X ^ rA ° ⁰ ▹ Id (U ⁰) Y Z ° ¹ ° ¹)
(wk1-singleSubst (wk1 A') _)
(PE.trans (singleSubstLift↑ (sgSubst (fst (wk1 e))) (wk1d (wk1d B)) _)
(PE.cong₂ (λ X Y → X [ Y ]↑) (wk1d-singleSubst (wk1d B) (fst (wk1 e)))
(PE.cong₃ (λ X Y Z → cast ⁰ X Y Z (var 0)) (subst3wk A' (fst (wk1 e))) (subst3wk A (fst (wk1 e)))
(PE.trans (subst-Idsym (liftSubst (sgSubst (fst (wk1 e)))) (Univ rA ⁰) (wk1 (wk1 (wk1 A))) (wk1 (wk1 (wk1 A'))) (var 1))
(PE.cong₂ (λ X Y → Idsym (Univ rA ⁰) X Y (fst (wk1 (wk1 e)))) (subst3wk A (fst (wk1 e))) (subst3wk A' (fst (wk1 e))))))))
(wk1d-singleSubst (wk1d B') (fst (wk1 e)))
where
subst3wk : ∀ t u → subst (liftSubst (sgSubst u)) (wk1 (wk1 (wk1 t))) PE.≡ wk1 (wk1 t)
subst3wk t u = PE.trans (Idsym-subst-lemma (sgSubst u) (wk1 (wk1 t))) (PE.cong wk1 (wk1-singleSubst (wk1 t) u))
Id-cast-subst : ∀ A A' rA B B' e → Id (U ⁰) (wk1d B [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (fst (wk1 (wk1 e)))) (var 0) ]↑)
(wk1d B')
[ var 0 ]
PE.≡
Id (U ⁰) (B [ cast ⁰ (wk1 A') (wk1 A) (Idsym (Univ rA ⁰) (wk1 A) (wk1 A') (fst (wk1 e))) (var 0) ]↑)
B'
Id-cast-subst A A' rA B B' e = PE.cong₂ (Id (U ⁰))
(PE.trans
(PE.cong (λ X → X [ var 0 ]) (wk1d[]-[]↑ (wk1d B) _))
(PE.trans aux (PE.sym (wk1d[]-[]↑ B _))) )
(wkSingleSubstId B')
where
aux : (wk1d (wk1d B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (fst (wk1 (wk1 e)))) (var 0) ]) [ var 0 ]
PE.≡ wk1d B [ cast ⁰ (wk1 A') (wk1 A) (Idsym (Univ rA ⁰) (wk1 A) (wk1 A') (fst (wk1 e))) (var 0) ]
aux = PE.trans (singleSubstLift (wk1d (wk1d B)) _)
(PE.cong₄ (λ X Y Z T → X [ cast ⁰ Y Z T (var 0) ])
(wk1d-singleSubst (wk1d B) (var 0)) (wk1-singleSubst (wk1 A') (var 0)) (wk1-singleSubst (wk1 A) (var 0))
(PE.trans (subst-Idsym _ (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (wk1 (wk1 (fst e))))
(PE.cong₃ (λ X Y Z → Idsym (Univ rA ⁰) X Y Z) (wk1-singleSubst (wk1 A) (var 0)) (wk1-singleSubst (wk1 A') (var 0)) (wk1-singleSubst (wk1 (fst e)) (var 0)))))
cast-Πᵗᵛ-aux : ∀ {A B A' B' rA Γ e f} ([Γ] : ⊩ᵛ Γ) →
let l = ∞
lΠ = ⁰
[UA] = maybeEmbᵛ {A = Univ rA _} [Γ] (Uᵛ emb< [Γ])
[UΠ] = maybeEmbᵛ {A = Univ ! _} [Γ] (Uᵛ emb< [Γ])
in
([A] : Γ ⊩ᵛ⟨ l ⟩ A ^ [ rA , ι lΠ ] / [Γ])
([A'] : Γ ⊩ᵛ⟨ l ⟩ A' ^ [ rA , ι lΠ ] / [Γ])
([UB] : Γ ∙ A ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A])
([UB'] : Γ ∙ A' ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A'])
([A]ₜ : Γ ⊩ᵛ⟨ l ⟩ A ∷ Univ rA lΠ ^ [ ! , next lΠ ] / [Γ] / [UA])
([B]ₜ : Γ ∙ A ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ B ∷ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A] / (λ {Δ} {σ} → [UB] {Δ} {σ}))
([A']ₜ : Γ ⊩ᵛ⟨ l ⟩ A' ∷ Univ rA lΠ ^ [ ! , next lΠ ] / [Γ] / [UA])
([B']ₜ : Γ ∙ A' ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ B' ∷ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A'] / (λ {Δ} {σ} → [UB'] {Δ} {σ}))
([Id] : Γ ⊩ᵛ⟨ l ⟩ Id (U lΠ) (Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ) (Π A' ^ rA ° lΠ ▹ B' ° lΠ ° lΠ) ^ [ % , next lΠ ] / [Γ])
([e]ₜ : Γ ⊩ᵛ⟨ l ⟩ e ∷ Id (U lΠ) (Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ) (Π A' ^ rA ° lΠ ▹ B' ° lΠ ° lΠ) ^ [ % , next lΠ ] / [Γ] / [Id])
([ΠAB] : Γ ⊩ᵛ⟨ l ⟩ Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ ^ [ ! , ι lΠ ] / [Γ])
([f]ₜ : Γ ⊩ᵛ⟨ l ⟩ f ∷ Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ ^ [ ! , ι lΠ ] / [Γ] / [ΠAB]) →
([Id-U-ΠΠ] : [ Γ ⊩ᵛ⟨ l ⟩ (Id (U ⁰) (Π A ^ rA ° ⁰ ▹ B ° ⁰ ° lΠ) (Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° lΠ))
≡ ∃ (Id (Univ rA ⁰) A A') ▹
(Π (wk1 A') ^ rA ° ⁰ ▹ Id (U ⁰)
((U.wk (lift (step id)) B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑)
(U.wk (lift (step id)) B') ° ¹ ° ¹)
∷ SProp ¹ ^ [ ! , next ¹ ] / [Γ] ] )
→
let [IdAA'] = Idᵛ {A = Univ rA ⁰} {t = A} {u = A'} [Γ] (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']ₜ
[ΓId] = _∙_ {A = Id (Univ rA ⁰) A A'} [Γ] [IdAA']
[wA'] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A'} {lG = ⁰} [Γ] [IdAA'] [A']ₜ
[wA']' = wk1ᵛ {A = A'} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A']
[wA]' = wk1ᵛ {A = A} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A]
[wA] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A} {lG = ⁰} [Γ] [IdAA'] [A]ₜ
[ΓIdA'] = _∙_ {A = wk1 A'} [ΓId] [wA']'
[wwA']' = wk1ᵛ {A = wk1 A'} {F = wk1 A'} [ΓId] [wA']' [wA']'
[wwA'] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A'} {lG = ⁰} [ΓId] [wA']' [wA']
[wwA] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A} {lG = ⁰} [ΓId] [wA']' [wA]
[wwUA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓIdA'] (λ {Δ} {σ} → Uᵛ emb< [ΓIdA'] {Δ} {σ}) {Δ} {σ}
[wwIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A)} {u = wk1 (wk1 A')} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA] [wwA']
[ΓA'] = (_∙_ {Γ} {A'} [Γ] [A'])
[w'A] = wk1ᵗᵛ {F = A'} {G = A} {lG = ⁰} [Γ] [A'] [A]ₜ
[w'A'] = wk1ᵗᵛ {F = A'} {G = A'} {lG = ⁰} [Γ] [A'] [A']ₜ
[w'A']' = wk1ᵛ {A = A'} {F = A'} [Γ] [A'] [A']
[wUA] = maybeEmbᵛ {A = Univ rA _} [ΓA'] (λ {Δ} {σ} → Uᵛ emb< [ΓA'] {Δ} {σ})
[wIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 A} {u = wk1 A'} [ΓA'] (λ {Δ} {σ} → [wUA] {Δ} {σ}) [w'A] [w'A']
[ww'A']' = wk1ᵛ {A = wk1 A'} {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} [ΓA'] [wIdAA'] [w'A']'
[ww'A'] = wk1ᵗᵛ {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = wk1 A'} {lG = ⁰} [ΓA'] [wIdAA'] [w'A']
[ΓA'Id] = _∙_ {A = Id (Univ rA ⁰) (wk1 A) (wk1 A')} [ΓA'] [wIdAA']
[ΓA'IdA'] = _∙_ {A = wk1 (wk1 A')} [ΓA'Id] [ww'A']'
[wwwUA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓA'IdA'] (λ {Δ} {σ} → Uᵛ emb< [ΓA'IdA'] {Δ} {σ}) {Δ} {σ}
[www'A'] = wk1ᵗᵛ {F = wk1 (wk1 A')} {G = wk1 (wk1 A')} {lG = ⁰} [ΓA'Id] [ww'A']' [ww'A']
[ww'A] = wk1ᵗᵛ {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = wk1 A} {lG = ⁰} [ΓA'] [wIdAA'] [w'A]
[www'A] = wk1ᵗᵛ {F = wk1 (wk1 A')} {G = wk1 (wk1 A)} {lG = ⁰} [ΓA'Id] [ww'A']' [ww'A]
[wwwIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 (wk1 A))} {u = wk1 (wk1 (wk1 A'))} [ΓA'IdA'] (λ {Δ} {σ} → [wwwUA'] {Δ} {σ} rA) [www'A] [www'A']
[wwwU¹] = λ {Δ} {σ} r → Uᵛ {rU = r} ∞< [ΓA'Id] {Δ} {σ}
Id-U-ΠΠ-res-end A A' B B' = Π (wk1 A') ^ rA ° ⁰ ▹ Id (U ⁰)
((wk1d B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑)
(wk1d B') ° ¹ ° ¹
in
([Id-U-ΠΠ-res-end] : Γ ∙ A' ^ [ rA , ι ⁰ ] ∙ Id (Univ rA ⁰) (wk1 A) (wk1 A') ^ [ % , ι ¹ ] ⊩ᵛ⟨ ∞ ⟩
Id-U-ΠΠ-res-end (wk1 A) (wk1 A') (wk1d B) (wk1d B') ∷ SProp ¹ ^ [ ! , ∞ ] / [ΓA'Id] / (λ {Δ} {σ} → [wwwU¹] {Δ} {σ} %))
([var]ₜ : Γ ∙ A' ^ [ rA , ι ⁰ ] ⊩ᵛ⟨ ∞ ⟩ var 0 ∷ wk1 A' ^ [ rA , ι ⁰ ] / [ΓA'] / wk1ᵛ {A = A'} {F = A'} [Γ] [A'] [A'])
([var0']ₜ : Γ ∙ A' ^ [ rA , ι ⁰ ] ∙ Id (Univ rA ⁰) (wk1 A) (wk1 A') ^ [ % , ι ¹ ] ∙ wk1 (wk1 A') ^ [ rA , ι ⁰ ] ⊩ᵛ⟨ ∞ ⟩ var 0 ∷
wk1 (wk1 (wk1 A')) ^ [ rA , ι ⁰ ] / [ΓA'IdA'] / wk1ᵛ {A = wk1 (wk1 A')} {F = wk1 (wk1 A')} [ΓA'Id] [ww'A']' [ww'A']')
([var1']ₜ : Γ ∙ A' ^ [ rA , ι ⁰ ] ∙ Id (Univ rA ⁰) (wk1 A) (wk1 A') ^ [ % , ι ¹ ] ∙ wk1 (wk1 A') ^ [ rA , ι ⁰ ] ⊩ᵛ⟨ ∞ ⟩ var 1 ∷
Id (Univ rA ⁰) (wk1 (wk1 (wk1 A))) (wk1 (wk1 (wk1 A'))) ^ [ % , ι ¹ ] / [ΓA'IdA'] / [wwwIdAA'])
→ [ Γ ⊩ᵛ⟨ l ⟩ (cast lΠ (Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ) (Π A' ^ rA ° lΠ ▹ B' ° lΠ ° lΠ) e f) ≡
(lam A' ▹
(let a = cast lΠ (wk1 A') (wk1 A) (Idsym (Univ rA lΠ) (wk1 A) (wk1 A') (fst (wk1 e))) (var 0) in
cast lΠ (B [ a ]↑) B' ((snd (wk1 e)) ∘ (var 0) ^ ¹) ((wk1 f) ∘ a ^ lΠ)) ^ ⁰)
∷ Π A' ^ rA ° lΠ ▹ B' ° lΠ ° lΠ ^ [ ! , ι lΠ ] / [Γ] ]
cast-Πᵗᵛ-aux {A} {B} {A'} {B'} {rA} {Γ} {e} {f}
[Γ] [A] [A'] [UB] [UB'] [A]ₜ [B]ₜ [A']ₜ [B']ₜ [Id] [e]ₜ [ΠAB] [f]ₜ [Id-U-ΠΠ] [Id-U-ΠΠ-res-end] [var]ₜ [var0']ₜ [var1']ₜ =
let l = ∞
lΠ = ⁰
[UA] = maybeEmbᵛ {A = Univ rA _} [Γ] (Uᵛ emb< [Γ])
[UΠ] = maybeEmbᵛ {A = Univ ! _} [Γ] (Uᵛ emb< [Γ])
⊢AΔ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UA] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([A]ₜ ⊢Δ [σ]))
⊢A'Δ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UA] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([A']ₜ ⊢Δ [σ]))
⊢A = λ {Δ} {σ} ⊢Δ [σ] → escape (proj₁ ([A] {Δ} {σ} ⊢Δ [σ]))
⊢A' = λ {Δ} {σ} ⊢Δ [σ] → escape (proj₁ ([A'] {Δ} {σ} ⊢Δ [σ]))
[ΓA] = (_∙_ {Γ} {A} [Γ] [A])
[ΓA'] = (_∙_ {Γ} {A'} [Γ] [A'])
⊢BΔ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UB] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([B]ₜ {Δ} {σ} ⊢Δ [σ]))
[A]' = univᵛ {A = A} [Γ] (≡is≤ PE.refl) (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ
[A']' = univᵛ {A = A'} [Γ] (≡is≤ PE.refl) (λ {Δ} {σ} → [UA] {Δ} {σ}) [A']ₜ
[B]' = univᵛ {A = B} [ΓA] (≡is≤ PE.refl) (λ {Δ} {σ} → [UB] {Δ} {σ}) [B]ₜ
[B] = maybeEmbᵛ {A = B} [ΓA] [B]'
[B']' = univᵛ {A = B'} [ΓA'] (≡is≤ PE.refl) (λ {Δ} {σ} → [UB'] {Δ} {σ}) [B']ₜ
[B'] = maybeEmbᵛ {A = B'} [ΓA'] [B']'
⊢B'Δ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UB'] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([B']ₜ {Δ} {σ} ⊢Δ [σ]))
[liftσ] = λ {Δ} {σ} ⊢Δ [σ] → liftSubstS {F = A} {σ = σ} {Δ = Δ} [Γ] ⊢Δ [A] [σ]
[liftσ'] = λ {Δ} {σ} ⊢Δ [σ] → liftSubstS {F = A'} {σ = σ} {Δ = Δ} [Γ] ⊢Δ [A'] [σ]
⊢e = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([Id] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([e]ₜ {Δ} {σ} ⊢Δ [σ]))
⊢f = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([ΠAB] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([f]ₜ {Δ} {σ} ⊢Δ [σ]))
[ΠAB'] = Πᵛ {A'} {B'} (≡is≤ PE.refl) (≡is≤ PE.refl) [Γ] [A'] [B']
[ΓA'] = _∙_ {A = A'} [Γ] [A']
[wUA] = maybeEmbᵛ {A = Univ rA _} [ΓA'] (λ {Δ} {σ} → Uᵛ emb< [ΓA'] {Δ} {σ})
[wUA]ᵗ = Uᵗᵛ [ΓA']
[IdAA']ₜ = Idᵗᵛ {A = Univ rA ⁰} {t = A} {u = A'} [Γ] (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']ₜ (Uᵗᵛ [Γ])
[IdAA'] = Idᵛ {A = Univ rA ⁰} {t = A} {u = A'} [Γ] (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']ₜ
[ΓId] = _∙_ {A = Id (Univ rA ⁰) A A'} [Γ] [IdAA']
[wA'] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A'} {lG = ⁰} [Γ] [IdAA'] [A']ₜ
[wA']' = wk1ᵛ {A = A'} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A']
[wA]' = wk1ᵛ {A = A} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A]
[wA] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A} {lG = ⁰} [Γ] [IdAA'] [A]ₜ
[ΓIdA'] = _∙_ {A = wk1 A'} [ΓId] [wA']'
[wwU¹] = λ {Δ} {σ} r → Uᵛ {rU = r} ∞< [ΓIdA'] {Δ} {σ}
[wwUA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓIdA'] (λ {Δ} {σ} → Uᵛ emb< [ΓIdA'] {Δ} {σ}) {Δ} {σ}
[ΓIdA] = _∙_ {A = wk1 A} [ΓId] [wA]'
[wwA'] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A'} {lG = ⁰} [ΓId] [wA']' [wA']
[wwA] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A} {lG = ⁰} [ΓId] [wA']' [wA]
[wwA']' = wk1ᵛ {A = wk1 A'} {F = wk1 A'} [ΓId] [wA']' [wA']'
[wwA]' = wk1ᵛ {A = wk1 A} {F = wk1 A'} [ΓId] [wA']' [wA]'
[wwU0A] = maybeEmbᵛ {A = Univ ! _ } [ΓIdA] (λ {Δ} {σ} → Uᵛ emb< [ΓIdA] {Δ} {σ})
[wB'] = wk1dᵗᵛ {F = A'} {F' = Id (Univ rA ⁰) A A'} {G = B'} [Γ] [A'] [IdAA'] (λ {Δ} {σ} → [UB'] {Δ} {σ}) (λ {Δ} {σ} → [wwUA'] {Δ} {σ} !) [B']ₜ
[wB] = wk1dᵗᵛ {F = A} {F' = Id (Univ rA ⁰) A A'} {G = B} [Γ] [A] [IdAA'] (λ {Δ} {σ} → [UB] {Δ} {σ}) (λ {Δ} {σ} → [wwU0A] {Δ} {σ}) [B]ₜ
[wwIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A)} {u = wk1 (wk1 A')} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA] [wwA']
[wwIdA'A] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A')} {u = wk1 (wk1 A)} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA'] [wwA]
Id-U-ΠΠ-res-end A A' B B' = Π (wk1 A') ^ rA ° ⁰ ▹ Id (U ⁰)
((wk1d B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑)
(wk1d B') ° ¹ ° ¹
Id-U-ΠΠ-left = Id (U lΠ) (Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ) (Π A' ^ rA ° lΠ ▹ B' ° lΠ ° lΠ)
Id-U-ΠΠ-res A A' B B' = ∃ (Id (Univ rA ⁰) A A') ▹ Id-U-ΠΠ-res-end A A' B B'
[wU¹] = λ {Δ} {σ} r → Uᵛ {rU = r} ∞< [ΓA'] {Δ} {σ}
modelsTermEq [SProp] _ [Id-U-ΠΠ-res] [eq] = [Id-U-ΠΠ]
[Id-U-ΠΠ-res]' = maybeEmbᵛ {A = Id-U-ΠΠ-res A A' B B'} [Γ] (univᵛ {A = Id-U-ΠΠ-res A A' B B'} [Γ] (≡is≤ PE.refl) [SProp] [Id-U-ΠΠ-res])
[conve]ₜ = convᵛ {t = e} {A = Id-U-ΠΠ-left} {B = Id-U-ΠΠ-res A A' B B'}
[Γ] [Id] [Id-U-ΠΠ-res]'
(univEqᵛ {A = Id-U-ΠΠ-left} {B = Id-U-ΠΠ-res A A' B B'} [Γ] [SProp] [Id] [eq]) [e]ₜ
[we] = wk1Termᵛ {F = A'} {G = Id-U-ΠΠ-res A A' B B'} {t = e} [Γ] [A'] [Id-U-ΠΠ-res]' [conve]ₜ
[w'A] = wk1ᵗᵛ {F = A'} {G = A} {lG = ⁰} [Γ] [A'] [A]ₜ
[w'A]' = wk1ᵛ {A = A} {F = A'} [Γ] [A'] [A]
[w'A]⁰ = wk1ᵛ {A = A} {F = A'} [Γ] [A'] [A]'
[w'A'] = wk1ᵗᵛ {F = A'} {G = A'} {lG = ⁰} [Γ] [A'] [A']ₜ
[w'A']' = wk1ᵛ {A = A'} {F = A'} [Γ] [A'] [A']
[w'A']⁰ = wk1ᵛ {A = A'} {F = A'} [Γ] [A'] [A']'
[wIdA'A] = Idᵛ {A = Univ rA ⁰} {t = wk1 A'} {u = wk1 A} [ΓA'] (λ {Δ} {σ} → [wUA] {Δ} {σ}) [w'A'] [w'A]
[wIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 A} {u = wk1 A'} [ΓA'] (λ {Δ} {σ} → [wUA] {Δ} {σ}) [w'A] [w'A']
[wIdAA']ᵗ = Idᵗᵛ {A = Univ rA ⁰} {t = wk1 A} {u = wk1 A'} [ΓA'] (λ {Δ} {σ} → [wUA] {Δ} {σ}) [w'A] [w'A'] (λ {Δ} {σ} → Uᵗᵛ [ΓA'] {Δ} {σ})
[wIdAA']ₜ = Idᵗᵛ {A = Univ rA ⁰} {t = wk1 A} {u = wk1 A'} [ΓA'] (λ {Δ} {σ} → [wUA] {Δ} {σ}) [w'A] [w'A'] (λ {Δ} {σ} → Uᵗᵛ [ΓA'] {Δ} {σ})
[ww'A']' = wk1ᵛ {A = wk1 A'} {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} [ΓA'] [wIdAA'] [w'A']'
[ww'A'] = wk1ᵗᵛ {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = wk1 A'} {lG = ⁰} [ΓA'] [wIdAA'] [w'A']
[ww'A]' = wk1ᵛ {A = wk1 A} {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} [ΓA'] [wIdAA'] [w'A]'
[ww'A] = wk1ᵗᵛ {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = wk1 A} {lG = ⁰} [ΓA'] [wIdAA'] [w'A]
[ΓA'A'] = _∙_ {A = wk1 A'} [ΓA'] [w'A']'
[ww'UA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓA'A'] (λ {Δ} {σ} → Uᵛ emb< [ΓA'A'] {Δ} {σ}) {Δ} {σ}
[ΓA'A] = _∙_ {A = wk1 A} [ΓA'] [w'A]'
[ww'UA] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓA'A] (λ {Δ} {σ} → Uᵛ emb< [ΓA'A] {Δ} {σ}) {Δ} {σ}
[ΓA'Id] = _∙_ {A = Id (Univ rA ⁰) (wk1 A) (wk1 A')} [ΓA'] [wIdAA']
[ΓA'IdA'] = _∙_ {A = wk1 (wk1 A')} [ΓA'Id] [ww'A']'
[www'UA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓA'IdA'] (λ {Δ} {σ} → Uᵛ emb< [ΓA'IdA'] {Δ} {σ}) {Δ} {σ}
[ΓA'IdA] = _∙_ {A = wk1 (wk1 A)} [ΓA'Id] [ww'A]'
[www'UA] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓA'IdA] (λ {Δ} {σ} → Uᵛ emb< [ΓA'IdA] {Δ} {σ}) {Δ} {σ}
[w'B'] = wk1dᵗᵛ {F = A'} {F' = A'} {G = B'} [Γ] [A'] [A'] (λ {Δ} {σ} → [UB'] {Δ} {σ}) ((λ {Δ} {σ} → [ww'UA'] {Δ} {σ} !)) [B']ₜ
[ww'B'] = wk1dᵗᵛ {F = wk1 A'} {F' = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = wk1d B'} [ΓA'] [w'A']' [wIdAA'] (λ {Δ} {σ} → [ww'UA'] {Δ} {σ} !) (λ {Δ} {σ} → [www'UA'] {Δ} {σ} !) [w'B']
[w'B] = wk1dᵗᵛ {F = A} {F' = A'} {G = B} [Γ] [A] [A'] (λ {Δ} {σ} → [UB] {Δ} {σ}) ((λ {Δ} {σ} → [ww'UA] {Δ} {σ} !)) [B]ₜ
[ww'B] = wk1dᵗᵛ {F = wk1 A} {F' = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = wk1d B} [ΓA'] [w'A]' [wIdAA'] (λ {Δ} {σ} → [ww'UA] {Δ} {σ} !) (λ {Δ} {σ} → [www'UA] {Δ} {σ} !) [w'B]
[www'A']' = wk1ᵛ {A = wk1 (wk1 A')} {F = wk1 (wk1 A') } [ΓA'Id] [ww'A']' [ww'A']'
[www'A'] = wk1ᵗᵛ {F = wk1 (wk1 A')} {G = wk1 (wk1 A')} {lG = ⁰} [ΓA'Id] [ww'A']' [ww'A']
[www'A]' = wk1ᵛ {A = wk1 (wk1 A)} {F = wk1 (wk1 A')} [ΓA'Id] [ww'A']' [ww'A]'
[www'A] = wk1ᵗᵛ {F = wk1 (wk1 A')} {G = wk1 (wk1 A)} {lG = ⁰} [ΓA'Id] [ww'A']' [ww'A]
[wwU¹] = λ {Δ} {σ} r → Uᵛ {rU = r} ∞< [ΓA'A'] {Δ} {σ}
[wwwU¹] = λ {Δ} {σ} r → Uᵛ {rU = r} ∞< [ΓA'Id] {Δ} {σ}
Id-U-ΠΠ-res-end-wk1d = Id-U-ΠΠ-res-end (wk1 A) (wk1 A') (wk1d B) (wk1d B')
Id-U-ΠΠ-res-wk1d = Id-U-ΠΠ-res (wk1 A) (wk1 A') (wk1d B) (wk1d B')
[Id-U-ΠΠ-res-end]' = maybeEmbᵛ {A = Id-U-ΠΠ-res-end-wk1d} [ΓA'Id]
(univᵛ {A = Id-U-ΠΠ-res-end-wk1d} [ΓA'Id] (≡is≤ PE.refl)
(λ {Δ} {σ} → [wwwU¹] {Δ} {σ} %) [Id-U-ΠΠ-res-end])
[we]' = S.irrelevanceTerm′ {A = wk1 (Id-U-ΠΠ-res A A' B B')} {A′ = Id-U-ΠΠ-res-wk1d} {t = wk1 e}
(wk1∃ A A' rA B B')
PE.refl [ΓA'] [ΓA'] (wk1ᵛ {A = Id-U-ΠΠ-res A A' B B'} {F = A'} [Γ] [A'] [Id-U-ΠΠ-res]')
(∃ᵛ {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = Id-U-ΠΠ-res-end-wk1d} [ΓA'] [wIdAA']
[Id-U-ΠΠ-res-end]') [we]
[fst] = fstᵛ {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = Id-U-ΠΠ-res-end-wk1d} {tu = wk1 e}
[ΓA'] [wIdAA'] [Id-U-ΠΠ-res-end]'
(λ {Δ} {σ} → [wwwU¹] {Δ} {σ} %) [wIdAA']ᵗ [Id-U-ΠΠ-res-end]
[we]'
[wfste] : Γ ∙ A' ^ [ rA , ι ⁰ ] ⊩ᵛ⟨ ∞ ⟩ Idsym (Univ rA ⁰) (wk1 A) (wk1 A') (fst (wk1 e)) ∷ Id (Univ rA ⁰) (wk1 A') (wk1 A) ^ [ % , ι ¹ ] / [ΓA'] / [wIdA'A]
[wfste] = IdSymᵗᵛ {A = Univ rA ⁰} {t = wk1 A} {u = wk1 A'} {e = fst (wk1 e)} [ΓA'] (λ {Δ} {σ} → [wU¹] {Δ} {σ} !)
(λ {Δ} {σ} → [wUA]ᵗ {Δ} {σ}) (λ {Δ} {σ} → [wUA] {Δ} {σ})
[w'A] [w'A'] [wIdAA'] [wIdA'A] [fst]
cast-Π-a A A' e = cast ⁰ (wk1 A') (wk1 A) (Idsym (Univ rA ⁰) (wk1 A) (wk1 A') (fst (wk1 e))) (var 0)
[cast-Π-a] : Γ ∙ A' ^ [ rA , ι ⁰ ] ⊩ᵛ⟨ ∞ ⟩ cast-Π-a A A' e ∷ wk1 A ^ [ rA , ι ⁰ ] / [ΓA'] / wk1ᵛ {A = A} {F = A'} [Γ] [A'] [A]
[cast-Π-a] = castᵗᵛ {wk1 A'} {wk1 A} {t = var 0} {e = Idsym (Univ rA ⁰) (wk1 A) (wk1 A') (fst (wk1 e))} [ΓA']
(λ {Δ} {σ} → [wUA] {Δ} {σ}) [w'A'] [w'A]
(wk1ᵛ {A = A'} {F = A'} [Γ] [A'] [A']) (wk1ᵛ {A = A} {F = A'} [Γ] [A'] [A])
[var]ₜ [wIdA'A] [wfste]
B[cast-Π-a]↑ₜ = subst↑STerm {F = A'} {F' = A} {G = B} {t = cast-Π-a A A' e} [Γ] [A'] [A]
(λ {Δ} {σ} → [UB'] {Δ} {σ}) (λ {Δ} {σ} → [UB] {Δ} {σ}) [B]ₜ [cast-Π-a]
[f°cast-Π-a] = appᵛ↑ {F = A} {F' = A'} {G = B} {t = wk1 f} {u = cast-Π-a A A' e} (≡is≤ PE.refl) (≡is≤ PE.refl) [Γ] [A] [A'] [B] [ΠAB]
(wk1Termᵛ {F = A'} {G = Π A ^ rA ° ⁰ ▹ B ° ⁰ ° lΠ} {t = f} [Γ] [A'] [ΠAB] [f]ₜ)
[cast-Π-a]
[wIdBB'] : Γ ∙ A' ^ [ rA , ι ⁰ ] ⊩ᵛ⟨ ∞ ⟩ Id (Univ ! ⁰) (B [ cast-Π-a A A' e ]↑) B' ^ [ % , ι ¹ ] / [ΓA']
[wIdBB'] = Idᵛ {A = Univ ! ⁰} {t = B [ cast-Π-a A A' e ]↑} {u = B'} [ΓA'] (λ {Δ} {σ} → [UB'] {Δ} {σ})
B[cast-Π-a]↑ₜ [B']ₜ
[snd] = sndᵛ {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = Id-U-ΠΠ-res-end-wk1d} {tu = wk1 e}
[ΓA'] [wIdAA'] [Id-U-ΠΠ-res-end]'
(λ {Δ} {σ} → [wwwU¹] {Δ} {σ} %) [wIdAA']ᵗ [Id-U-ΠΠ-res-end]
[we]'
[sndType]' = S.irrelevance′ {A = Id-U-ΠΠ-res-end-wk1d [ fst (wk1 e) ]}
{A′ = Π (wk1 A') ^ rA ° ⁰ ▹
Id (U ⁰) ((wk1d B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (fst (wk1 (wk1 e)))) (var 0) ]↑)
(wk1d B') ° ¹ ° ¹}
(snd-cast-subst A A' rA B B' e) [ΓA'] [ΓA']
(substS {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = Id-U-ΠΠ-res-end-wk1d} {fst (wk1 e)} [ΓA']
[wIdAA'] [Id-U-ΠΠ-res-end]' [fst])
[snd]' = S.irrelevanceTerm′ {A = Id-U-ΠΠ-res-end-wk1d [ fst (wk1 e) ]}
{A′ = Π (wk1 A') ^ rA ° ⁰ ▹
Id (U ⁰) ((wk1d B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (fst (wk1 (wk1 e)))) (var 0) ]↑)
(wk1d B') ° ¹ ° ¹}
{t = snd (wk1 e)}
(snd-cast-subst A A' rA B B' e) PE.refl [ΓA'] [ΓA']
(substS {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = Id-U-ΠΠ-res-end-wk1d} {fst (wk1 e)} [ΓA']
[wIdAA'] [Id-U-ΠΠ-res-end]' [fst])
[sndType]' [snd]
[wsnde] : Γ ∙ A' ^ [ rA , ι ⁰ ] ⊩ᵛ⟨ ∞ ⟩ (snd (wk1 e)) ∘ (var 0) ^ ¹ ∷ Id (Univ ! ⁰) (B [ cast-Π-a A A' e ]↑) B' ^ [ % , ι ¹ ] / [ΓA'] / [wIdBB']
[wsnde] = let X = appᵛ {F = wk1 A'}
{G = Id (U ⁰)
((wk1d B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (fst (wk1 (wk1 e)))) (var 0) ]↑)
(wk1d B')}
{t = snd (wk1 e)} {u = var 0} [ΓA'] [w'A']'
[sndType]' [snd]' [var]ₜ
in S.irrelevanceTerm′ {A = (Id (U ⁰) ((wk1d B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (fst (wk1 (wk1 e)))) (var 0) ]↑)
(wk1d B')) [ var 0 ]}
{A′ = Id (Univ ! ⁰) (B [ cast-Π-a A A' e ]↑) B'}
{t = (snd (wk1 e)) ∘ (var 0) ^ ¹}
(Id-cast-subst A A' rA B B' e) PE.refl [ΓA'] [ΓA']
(substSΠ {wk1 A'}
{Id (U ⁰) (wk1d B [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (fst (wk1 (wk1 e)))) (var 0) ]↑)
(wk1d B')}
{var 0} [ΓA'] [w'A']'
[sndType]' [var]ₜ )
[wIdBB'] X
cast-Π-res A A' B B' e f =
cast ⁰ (B [ cast-Π-a A A' e ]↑) B' ((snd (wk1 e)) ∘ (var 0) ^ ¹) ((wk1 f) ∘ cast-Π-a A A' e ^ ⁰)
[cast-Π-res] : Γ ⊩ᵛ⟨ ∞ ⟩ lam A' ▹ cast-Π-res A A' B B' e f ^ ⁰ ∷ Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰ ^ [ ! , ι ⁰ ] / [Γ] / [ΠAB']
[cast-Π-res] = lamᵛ {F = A'} {G = B'} {t = cast-Π-res A A' B B' e f} (≡is≤ PE.refl) (≡is≤ PE.refl) [Γ] [A'] [B']
(castᵗᵛ {B [ cast-Π-a A A' e ]↑} {B'} {t = (wk1 f) ∘ cast-Π-a A A' e ^ ⁰} {e = (snd (wk1 e)) ∘ (var 0) ^ ¹}
[ΓA'] (λ {Δ} {σ} → [UB'] {Δ} {σ}) B[cast-Π-a]↑ₜ [B']ₜ (subst↑S {F = A'} {G = B} {F' = A} [Γ] [A'] [A] [B] [cast-Π-a]) [B']
[f°cast-Π-a] [wIdBB'] [wsnde])
[cast-Π] : Γ ⊩ᵛ cast ⁰ (Π A ^ rA ° ⁰ ▹ B ° ⁰ ° ⁰) (Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰) e f ⇒ lam A' ▹ cast-Π-res A A' B B' e f ^ ⁰ ∷ Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰ ^ ι ⁰ / [Γ]
[cast-Π] = λ {Δ} {σ} ⊢Δ [σ] → let Aσ = ⊢AΔ {Δ} {σ} ⊢Δ [σ]
Bσ = ⊢BΔ {Δ ∙ subst σ A ^ _} {liftSubst σ} (⊢Δ ∙ ⊢A {Δ} {σ} ⊢Δ [σ]) ([liftσ] {Δ} {σ} ⊢Δ [σ])
A'σ = ⊢A'Δ {Δ} {σ} ⊢Δ [σ]
B'σ = ⊢B'Δ {Δ ∙ subst σ A' ^ _} {liftSubst σ} (⊢Δ ∙ ⊢A' {Δ} {σ} ⊢Δ [σ]) ([liftσ'] {Δ} {σ} ⊢Δ [σ])
eσ = ⊢e {Δ} {σ} ⊢Δ [σ]
fσ = ⊢f {Δ} {σ} ⊢Δ [σ]
X : Δ ⊢ (cast ⁰ (Π (subst σ A) ^ rA ° ⁰ ▹ (subst (liftSubst σ) B) ° ⁰ ° ⁰) (Π (subst σ A') ^ rA ° ⁰ ▹ (subst (liftSubst σ) B') ° ⁰ ° ⁰) (subst σ e) (subst σ f))
⇒ lam (subst σ A') ▹ cast-Π-res (subst σ A) (subst σ A') (subst (liftSubst σ) B) (subst (liftSubst σ) B') (subst σ e) (subst σ f) ^ ⁰
∷ Π (subst σ A') ^ rA ° ⁰ ▹ (subst (liftSubst σ) B') ° ⁰ ° ⁰ ^ ι ⁰
X = cast-Π {Δ} {subst σ A} {subst σ A'} {rA} {subst (liftSubst σ) B} {subst (liftSubst σ) B'} {subst σ e} {subst σ f} Aσ Bσ A'σ B'σ eσ fσ
in PE.subst (λ BB → Δ ⊢ subst σ (cast ⁰ (Π A ^ rA ° ⁰ ▹ B ° ⁰ ° ⁰) (Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰) e f) ⇒ lam subst σ A' ▹ BB ^ ⁰ ∷ subst σ (Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰) ^ ι ⁰ )
(PE.cong₄ (cast ⁰)
(B-cast-subst σ A' A rA e B)
PE.refl (PE.cong₂ (λ X Y → snd X ∘ Y ^ ¹) (PE.sym (Idsym-subst-lemma σ e)) PE.refl) (wk1f-cast-subst σ f A' A rA e)) X
[id] , [eq] = redSubstTermᵛ {Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰} {cast ⁰ (Π A ^ rA ° ⁰ ▹ B ° ⁰ ° ⁰) (Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰) e f} {lam A' ▹ cast-Π-res A A' B B' e f ^ ⁰}
[Γ] (λ {Δ} {σ} ⊢Δ [σ] → [cast-Π] {Δ} {σ} ⊢Δ [σ])
[ΠAB'] [cast-Π-res]
in modelsTermEq [ΠAB'] [id] [cast-Π-res] [eq]
cast-Πᵗᵛ : ∀ {A B A' B' rA Γ e f} ([Γ] : ⊩ᵛ Γ) →
let l = ∞
lΠ = ⁰
[UA] = maybeEmbᵛ {A = Univ rA _} [Γ] (Uᵛ emb< [Γ])
[UΠ] = maybeEmbᵛ {A = Univ ! _} [Γ] (Uᵛ emb< [Γ])
in
([A] : Γ ⊩ᵛ⟨ l ⟩ A ^ [ rA , ι lΠ ] / [Γ])
([A'] : Γ ⊩ᵛ⟨ l ⟩ A' ^ [ rA , ι lΠ ] / [Γ])
([UB] : Γ ∙ A ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A])
([UB'] : Γ ∙ A' ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A'])
([A]ₜ : Γ ⊩ᵛ⟨ l ⟩ A ∷ Univ rA lΠ ^ [ ! , next lΠ ] / [Γ] / [UA])
([B]ₜ : Γ ∙ A ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ B ∷ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A] / (λ {Δ} {σ} → [UB] {Δ} {σ}))
([A']ₜ : Γ ⊩ᵛ⟨ l ⟩ A' ∷ Univ rA lΠ ^ [ ! , next lΠ ] / [Γ] / [UA])
([B']ₜ : Γ ∙ A' ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ B' ∷ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A'] / (λ {Δ} {σ} → [UB'] {Δ} {σ}))
([Id] : Γ ⊩ᵛ⟨ l ⟩ Id (U lΠ) (Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ) (Π A' ^ rA ° lΠ ▹ B' ° lΠ ° lΠ) ^ [ % , next lΠ ] / [Γ])
([e]ₜ : Γ ⊩ᵛ⟨ l ⟩ e ∷ Id (U lΠ) (Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ) (Π A' ^ rA ° lΠ ▹ B' ° lΠ ° lΠ) ^ [ % , next lΠ ] / [Γ] / [Id])
([ΠAB] : Γ ⊩ᵛ⟨ l ⟩ Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ ^ [ ! , ι lΠ ] / [Γ])
([f]ₜ : Γ ⊩ᵛ⟨ l ⟩ f ∷ Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ ^ [ ! , ι lΠ ] / [Γ] / [ΠAB]) →
[ Γ ⊩ᵛ⟨ l ⟩ (cast lΠ (Π A ^ rA ° lΠ ▹ B ° lΠ ° lΠ) (Π A' ^ rA ° lΠ ▹ B' ° lΠ ° lΠ) e f) ≡
(lam A' ▹
(let a = cast lΠ (wk1 A') (wk1 A) (Idsym (Univ rA lΠ) (wk1 A) (wk1 A') (fst (wk1 e))) (var 0) in
cast lΠ (B [ a ]↑) B' ((snd (wk1 e)) ∘ (var 0) ^ ¹) ((wk1 f) ∘ a ^ ⁰)) ^ ⁰)
∷ Π A' ^ rA ° lΠ ▹ B' ° lΠ ° lΠ ^ [ ! , ι lΠ ] / [Γ] ]
abstract
cast-Πᵗᵛ {A} {B} {A'} {B'} {rA} {Γ} {e} {f}
[Γ] [A] [A'] [UB] [UB'] [A]ₜ [B]ₜ [A']ₜ [B']ₜ [Id] [e]ₜ [ΠAB] [f]ₜ =
let l = ∞
lΠ = ⁰
[UA] = maybeEmbᵛ {A = Univ rA _} [Γ] (Uᵛ emb< [Γ])
[IdAA'] = Idᵛ {A = Univ rA ⁰} {t = A} {u = A'} [Γ] (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']ₜ
[ΓId] = _∙_ {A = Id (Univ rA ⁰) A A'} [Γ] [IdAA']
[wA'] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A'} {lG = ⁰} [Γ] [IdAA'] [A']ₜ
[wA']' = wk1ᵛ {A = A'} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A']
[wA]' = wk1ᵛ {A = A} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A]
[wA] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A} {lG = ⁰} [Γ] [IdAA'] [A]ₜ
[ΓIdA'] = _∙_ {A = wk1 A'} [ΓId] [wA']'
[wwA']' = wk1ᵛ {A = wk1 A'} {F = wk1 A'} [ΓId] [wA']' [wA']'
[wwA'] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A'} {lG = ⁰} [ΓId] [wA']' [wA']
[wwA] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A} {lG = ⁰} [ΓId] [wA']' [wA]
[wwUA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓIdA'] (λ {Δ} {σ} → Uᵛ emb< [ΓIdA'] {Δ} {σ}) {Δ} {σ}
[wwIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A)} {u = wk1 (wk1 A')} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA] [wwA']
[ΓA'] = (_∙_ {Γ} {A'} [Γ] [A'])
[w'A] = wk1ᵗᵛ {F = A'} {G = A} {lG = ⁰} [Γ] [A'] [A]ₜ
[w'A'] = wk1ᵗᵛ {F = A'} {G = A'} {lG = ⁰} [Γ] [A'] [A']ₜ
[w'A']' = wk1ᵛ {A = A'} {F = A'} [Γ] [A'] [A']
[wUA] = maybeEmbᵛ {A = Univ rA _} [ΓA'] (λ {Δ} {σ} → Uᵛ emb< [ΓA'] {Δ} {σ})
[wIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 A} {u = wk1 A'} [ΓA'] (λ {Δ} {σ} → [wUA] {Δ} {σ}) [w'A] [w'A']
[ww'A']' = wk1ᵛ {A = wk1 A'} {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} [ΓA'] [wIdAA'] [w'A']'
[ww'A'] = wk1ᵗᵛ {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = wk1 A'} {lG = ⁰} [ΓA'] [wIdAA'] [w'A']
[ΓA'Id] = _∙_ {A = Id (Univ rA ⁰) (wk1 A) (wk1 A')} [ΓA'] [wIdAA']
[ΓA'IdA'] = _∙_ {A = wk1 (wk1 A')} [ΓA'Id] [ww'A']'
[wwwUA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓA'IdA'] (λ {Δ} {σ} → Uᵛ emb< [ΓA'IdA'] {Δ} {σ}) {Δ} {σ}
[www'A'] = wk1ᵗᵛ {F = wk1 (wk1 A')} {G = wk1 (wk1 A')} {lG = ⁰} [ΓA'Id] [ww'A']' [ww'A']
[ww'A] = wk1ᵗᵛ {F = Id (Univ rA ⁰) (wk1 A) (wk1 A')} {G = wk1 A} {lG = ⁰} [ΓA'] [wIdAA'] [w'A]
[www'A] = wk1ᵗᵛ {F = wk1 (wk1 A')} {G = wk1 (wk1 A)} {lG = ⁰} [ΓA'Id] [ww'A']' [ww'A]
[wwwIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 (wk1 A))} {u = wk1 (wk1 (wk1 A'))} [ΓA'IdA'] (λ {Δ} {σ} → [wwwUA'] {Δ} {σ} rA) [www'A] [www'A']
[wA]ₜ = wk1ᵗᵛ {F = A'} {G = A} {lG = ⁰} [Γ] [A'] [A]ₜ
[wA] = wk1ᵛ {A = A} {F = A'} [Γ] [A'] [A]
[wA']ₜ = wk1ᵗᵛ {F = A'} {G = A'} {lG = ⁰} [Γ] [A'] [A']ₜ
[wA'] = wk1ᵛ {A = A'} {F = A'} [Γ] [A'] [A']
[wA']' = wk1ᵛ {A = A'} {F = A'} [Γ] [A'] [A']
[wA]' = wk1ᵛ {A = A} {F = A'} [Γ] [A'] [A]
[ΓA'A'] = _∙_ {A = wk1 A'} [ΓA'] [wA']'
[ΓA'A] = _∙_ {A = wk1 A} [ΓA'] [wA]'
[wwUA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓA'A'] (λ {Δ} {σ} → Uᵛ emb< [ΓA'A'] {Δ} {σ}) {Δ} {σ}
[wwUA] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓA'A] (λ {Δ} {σ} → Uᵛ emb< [ΓA'A] {Δ} {σ}) {Δ} {σ}
[wB']ₜ = wk1dᵗᵛ {F = A'} {F' = A'} {G = B'} [Γ] [A'] [A'] (λ {Δ} {σ} → [UB'] {Δ} {σ}) ((λ {Δ} {σ} → [wwUA'] {Δ} {σ} !)) [B']ₜ
[wB]ₜ = wk1dᵗᵛ {F = A} {F' = A'} {G = B} [Γ] [A] [A'] (λ {Δ} {σ} → [UB] {Δ} {σ}) ((λ {Δ} {σ} → [wwUA] {Δ} {σ} !)) [B]ₜ
[var]ₜ : Γ ∙ A' ^ [ rA , ι ⁰ ] ⊩ᵛ⟨ ∞ ⟩ var 0 ∷ wk1 A' ^ [ rA , ι ⁰ ] / [ΓA'] / wk1ᵛ {A = A'} {F = A'} [Γ] [A'] [A']
[var]ₜ = proj₂ (fundamentalVar here [ΓA'])
[var0']ₜ : Γ ∙ A' ^ [ rA , ι ⁰ ] ∙ Id (Univ rA ⁰) (wk1 A) (wk1 A') ^ [ % , ι ¹ ] ∙ wk1 (wk1 A') ^ [ rA , ι ⁰ ] ⊩ᵛ⟨ ∞ ⟩ var 0 ∷
wk1 (wk1 (wk1 A')) ^ [ rA , ι ⁰ ] / [ΓA'IdA'] / wk1ᵛ {A = wk1 (wk1 A')} {F = wk1 (wk1 A')} [ΓA'Id] [ww'A']' [ww'A']'
[var0']ₜ = proj₂ (fundamentalVar here [ΓA'IdA'])
[var1']ₜ : Γ ∙ A' ^ [ rA , ι ⁰ ] ∙ Id (Univ rA ⁰) (wk1 A) (wk1 A') ^ [ % , ι ¹ ] ∙ wk1 (wk1 A') ^ [ rA , ι ⁰ ] ⊩ᵛ⟨ ∞ ⟩ var 1 ∷
Id (Univ rA ⁰) (wk1 (wk1 (wk1 A))) (wk1 (wk1 (wk1 A'))) ^ [ % , ι ¹ ] / [ΓA'IdA'] / [wwwIdAA']
[var1']ₜ = let X = fundamentalVar (there here) [ΓA'IdA'] in S.irrelevanceTerm {A = Id (Univ rA ⁰) (wk1 (wk1 (wk1 A))) (wk1 (wk1 (wk1 A')))} {t = var 1}
[ΓA'IdA'] [ΓA'IdA'] (proj₁ X) [wwwIdAA'] (proj₂ X)
in cast-Πᵗᵛ-aux {A} {B} {A'} {B'} {rA} {Γ} {e} {f}
[Γ] [A] [A'] (λ {Δ} {σ} → [UB] {Δ} {σ}) (λ {Δ} {σ} → [UB'] {Δ} {σ}) [A]ₜ [B]ₜ [A']ₜ [B']ₜ [Id] [e]ₜ [ΠAB] [f]ₜ
(Id-U-ΠΠᵗᵛ {A} {B} {A'} {B'} {rA} {Γ}
[Γ] [A] [A'] (λ {Δ} {σ} → [UB] {Δ} {σ}) (λ {Δ} {σ} → [UB'] {Δ} {σ}) [A]ₜ [B]ₜ [A']ₜ [B']ₜ)
(Id-U-ΠΠ-resᵗᵛ {wk1 A} {wk1d B} {wk1 A'} {wk1d B'}
[ΓA'] [wA] [wA'] (λ {Δ} {σ} → [wwUA] {Δ} {σ} !) (λ {Δ} {σ} → [wwUA'] {Δ} {σ} !) [wA]ₜ [wB]ₜ [wA']ₜ [wB']ₜ [var0']ₜ [var1']ₜ)
[var]ₜ [var0']ₜ [var1']ₜ
| 80.472946
| 210
| 0.389332
|
22090dda6a638bdc41ed8974103efa90a4dfc240
| 100
|
agda
|
Agda
|
test/Fail/Issue308b.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/Issue308b.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/Issue308b.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
module Issue308b where
data D : Set where
d : D → D
syntax d x = e x x
g : D → D
g (d x) = e x
| 10
| 22
| 0.55
|
7c4e8877154ebb92385ed5de241f88bd103400bf
| 429
|
agda
|
Agda
|
test/Sections.agda
|
JonathanBrouwer/agda2hs
|
dcf63cc7ce51a325a97ac58bdd0aeace24c08b15
|
[
"MIT"
] | 55
|
2020-10-20T13:36:25.000Z
|
2022-03-26T21:57:56.000Z
|
test/Sections.agda
|
SNU-2D/agda2hs
|
160478a51bc78b0fdab07b968464420439f9fed6
|
[
"MIT"
] | 63
|
2020-10-22T05:19:27.000Z
|
2022-02-25T15:47:30.000Z
|
test/Sections.agda
|
SNU-2D/agda2hs
|
160478a51bc78b0fdab07b968464420439f9fed6
|
[
"MIT"
] | 18
|
2020-10-21T22:19:09.000Z
|
2022-03-12T11:42:52.000Z
|
module Sections where
open import Haskell.Prelude
test₁ : Nat → Nat
test₁ = 5 +_
test₂ : Nat → Nat
test₂ = _+ 5
test₃ : Nat → Nat
test₃ = _+_ 5
test₄ : Nat → Nat
test₄ = λ x → x + 5
test₅ : Nat → Nat
test₅ = λ x → 5 + x -- Agda eta-contracts this before we get to see it
{-# COMPILE AGDA2HS test₁ #-}
{-# COMPILE AGDA2HS test₂ #-}
{-# COMPILE AGDA2HS test₃ #-}
{-# COMPILE AGDA2HS test₄ #-}
{-# COMPILE AGDA2HS test₅ #-}
| 16.5
| 70
| 0.631702
|
5e9425f867b22f8a412d81ab88fb8bde7a3906af
| 4,811
|
agda
|
Agda
|
Categories/Enriched/NaturalTransformation/NaturalIsomorphism.agda
|
rei1024/agda-categories
|
89d163f72caa7deeac9413f27bc1b4ed7f9e025b
|
[
"MIT"
] | null | null | null |
Categories/Enriched/NaturalTransformation/NaturalIsomorphism.agda
|
rei1024/agda-categories
|
89d163f72caa7deeac9413f27bc1b4ed7f9e025b
|
[
"MIT"
] | null | null | null |
Categories/Enriched/NaturalTransformation/NaturalIsomorphism.agda
|
rei1024/agda-categories
|
89d163f72caa7deeac9413f27bc1b4ed7f9e025b
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K --safe #-}
open import Categories.Category using () renaming (Category to Setoid-Category)
open import Categories.Category.Monoidal
module Categories.Enriched.NaturalTransformation.NaturalIsomorphism
{o ℓ e} {V : Setoid-Category o ℓ e} (M : Monoidal V) where
open import Level
open import Categories.Category.Construction.EnrichedFunctors M
open import Categories.Enriched.Category M
open import Categories.Enriched.Functor M renaming (id to idF)
open import Categories.Enriched.NaturalTransformation M renaming (id to idNT)
open import Categories.Functor.Properties using ([_]-resp-Iso)
open import Categories.Morphism as Morphism using (Iso)
open import Categories.Category.Monoidal.Reasoning M
open import Relation.Binary using (IsEquivalence)
open Setoid-Category V renaming (Obj to ObjV; id to idV)
module M = Monoidal M
open M hiding (unitorˡ; unitorʳ; associator)
open NaturalTransformation
module NaturalIsomorphism = Morphism._≅_
open NaturalIsomorphism
-- A natural isomorphism |α : F ≅ G : C → D| is an isomorphism of F
-- and G in the functor category [C , D] between C and D.
module _ {c d} {C : Category c} {D : Category d} where
NaturalIsomorphism : (F G : Functor C D) → Set (ℓ ⊔ e ⊔ c)
NaturalIsomorphism F G = F ≅ G
where open Morphism (EnrichedFunctors C D) using (_≅_)
-- A commonly used shorthand for NaturalIsomorphism
infix 4 _≃_
_≃_ = NaturalIsomorphism
module _ {F G : Functor C D} where
private
module F = Functor F
module G = Functor G
open Morphism (Underlying D) using (_≅_)
-- Natural isomorphisms are pointwise isomorphisms: each component
-- |α [ X ]| is an isomorphism |F X ≅ G X|.
infixl 16 _ᵢ[_]
_ᵢ[_] : NaturalIsomorphism F G → ∀ X → F.₀ X ≅ G.₀ X
α ᵢ[ X ] = record
{ from = from α [ X ]
; to = to α [ X ]
; iso = record { isoˡ = isoˡ α ; isoʳ = isoʳ α }
}
≃-isEquivalence : IsEquivalence _≃_
≃-isEquivalence = Morphism.≅-isEquivalence (EnrichedFunctors C D)
module ≃ = IsEquivalence ≃-isEquivalence
id : {F : Functor C D} → F ≃ F
id = ≃.refl
_⁻¹ : {F G : Functor C D} → F ≃ G → G ≃ F
α ⁻¹ = ≃.sym α
infixr 9 _ⓘᵥ_
_ⓘᵥ_ : {F G H : Functor C D} → G ≃ H → F ≃ G → F ≃ H
α ⓘᵥ β = ≃.trans β α
private
module D = Underlying D
-- Left and right unitors
unitorˡ : {F : Functor C D} → idF ∘F F ≃ F
unitorˡ {F} = record
{ from = record
{ comp = λ _ → D.id
; commute = (refl⟩∘⟨ refl⟩⊗⟨ identityˡ ⟩∘⟨refl) ○ comm
}
; to = record
{ comp = λ _ → D.id
; commute = comm ○ (refl⟩∘⟨ ⟺ identityˡ ⟩⊗⟨refl ⟩∘⟨refl)
}
; iso = record { isoˡ = D.identity² ; isoʳ = D.identity² }
}
where comm = commute (idNT {F = F})
unitorʳ : {F : Functor C D} → F ∘F idF ≃ F
unitorʳ {F} = record
{ from = record
{ comp = λ _ → D.id
; commute = (refl⟩∘⟨ refl⟩⊗⟨ identityʳ ⟩∘⟨refl) ○ comm
}
; to = record
{ comp = λ _ → D.id
; commute = comm ○ (refl⟩∘⟨ ⟺ identityʳ ⟩⊗⟨refl ⟩∘⟨refl)
}
; iso = record { isoˡ = D.identity² ; isoʳ = D.identity² }
}
where comm = commute (idNT {F = F})
module _ {c d e} {C : Category c} {D : Category d} {E : Category e} where
open NaturalIsomorphism
-- Left- and right-hand composition with a functor
infixr 9 _ⓘₕ_ _ⓘˡ_ _ⓘʳ_
_ⓘˡ_ : {F G : Functor C D} (H : Functor D E) → F ≃ G → H ∘F F ≃ H ∘F G
H ⓘˡ α = record
{ from = H ∘ˡ from α
; to = H ∘ˡ to α
; iso = record { isoˡ = iso.isoˡ ; isoʳ = iso.isoʳ }
}
where
module iso {X} = Iso ([ UnderlyingFunctor H ]-resp-Iso (iso (α ᵢ[ X ])))
_ⓘʳ_ : {G H : Functor D E} → G ≃ H → (F : Functor C D) → G ∘F F ≃ H ∘F F
α ⓘʳ F = record
{ from = from α ∘ʳ F
; to = to α ∘ʳ F
; iso = record { isoˡ = isoˡ (α ᵢ[ F.₀ _ ]) ; isoʳ = isoʳ (α ᵢ[ F.₀ _ ]) }
}
where module F = Functor F
-- Horizontal composition
_ⓘₕ_ : {H I : Functor D E} {F G : Functor C D} →
H ≃ I → F ≃ G → (H ∘F F) ≃ (I ∘F G)
_ⓘₕ_ {_} {I} {F} {_} α β = (I ⓘˡ β) ⓘᵥ (α ⓘʳ F)
module _ {b c d e} {B : Category b} {C : Category c}
{D : Category d} {E : Category e} where
open NaturalIsomorphism
private
module E = Category E
module UE = Underlying E
-- Associator
associator : {F : Functor D E} {G : Functor C D} {H : Functor B C} →
(F ∘F G) ∘F H ≃ F ∘F (G ∘F H)
associator {F} {G} {H} = record
{ from = record
{ comp = λ _ → E.id
; commute = (refl⟩∘⟨ refl⟩⊗⟨ assoc ⟩∘⟨refl) ○ comm
}
; to = record
{ comp = λ _ → E.id
; commute = comm ○ (refl⟩∘⟨ ⟺ assoc ⟩⊗⟨refl ⟩∘⟨refl)
}
; iso = record { isoˡ = UE.identity² ; isoʳ = UE.identity² }
}
where comm = commute (idNT {F = F ∘F (G ∘F H)})
| 29.515337
| 79
| 0.578466
|
1116f2f83b517e3f93e6ad0cdd3a427dec0b476d
| 9,969
|
agda
|
Agda
|
setoid-cats/Equality/Eq.agda
|
heades/AUGL
|
b33c6a59d664aed46cac8ef77d34313e148fecc2
|
[
"MIT"
] | null | null | null |
setoid-cats/Equality/Eq.agda
|
heades/AUGL
|
b33c6a59d664aed46cac8ef77d34313e148fecc2
|
[
"MIT"
] | null | null | null |
setoid-cats/Equality/Eq.agda
|
heades/AUGL
|
b33c6a59d664aed46cac8ef77d34313e148fecc2
|
[
"MIT"
] | null | null | null |
---------------------------------------------------------------------
-- This file contains the definition of heterogenous equality and --
-- related facts. A lot of this code is old, and could be written --
-- better. This equality is mainly used for object equivalence. --
-- --
-- Some of it came from the paper: --
-- "Monads Need Not Be Endofunctors" by Altenkirch et al. --
-- --
-- See: http://www.cs.nott.ac.uk/~txa/publ/Relative_Monads.pdf --
---------------------------------------------------------------------
module Equality.Eq where
open import Level
open import Relation.Relation
open import Relation.Binary.PropositionalEquality public renaming (sym to prop-sym ; trans to prop-trans; refl to prop-refl)
data _≅_ {l : Level} {A : Set l} (a : A) : {A' : Set l} → A' → Set l where
refl : a ≅ a
postulate ext : ∀{i j}{A : Set i}{B B' : A → Set j}{f : ∀ a → B a}{g : ∀ a → B' a} →
(∀ a → f a ≅ g a) → f ≅ g
postulate prop-ext : ∀{i j}{A : Set i}{B : A → Set j}{f : ∀ a → B a}{g : ∀ a → B a} →
(∀ a → f a ≡ g a) → f ≡ g
≅-to-≡ : ∀{l : Level}{A : Set l}{a b : A} → a ≅ b → a ≡ b
≅-to-≡ refl = prop-refl
-- this could just be derived from ext
postulate iext : ∀{i j}{A : Set i}{B B' : A → Set j}{f : ∀ {a} → B a}{g : ∀{a} → B' a} →
(∀ a → f {a} ≅ g {a}) →
_≅_ {_}{ {a : A} → B a} f { {a : A} → B' a} g
sym : ∀{l : Level}{A : Set l }{a b : A} → a ≅ b → b ≅ a
sym refl = refl
trans : ∀{l : Level}{A : Set l}{a b c : A} → a ≅ b → b ≅ c → a ≅ c
trans refl refl = refl
isEqRel : ∀{l : Level}{A : Set l} → EqRel {A = A} (λ x y → x ≅ y)
isEqRel {l} {A} = record { parEqPf = record { symPf = sym; transPf = trans }; refPf = refl }
ir : ∀{l : Level}{A A' : Set l}{a : A}{a' : A'}{p q : a ≅ a'} → p ≅ q
ir {p = refl}{q = refl} = refl
eqApp : ∀{l l' : Level}{A : Set l}{B : Set l'}{f : A → B}{b c : A} → b ≅ c → (f b) ≅ (f c)
eqApp refl = refl
subst≅ : {l l' : Level}{A : Set l}{a b : A}{P : A → Set l'} → a ≅ b → P a → P b
subst≅ refl x = x
-- Cite from relative monads paper.
deqApp : ∀{l : Level}{A : Set l}{B : A → Set l}(f : ∀ a → B a){a a' : A}
→ a ≅ a' → f a ≅ f a'
deqApp f refl = refl
feqApp : ∀{l l' : Level}{A : Set l}{B : Set l'}{f f' : A → B}{b c : A} → f ≅ f' → b ≅ c → (f b) ≅ (f' c)
feqApp refl refl = refl
ifeqApp : ∀{i j}{A : Set i}{B : A → Set j}{f f' : {x : A} → B x}(a : A) → _≅_ {_}{ {a : A} → B a} f { {a : A} → B a} f' → f {a} ≅ f' {a}
ifeqApp a refl = refl
ieqApp : ∀{x y}{A : Set x}{B : A → Set y}(f : ∀ {a} → B a){a a' : A} → a ≅ a' → f {a} ≅ f {a'}
ieqApp f refl = refl
-- Cite from relative monads paper.
eqApp2 : ∀{i j k}{A : Set i}{B : A → Set j}{C : Set k}{a a' : A} → a ≅ a' → {b : B a}{b' : B a'} → b ≅ b' →
(f : (a : A) → B a → C) → f a b ≅ f a' b'
eqApp2 refl refl f = refl
eqApp3 : ∀{x y z w}{A : Set x}{B : A → Set y}{C : (a : A) → B a → Set z}{E : Set w}
(f : (a : A)(b : B a)(c : C a b) → E) →
{a a' : A} → a ≅ a' →
{b : B a}{b' : B a'} → b ≅ b' →
{c : C a b}{c' : C a' b'} → c ≅ c' →
f a b c ≅ f a' b' c'
eqApp3 f refl refl refl = refl
depfeqApp3a : ∀{l}{A : Set l}{B : Set (suc l)}{C : A → Set (suc l)}{D : Set (suc l)}
(f : (x : A)(y : B)(z : C x) → D) →
(f' : (x : A)(y : B)(z : C x) → D) →
f ≅ f' →
{a : A}{b : B} {c : C a} →
f a b c ≅ f' a b c
depfeqApp3a {_}{A}{B}{C} f f' p {a}{b}{c} =
feqApp {f = f a b} {f' = f' a b} (feqApp {f = f a} {f' = f' a} (eqApp {f = λ h → h a} p) refl) refl
depfeqApp3b : ∀{l}{A : Set l}{B : A → Set (suc l)}{C : A → Set (suc l)}{D : Set (suc l)}
(f : (x : A)(y : B x)(z : C x) → D) →
(f' : (x : A)(y : B x)(z : C x) → D) →
f ≅ f' →
{a : A}{b : B a} {c : C a} →
f a b c ≅ f' a b c
depfeqApp3b {_}{A}{B}{C} f f' p {a}{b}{c} =
feqApp {f = f a b} {f' = f' a b} (feqApp {f = f a} {f' = f' a} (eqApp {f = λ h → h a} p) refl) refl
depfeqApp3c : ∀{l}{A : Set l}{B : A → A → Set (suc l)}{C : A → Set (suc l)}{D : Set (suc l)}
(f : (x : A)(y : B x x)(z : C x) → D) →
(f' : (x : A)(y : B x x)(z : C x) → D) →
f ≅ f' →
{a : A}{b : B a a} {c : C a} →
f a b c ≅ f' a b c
depfeqApp3c {_}{A}{B}{C} f f' p {a}{b}{c} =
feqApp {f = f a b} {f' = f' a b} (feqApp {f = f a} {f' = f' a} (eqApp {f = λ h → h a} p) refl) refl
depfeqApp3d : ∀{l}{A : Set l}{B : A → A → Set (suc l)}{C : A → A → Set (suc l)}{D : Set (suc l)}
(f : (x : A)(y : B x x)(z : C x x) → D) →
(f' : (x : A)(y : B x x)(z : C x x) → D) →
f ≅ f' →
{a : A}{b : B a a} {c : C a a} →
f a b c ≅ f' a b c
depfeqApp3d {_}{A}{B}{C} f f' p {a}{b}{c} =
feqApp {f = f a b} {f' = f' a b} (feqApp {f = f a} {f' = f' a} (eqApp {f = λ h → h a} p) refl) refl
depfeqApp3e : ∀{l}{A : Set l}{B : Set (suc l)}{C : A → A → Set (suc l)}{D : Set (suc l)}
(f : (x : A)(y : B)(z : C x x) → D) →
(f' : (x : A)(y : B)(z : C x x) → D) →
f ≅ f' →
{a : A}{b : B} {c : C a a} →
f a b c ≅ f' a b c
depfeqApp3e {_}{A}{B}{C} f f' p {a}{b}{c} =
feqApp {f = f a b} {f' = f' a b} (feqApp {f = f a} {f' = f' a} (eqApp {f = λ h → h a} p) refl) refl
depfeqAppa : ∀{l l' l'' l'''}{A : Set l}{B : Set l'}{C : A → B → Set l''}{D : A → B → Set l'''}{a : A}
(f : (x : A)(y : B)(z : C x y) → D x y) →
(f' : (x : A)(y : B)(z : C x y) → D x y) →
f ≅ f' →
f a ≅ f' a
depfeqAppa {l}{l'}{l''}{l'''}{A}{B}{C}{D}{a} f f' p = eqApp {f = λ h → h a} p
depfeqApp2a : ∀{l l' l'' l'''}{A : Set l}{B : Set l'}{C : A → B → Set l''}{D : A → B → Set l'''}{a : A}
(f : (y : B)(z : C a y) → D a y) →
(f' : (y : B)(z : C a y) → D a y) →
f ≅ f' →
{b : B} {c : C a b} →
f b c ≅ f' b c
depfeqApp2a f f' p {b} {c} = feqApp {f = f b} {f' = f' b} (eqApp {f = λ h → h b} p) refl
depfeqApp3f : ∀{l l' l'' l'''}{A : Set l}{B : Set l'}{C : A → B → Set l''}{D : A → B → Set l'''}
(f : (x : A)(y : B)(z : C x y) → D x y) →
(f' : (x : A)(y : B)(z : C x y) → D x y) →
f ≅ f' →
{a : A}{b : B} {c : C a b} →
f a b c ≅ f' a b c
depfeqApp3f {_}{_}{_}{_}{A}{B}{C}{D} f f' p {a}{b}{c} =
depfeqApp2a {A = A} {B = B}{C = λ o1 o2 → C o1 o2}
{D = λ o1₁ o2₁ → D o1₁ o2₁} (f a) (f' a) (eqApp {f = λ h → h a} p) {b} {c}
depfeqApp3g : ∀{l l' l'' l'''}{A : Set l}{B : Set l'}{C : A → B → Set l''}{D D' : A → B → Set l'''}
(f : (x : A)(y : B)(z : C x y) → D x y) →
(f' : (x : A)(y : B)(z : C x y) → D' x y) →
D ≅ D' →
f ≅ f' →
{a : A}{b : B} {c : C a b} →
f a b c ≅ f' a b c
depfeqApp3g {_}{_}{_}{_}{A}{B}{C}{D} f f' refl p {a}{b}{c} =
depfeqApp2a {A = A} {B = B} {C = λ o1₁ o2₁ → C o1₁ o2₁} {D = λ o1 o2 → D o1 o2} (f a) (f' a) (eqApp {f = λ h → h a} p) {b} {c}
idepfeqApp2a : ∀{l l' l'' l''' l''''}{A : Set l}{B : Set l'}{C : Set l''}{D : A → B → C → Set l'''}{E : A → B → C → Set l''''}{a : A}
(f : {x : B}{y : C}(z : D a x y) → E a x y) →
(f' : {x : B}{y : C}(z : D a x y) → E a x y) →
(∀{x y} → f {x}{y} ≅ f' {x}{y}) →
{b : B}{c : C}{m : D a b c} →
f {b}{c} m ≅ f' {b} {c} m
idepfeqApp2a {l}{l'}{l''}{l'''}{l''''}{A}{B}{C}{D}{E}{a} f f' p {b}{c}{m} =
feqApp {f = f {b} {c}} {f' = f' {b} {c}} {m} {m} (ext (λ h → feqApp {f = f {b} {c}} {f' = f' {b} {c}} {h} {h} (p {b}{c}) refl)) refl
depfeqApp2b : ∀{l l' l''}{A : Set l}{D : A → A → Set l'}{E E' : A → A → Set l''}
(f : (x : A)(y : A)(z : A) → (m1 : D y z) → (m2 : D x y) → E x z) →
{f' : (x : A)(y : A)(z : A) → (m1 : D y z) → (m2 : D x y) → E' x z} →
E ≅ E' →
f ≅ f' →
{a a' b b' c c' : A}{m1 : D b c}{m2 : D a b}{m1' : D b' c'}{m2' : D a' b'} →
a ≅ a' → b ≅ b' → c ≅ c' → m1 ≅ m1' → m2 ≅ m2' →
f a b c m1 m2 ≅ f' a' b' c' m1' m2'
depfeqApp2b {_}{_}{_}{A}{D}{E} f refl refl {a = a}{b = b}{c = c}{m1 = m1}{m2 = m2} refl refl refl refl refl =
eqApp {f = f a b c m1} {m2}{m2} refl
feqApp3 : ∀{l}{A : Set l}{B : A → Set (suc l)}{C : A → Set (suc l)}{D : Set (suc l)}
(f : (x : A)(y : B x)(z : C x) → D) →
(f' : (x : A)(y : B x)(z : C x) → D) →
f ≅ f' →
{a : A}{b : B a} {c : C a} →
f a b c ≅ f' a b c
feqApp3 {_}{A}{B}{C} f f' p {a}{b}{c} =
feqApp {f = f a b} {f' = f' a b} (feqApp {f = f a} {f' = f' a} (eqApp {f = λ h → h a} p) refl) refl
coerce : ∀{l}{A B : Set l} → A ≅ B → A → B
coerce refl a = a
p : ∀{m}{A B : Set m}{a : A}{b : B} → (q : B ≅ A) → _≅_ {m} {A} a {A} (coerce q b) → _≅_ {m} {A} a {B} b
p refl refl = refl
eqApp4 : ∀{x y z v w}{A : Set x}{B : A → Set y}{C : (a : A) → B a → Set z}{D : (a : A)(b : B a) → C a b → Set v}{E : Set w}
(f : (a : A)(b : B a)(c : C a b) → D a b c → E) →
{a a' : A} → a ≅ a' →
{b : B a}{b' : B a'} → b ≅ b' →
{c : C a b}{c' : C a' b'} → c ≅ c' →
{d : D a b c}{d' : D a' b' c'} → d ≅ d' →
f a b c d ≅ f a' b' c' d'
eqApp4 f refl refl refl refl = refl
funCong : ∀{l m : Level}{A : Set l}{B : Set m}{f g : A → B}{a : A}{b : B}
→ (p : f ≅ g) → (q : f a ≅ b)
→ (w : g a ≅ b) → q ≅ w
funCong refl q w = ir
funCong2 : ∀{l : Level}{A B B' X Y : Set l}{f : ∀{X Y} → A → B}{g : ∀{X Y} → A → B'}{a : A}{b : B}
→ (r : B ≅ B') → (p : (λ {X}{Y} → f {X}{Y}) ≅ (λ {X}{Y} → g {X}{Y})) → (q : f {X}{Y} a ≅ b)
→ (w : g {X}{Y} a ≅ b) → q ≅ w
funCong2 refl refl q w = ir
fixtypes : ∀{x}{A A' : Set x}{a a' : A}{a'' a''' : A'}{p : a ≅ a'}{q : a'' ≅ a'''} → a ≅ a'' → a' ≅ a''' → p ≅ q
fixtypes refl refl = ir
| 45.520548
| 151
| 0.365433
|
0dd95a310a091a875ebd311cee7b1420b20464a5
| 147
|
agda
|
Agda
|
test/fail/TermSplicingOutOfScope.agda
|
asr/agda-kanso
|
aa10ae6a29dc79964fe9dec2de07b9df28b61ed5
|
[
"MIT"
] | 1
|
2018-10-10T17:08:44.000Z
|
2018-10-10T17:08:44.000Z
|
test/fail/TermSplicingOutOfScope.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | null | null | null |
test/fail/TermSplicingOutOfScope.agda
|
np/agda-git-experiment
|
20596e9dd9867166a64470dd24ea68925ff380ce
|
[
"MIT"
] | 1
|
2022-03-12T11:35:18.000Z
|
2022-03-12T11:35:18.000Z
|
open import Common.Prelude
open import Common.Reflect
module TermSplicingOutOfScope where
f : Set → Set → Set → Set
f x y z = unquote (var 3 [])
| 18.375
| 35
| 0.727891
|
374e498a970b1cf375db52551ee5d4b047d85619
| 3,003
|
agda
|
Agda
|
Cubical/Categories/Limits/Terminal.agda
|
barrettj12/cubical
|
7b41b9171f90473efc98487cb2ea7a4d02320cb2
|
[
"MIT"
] | null | null | null |
Cubical/Categories/Limits/Terminal.agda
|
barrettj12/cubical
|
7b41b9171f90473efc98487cb2ea7a4d02320cb2
|
[
"MIT"
] | null | null | null |
Cubical/Categories/Limits/Terminal.agda
|
barrettj12/cubical
|
7b41b9171f90473efc98487cb2ea7a4d02320cb2
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --safe #-}
module Cubical.Categories.Limits.Terminal where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Sigma
open import Cubical.Foundations.HLevels
-- open import Cubical.Categories.Limits.Base
open import Cubical.Categories.Category
open import Cubical.Categories.Functor
private
variable
ℓ ℓ' : Level
module _ (C : Category ℓ ℓ') where
open Category C
isInitial : (x : ob) → Type (ℓ-max ℓ ℓ')
isInitial x = ∀ (y : ob) → isContr (C [ x , y ])
isFinal : (x : ob) → Type (ℓ-max ℓ ℓ')
isFinal x = ∀ (y : ob) → isContr (C [ y , x ])
hasInitialOb : Type (ℓ-max ℓ ℓ')
hasInitialOb = Σ[ x ∈ ob ] isInitial x
hasFinalOb : Type (ℓ-max ℓ ℓ')
hasFinalOb = Σ[ x ∈ ob ] isFinal x
-- Initiality of an object is a proposition.
isPropIsInitial : (x : ob) → isProp (isInitial x)
isPropIsInitial x = isPropΠ λ y → isPropIsContr
-- Objects that are initial are isomorphic.
isInitialToIso : {x y : ob} (hx : isInitial x) (hy : isInitial y) →
CatIso C x y
isInitialToIso {x = x} {y = y} hx hy =
let x→y : C [ x , y ]
x→y = fst (hx y) -- morphism forwards
y→x : C [ y , x ]
y→x = fst (hy x) -- morphism backwards
x→y→x : x→y ⋆⟨ C ⟩ y→x ≡ id
x→y→x = isContr→isProp (hx x) _ _ -- compose to id by uniqueness
y→x→y : y→x ⋆⟨ C ⟩ x→y ≡ id
y→x→y = isContr→isProp (hy y) _ _ -- similar.
in catiso x→y y→x y→x→y x→y→x
open isUnivalent
-- The type of initial objects of a univalent category is a proposition,
-- i.e. all initial objects are equal.
isPropInitial : (hC : isUnivalent C) → isProp (hasInitialOb)
isPropInitial hC x y =
-- Being initial is a prop ∴ Suffices equal as objects in C.
Σ≡Prop (isPropIsInitial)
-- C is univalent ∴ Suffices isomorphic as objects in C.
(CatIsoToPath hC (isInitialToIso (snd x) (snd y)))
-- Now the dual argument for final objects.
-- Finality of an object is a proposition.
isPropIsFinal : (x : ob) → isProp (isFinal x)
isPropIsFinal x = isPropΠ λ y → isPropIsContr
-- Objects that are initial are isomorphic.
isFinalToIso : {x y : ob} (hx : isFinal x) (hy : isFinal y) →
CatIso C x y
isFinalToIso {x = x} {y = y} hx hy =
let x→y : C [ x , y ]
x→y = fst (hy x) -- morphism forwards
y→x : C [ y , x ]
y→x = fst (hx y) -- morphism backwards
x→y→x : x→y ⋆⟨ C ⟩ y→x ≡ id
x→y→x = isContr→isProp (hx x) _ _ -- compose to id by uniqueness
y→x→y : y→x ⋆⟨ C ⟩ x→y ≡ id
y→x→y = isContr→isProp (hy y) _ _ -- similar.
in catiso x→y y→x y→x→y x→y→x
-- The type of final objects of a univalent category is a proposition,
-- i.e. all final objects are equal.
isPropFinal : (hC : isUnivalent C) → isProp (hasFinalOb)
isPropFinal hC x y =
-- Being final is a prop ∴ Suffices equal as objects in C.
Σ≡Prop isPropIsFinal
-- C is univalent ∴ Suffices isomorphic as objects in C.
(CatIsoToPath hC (isFinalToIso (snd x) (snd y)))
| 34.125
| 74
| 0.616384
|
9acd121d179915930130e69f78d9425ea82a9e24
| 4,235
|
agda
|
Agda
|
src/Data/PropFormula/Theorems/Negation.agda
|
jonaprieto/agda-prop
|
a1730062a6aaced2bb74878c1071db06477044ae
|
[
"MIT"
] | 13
|
2017-05-01T16:45:41.000Z
|
2022-01-17T03:33:12.000Z
|
src/Data/PropFormula/Theorems/Negation.agda
|
jonaprieto/agda-prop
|
a1730062a6aaced2bb74878c1071db06477044ae
|
[
"MIT"
] | 18
|
2017-03-08T14:33:10.000Z
|
2017-12-18T16:34:21.000Z
|
src/Data/PropFormula/Theorems/Negation.agda
|
jonaprieto/agda-prop
|
a1730062a6aaced2bb74878c1071db06477044ae
|
[
"MIT"
] | 2
|
2017-03-30T16:41:56.000Z
|
2017-12-01T17:01:25.000Z
|
------------------------------------------------------------------------------
-- Agda-Prop Library.
-- Theorems of ¬ connective.
------------------------------------------------------------------------------
open import Data.Nat using ( ℕ )
module Data.PropFormula.Theorems.Negation ( n : ℕ ) where
------------------------------------------------------------------------------
open import Data.PropFormula.Properties n using ( ¬-injective ; subst )
open import Data.PropFormula.Syntax n
open import Data.PropFormula.Theorems.Classical n
open import Data.PropFormula.Theorems.Implication n using ( subst⊢⊃₁ )
open import Function using ( _$_ ; _∘_ )
open import Relation.Binary.PropositionalEquality using ( _≡_ ; refl ; sym )
------------------------------------------------------------------------------
-- Theorem.
¬-equiv₁
: ∀ {Γ} {φ}
→ Γ ⊢ ¬ φ
→ Γ ⊢ φ ⊃ ⊥
¬-to-⊃⊥ = ¬-equiv₁
-- Proof.
¬-equiv₁ {φ = φ} Γ⊢¬φ =
⊃-intro
(¬-elim
(weaken φ Γ⊢¬φ)
(assume φ))
-------------------------------------------------------------------------- ∎
-- Theorem.
¬-equiv₂
: ∀ {Γ} {φ}
→ Γ ⊢ φ ⊃ ⊥
→ Γ ⊢ ¬ φ
⊃⊥-to-¬ = ¬-equiv₂
-- Proof.
¬-equiv₂ {φ = φ} Γ⊢φ⊃⊥ =
¬-intro
(⊃-elim
(weaken φ Γ⊢φ⊃⊥)
(assume φ))
-------------------------------------------------------------------------- ∎
-- Theorem.
¬¬-equiv₁
: ∀ {Γ} {φ}
→ Γ ⊢ ¬ (¬ φ)
→ Γ ⊢ φ
-- Proof.
¬¬-equiv₁ {Γ}{φ} Γ⊢¬¬φ =
(⊃-elim
(⊃-intro $ RAA
(¬-elim
(weaken (¬ φ) $
assume $ ¬ (¬ φ))
(assume {Γ = Γ , ¬ (¬ φ)} $ ¬ φ)))
Γ⊢¬¬φ)
-------------------------------------------------------------------------- ∎
-- Theorem.
¬¬-equiv₂
: ∀ {Γ} {φ}
→ Γ ⊢ φ
→ Γ ⊢ ¬ (¬ φ)
-- Proof.
¬¬-equiv₂ {Γ}{φ} Γ⊢φ =
⊃⊥-to-¬
(⊃-intro
(¬-elim
(assume (¬ φ))
(weaken (¬ φ) Γ⊢φ)))
-------------------------------------------------------------------------- ∎
-- Theorem.
¬∨-to-⊃
: ∀ {Γ} {φ ψ}
→ Γ ⊢ ¬ φ ∨ ψ
→ Γ ⊢ φ ⊃ ψ
-- Proof.
¬∨-to-⊃ {Γ}{φ}{ψ} =
⊃-elim $
⊃-intro $
∨-elim
(⊃-intro $
⊥-elim {Γ = Γ , ¬ φ , φ} ψ
(¬-elim
(weaken φ $
assume (¬ φ))
(assume {Γ = Γ , ¬ φ} φ)))
(⊃-intro $
weaken φ $
assume ψ)
-------------------------------------------------------------------------- ∎
-- Theorem.
¬⊤-to-⊥
: ∀ {Γ}
→ Γ ⊢ ¬ ⊤
→ Γ ⊢ ⊥
-- Proof.
¬⊤-to-⊥ Γ⊢¬⊤ = ¬-elim Γ⊢¬⊤ ⊤-intro
-------------------------------------------------------------------------- ∎
-- Theorem.
⊤-to-¬⊥
: ∀ {Γ}
→ Γ ⊢ ⊤
→ Γ ⊢ ¬ ⊥
-- Proof.
⊤-to-¬⊥ = λ _ → ¬-intro (assume ⊥)
-------------------------------------------------------------------------- ∎
-- Theorem.
¬⊥-to-⊤
: ∀ {Γ}
→ Γ ⊢ ¬ ⊥
→ Γ ⊢ ⊤
-- Proof.
¬⊥-to-⊤ Γ⊢¬⊥ = ⊤-intro
-------------------------------------------------------------------------- ∎
-- Theorem.
⊥-to-¬⊤
: ∀ {Γ}
→ Γ ⊢ ⊥
→ Γ ⊢ ¬ ⊤
-- Proof.
⊥-to-¬⊤ = ¬-intro ∘ weaken ⊤
-------------------------------------------------------------------------- ∎
-- Theorem.
¬-inside
: ∀ {Γ} {φ ψ}
→ φ ≡ ψ
→ Γ ⊢ ¬ φ
→ Γ ⊢ ¬ ψ
≡-¬-to-¬ = ¬-inside
-- Proof.
¬-inside {φ = φ}{ψ} φ≡ψ Γ⊢¬φ =
¬-equiv₂
(⊃-intro
(⊃-elim
(¬-equiv₁
(weaken ψ Γ⊢¬φ))
(subst
(sym φ≡ψ)
(assume ψ))))
-------------------------------------------------------------------------- ∎
-- Theorem.
subst⊢¬
: ∀ {Γ} {φ γ}
→ Γ ⊢ γ ⊃ φ
→ Γ ⊢ ¬ φ
→ Γ ⊢ ¬ γ
-- Proof.
subst⊢¬ Γ⊢γ⊃φ Γ⊢¬φ = ⊃⊥-to-¬ (subst⊢⊃₁ Γ⊢γ⊃φ (¬-to-⊃⊥ Γ⊢¬φ))
-------------------------------------------------------------------------- ∎
-- Theorem.
¬⇔-to-⊃¬∧⊃¬
: ∀ {Γ} {φ₁ φ₂}
→ Γ ⊢ ¬ (φ₁ ⇔ φ₂)
→ Γ ⊢ (φ₁ ⊃ ¬ φ₂) ∧ (φ₂ ⊃ ¬ φ₁)
-- Proof.
¬⇔-to-⊃¬∧⊃¬ {Γ}{φ₁}{φ₂} thm =
∧-intro
(⊃-intro
(¬-intro
(¬-elim
(weaken φ₂ $ weaken φ₁ thm)
(⇔-intro
(weaken φ₁ $ assume {Γ = Γ , φ₁} φ₂)
(weaken φ₂ $ weaken φ₂ $ assume φ₁)))))
(⊃-intro
(¬-intro
(¬-elim (weaken φ₁ $ weaken φ₂ thm)
(⇔-intro
(weaken φ₁ $ weaken φ₁ $ assume φ₂)
(weaken φ₂ $ assume {Γ = Γ , φ₂} φ₁)))))
-------------------------------------------------------------------------- ∎
| 21.175
| 78
| 0.288784
|
3fe37079ecc72a0ddfb7963fbe463b555f8c60a6
| 3,238
|
agda
|
Agda
|
legacy/Data/Num/Bij.agda
|
banacorn/numeral
|
aae093cc9bf21f11064e7f7b12049448cd6449f1
|
[
"MIT"
] | 1
|
2015-04-23T15:58:28.000Z
|
2015-04-23T15:58:28.000Z
|
legacy/Data/Num/Bij.agda
|
banacorn/numeral
|
aae093cc9bf21f11064e7f7b12049448cd6449f1
|
[
"MIT"
] | null | null | null |
legacy/Data/Num/Bij.agda
|
banacorn/numeral
|
aae093cc9bf21f11064e7f7b12049448cd6449f1
|
[
"MIT"
] | 1
|
2015-05-30T05:50:50.000Z
|
2015-05-30T05:50:50.000Z
|
module Data.Num.Bij where
open import Data.List hiding ([_])
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as PropEq
using (_≡_; _≢_)
import Level
--------------------------------------------------------------------------------
-- Bijective Numeration
--
-- A numeral system which has a unique representation for every non-negative
-- interger
-- http://en.wikipedia.org/wiki/Bijective_numeration
--------------------------------------------------------------------------------
-- zeroless binary number
infixl 7 _*B_
infixl 6 _+B_
data DigitB : Set where
one : DigitB
two : DigitB
Bij : Set
Bij = List DigitB
incrB : Bij → Bij
incrB [] = one ∷ []
incrB (one ∷ a) = two ∷ a
incrB (two ∷ a) = one ∷ incrB a
-- addition
_+B_ : Bij → Bij → Bij
[] +B b = b
a +B [] = a
(one ∷ as) +B (one ∷ bs) = two ∷ as +B bs
(one ∷ as) +B (two ∷ bs) = one ∷ incrB (as +B bs)
(two ∷ as) +B (one ∷ bs) = one ∷ incrB (as +B bs)
(two ∷ as) +B (two ∷ bs) = two ∷ incrB (as +B bs)
-- arithmetic shift
*2_ : Bij → Bij
*2 [] = []
*2 (one ∷ as) = two ∷ *2 as
*2 (two ∷ as) = two ∷ incrB (*2 as)
-- multiplication
_*B_ : Bij → Bij → Bij
[] *B b = []
(one ∷ as) *B b = b +B (*2 (as *B b))
(two ∷ as) *B b = b +B b +B (*2 (as *B b))
--------------------------------------------------------------------------------
-- Ordering
--------------------------------------------------------------------------------
infix 4 _≤-digitB_ _≤B_ _<B_
data _≤-digitB_ : Rel DigitB Level.zero where
1≤1 : one ≤-digitB one
1≤2 : one ≤-digitB two
2≤2 : two ≤-digitB two
data _≤B_ : Rel Bij Level.zero where
[]≤all : ∀ {n} → [] ≤B n
≤here : ∀ {as bs a b} -- compare the least digit
→ {a≤b : a ≤-digitB b}
→ {as≡bs : as ≡ bs}
→ a ∷ as ≤B b ∷ bs
≤there : ∀ {as bs a b}
→ (as<bs : incrB as ≤B bs) -- compare the rest digits
→ a ∷ as ≤B b ∷ bs
_<B_ : Rel Bij Level.zero
a <B b = incrB a ≤B b
{-
decr : Bij → Bij
decr [] = []
decr (one ∷ a) = a
decr (two ∷ a) = one ∷ a
_-_ : Bij → Bij → Bij
[] - bs = []
as - [] = as
(one ∷ as) - (one ∷ bs) = as - bs
(one ∷ as) - (two ∷ bs) = one ∷ decr (as - bs)
(two ∷ as) - (one ∷ bs) = one ∷ as - bs
(two ∷ as) - (two ∷ bs) = as - bs
-}
--------------------------------------------------------------------------------
-- typeclass for converting data types to Bij
-- http://people.cs.kuleuven.be/~dominique.devriese/agda-instance-arguments/icfp001-Devriese.pdf
record Conversion (t : Set) : Set where
constructor conversion
field
[_] : t → Bij
!_! : Bij → t
-- split morphism
-- !_! is a section of [_]
-- [_] is a retraction of !_!
-- [!!]-id : ∀ n → [ ! n ! ] ≡ n
[_] : ∀ {t} → {{convT : Conversion t}} → t → Bij
[_] {{convT}} = Conversion.[ convT ]
!_! : ∀ {t} → {{convT : Conversion t}} → Bij → t
!_! {{convT}} = Conversion.! convT !
--[!!]-id : ∀ {t} → {{convT : Conversion t}} → (n : Bij) → [ ! n ! ] ≡ n
--[!!]-id {{convT}} = Conversion.[!!]-id convT
-- alias, more meaningful than the forgettable [_] and !_! (replace them some day)
toBij = [_]
fromBij = !_!
| 26.325203
| 97
| 0.455528
|
14f57130a37fce01d913addbbdd7e8debfa1c7ad
| 42,874
|
agda
|
Agda
|
BTA8.agda
|
luminousfennell/polybta
|
ef878f7fa5afa51fb7a14cd8f7f75da0af1b9deb
|
[
"BSD-3-Clause"
] | 1
|
2019-10-15T04:35:29.000Z
|
2019-10-15T04:35:29.000Z
|
BTA8.agda
|
luminousfennell/polybta
|
ef878f7fa5afa51fb7a14cd8f7f75da0af1b9deb
|
[
"BSD-3-Clause"
] | null | null | null |
BTA8.agda
|
luminousfennell/polybta
|
ef878f7fa5afa51fb7a14cd8f7f75da0af1b9deb
|
[
"BSD-3-Clause"
] | 1
|
2019-10-15T09:01:37.000Z
|
2019-10-15T09:01:37.000Z
|
module BTA8 where
----------------------------------------------
-- Preliminaries: Imports and List-utilities
----------------------------------------------
open import Data.Nat hiding (_<_;_⊔_;_*_;equal)
open import Data.Bool hiding (_∧_;_∨_)
open import Function using (_∘_)
open import Data.List
open import Data.Nat.Properties
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Data.Empty
open import Lib
---------------------------------------
-- Start of the development:
---------------------------------------
-- Intro/Objective:
-------------------
-- The following development defines a (verified) specializer/partial
-- evaluator for a simply typed lambda calculus embedded in Agda using
-- deBruijn indices.
-- The residual language.
-------------------------
-- The residual language is a standard simply typed λ-calculus. The
-- types are integers,functions,pairs,and sums.
data Type : Set where
Int : Type
Fun : Type → Type → Type
--pair type on the residual type level
_•_ : Type → Type → Type
--sum type on the residual type level
_⊎_ : Type → Type → Type
Ctx = List Type
-- The type Exp describes the typed residual expressions. Variables
-- are represented by deBruijn indices that form references into the
-- typing context. The constructors and typing constraints are
-- standard.
-- TODO: citations for ``as usual'' and ``standard''
-- what?
data Exp (Γ : Ctx) : Type → Set where
EVar : ∀ {τ} → τ ∈ Γ → Exp Γ τ
EInt : ℕ → Exp Γ Int
EAdd : Exp Γ Int → Exp Γ Int -> Exp Γ Int
ELam : ∀ {τ τ'} → Exp (τ ∷ Γ) τ' → Exp Γ (Fun τ τ')
EApp : ∀ {τ τ'} → Exp Γ (Fun τ τ') → Exp Γ τ → Exp Γ τ'
_,_ : ∀ {τ τ'} → Exp Γ τ → Exp Γ τ' → Exp Γ (τ • τ')
Tl : ∀ {τ τ'} → Exp Γ τ → Exp Γ (τ ⊎ τ')
Tr : ∀ {τ τ'} → Exp Γ τ' → Exp Γ (τ ⊎ τ')
EFst : ∀ {τ τ'} → Exp Γ (τ • τ') → Exp Γ τ
ESnd : ∀ {τ τ'} → Exp Γ (τ • τ') → Exp Γ τ'
ECase : ∀ {τ τ' τ''} → Exp Γ (τ ⊎ τ') → Exp (τ ∷ Γ) τ'' → Exp (τ' ∷ Γ) τ'' → Exp Γ τ''
-- The standard functional semantics of the residual expressions.
-- TODO: citations for ``as usual'' and ``standard''
-- what?
module Exp-Eval where
-- interpretation of Exp types
EImp : Type → Set
EImp Int = ℕ
EImp (Fun ty ty₁) = EImp ty → EImp ty₁
EImp (ty • ty₁) = EImp ty * EImp ty₁
EImp (ty ⊎ ty₁) = EImp ty ⨄ EImp ty₁
-- Environments containing values for free variables. An environment
-- is indexed by a typing context that provides the types for the
-- contained values.
data Env : Ctx → Set where
[] : Env []
_∷_ : ∀ {τ Γ} → EImp τ → Env Γ → Env (τ ∷ Γ)
-- Lookup a value in the environment, given a reference into the
-- associated typing context.
lookupE : ∀ { τ Γ } → τ ∈ Γ → Env Γ → EImp τ
lookupE hd (x ∷ env) = x
lookupE (tl v) (x ∷ env) = lookupE v env
-- Evaluation of residual terms, given a suitably typed environment.
ev : ∀ {τ Γ} → Exp Γ τ → Env Γ → EImp τ
ev (EVar x) env = lookupE x env
ev (EInt x) env = x
ev (EAdd e e₁) env = ev e env + ev e₁ env
ev (ELam e) env = λ x → ev e (x ∷ env)
ev (EApp e e₁) env = ev e env (ev e₁ env)
ev (e , e₁) env = ev e env , (ev e₁ env)
ev (Tl e) env = tl (ev e env)
ev (Tr e) env = tr (ev e env)
ev (EFst e) env = fst (ev e env)
ev (ESnd e) env = snd (ev e env)
ev (ECase e e₁ e₂) env with ev e env
ev (ECase e e₁ e₂) env | tl c = (λ x → ev e₁ (x ∷ env)) c
ev (ECase e e₁ e₂) env | tr c = (λ x → ev e₂ (x ∷ env)) c
-- The binding-time-annotated language.
---------------------------------------
-- The type of a term determines the term's binding time. The type
-- constructors with an A-prefix denote statically bound integers and
-- functions. Terms with dynamic binding time have a `D' type. The `D'
-- type constructor simply wraps up a residual type.
data AType : Set where
AInt : AType
AFun : AType → AType → AType
D : Type → AType
--pair type on the annotated type level
_•_ : AType → AType → AType
--sum type on the annotated type level
_⊎_ : AType → AType → AType
ACtx = List AType
-- The mapping from annotated types to residual types is straightforward.
typeof : AType → Type
typeof AInt = Int
typeof (AFun α₁ α₂) = Fun (typeof α₁) (typeof α₂)
typeof (D x) = x
typeof (α₁ • α₂) = typeof α₁ • typeof α₂
typeof (α₁ ⊎ α₂) = typeof α₁ ⊎ typeof α₂
-- The typed annotated terms: The binding times of variables is
-- determined by the corresponding type-binding in the context. In the
-- other cases, the A- and D-prefixes on term constructors inidicate
-- the corresponding binding times for the resulting terms.
------------------------------------------------------------------------------------------------
-- Now the typed annotated terms are extended to inculde dynamic terms whose subterms are static
------------------------------------------------------------------------------------------------
---------------
--Some examples
---------------
--a. first-order static value in a dynamic environment
-- DAdd (DInt 1) (AAdd (AInt 2) (AInt 3)) where AAdd (AInt 2) (AInt 3) : AExp [] AInt
-- DAdd (DInt 1) (AApp (ALam (Var hd)) (AInt 5)) where AApp (ALam (Var hd)) (AInt 5) : AExp [] AInt
--b. higher-order static value in a dynamic environment
-- DApp (ALam (Var hd)) (DInt 5) where ALam (Var hd) : AExp [] (AFun (D Int) (D Int))
-- DApp (ALam (ALam (AInt 0))) (DInt 5) where ALam (ALam (AInt 0)) : AExp [] (AFun (AFun (D Int) (D Int)) AInt)
-- DApp (ALam (ALam (DInt 0))) (DInt 5) where ALam (ALam (DInt 0)) : AExp [] (AFun (AFun AInt (D Int)) (D Int))
--Clearly these terms are not well-typed and we need to modify [AExp] such that they have the right types which are
--compatible with the dynamic environment,or we can "lift" their static types to dynamic types so that they can be
--used as dynamic sub-terms to be filled in the right dynamic environment. This,however,brings new difficulty when
--we try to partially evaluate term who contains "lifted" subterms.
----------------
--new difficulty
----------------
--Consider the evaluation of the following term
--DAdd (DInt 1) (Lift (AAdd (AInt 2) (AInt 3))) : AExp [] AInt
--the expected type after evaluation is,
--EAdd (EInt 1) ? : Exp [] Int where ? : Exp [] Int
--and one good candidate for "?" as,
--EInt (pe (AAdd (AInt 2) (AInt 3)) []) : Exp [] Int
--where we wrap up the partial evaluation of the static subterm so
--that it fits with the rest of evaluation.
--However,we can not always "wrap up" a evaluated higher-order static
--value so that it has the required residual type,
--ALam (Var hd) : AExp [] (AFun AInt AInt)
--the required type of its lifted term as,
--? : Exp [] (Fun Int Int)
--which can not be constructed from [λ Γ↝Γ' x → x : []↝Γ' → ℕ → ℕ]
--for the input of the static function is evaluated to be a natural
--number which can not be matched with the type of the input of the
--required residual term. It is then clear that we need to impose
--restriction upon terms to be lifted.
-------------------------
--restriction for lifting
-------------------------
-------------------------------------------------------------
-- The interpretation of annotated types.
Imp : Ctx → AType → Set
Imp Γ (AInt) = ℕ
Imp Γ (AFun α₁ α₂) = ∀ {Γ'} → Γ ↝ Γ' → (Imp Γ' α₁ → Imp Γ' α₂)
Imp Γ (D σ) = Exp Γ σ
Imp Γ (α₁ • α₂) = (Imp Γ α₁) * (Imp Γ α₂)
Imp Γ (α₁ ⊎ α₂) = (Imp Γ α₁) ⨄ (Imp Γ α₂)
elevate-var : ∀ {Γ Γ'} {τ : Type} → Γ ↝ Γ' → τ ∈ Γ → τ ∈ Γ'
elevate-var ↝-refl x = x
elevate-var (↝-extend Γ↝Γ') x = tl (elevate-var Γ↝Γ' x)
elevate-var2 : ∀ {Γ Γ' Γ'' τ} → Γ ↝ Γ' ↝ Γ'' → τ ∈ Γ → τ ∈ Γ''
elevate-var2 (↝↝-base x) x₁ = elevate-var x x₁
elevate-var2 (↝↝-extend Γ↝Γ'↝Γ'') hd = hd
elevate-var2 (↝↝-extend Γ↝Γ'↝Γ'') (tl x) = tl (elevate-var2 Γ↝Γ'↝Γ'' x)
elevate : ∀ {Γ Γ' Γ'' τ} → Γ ↝ Γ' ↝ Γ'' → Exp Γ τ → Exp Γ'' τ
elevate Γ↝Γ'↝Γ'' (EVar x) = EVar (elevate-var2 Γ↝Γ'↝Γ'' x)
elevate Γ↝Γ'↝Γ'' (EInt x) = EInt x
elevate Γ↝Γ'↝Γ'' (EAdd e e₁) = EAdd (elevate Γ↝Γ'↝Γ'' e) (elevate Γ↝Γ'↝Γ'' e₁)
elevate Γ↝Γ'↝Γ'' (ELam e) = ELam (elevate (↝↝-extend Γ↝Γ'↝Γ'') e)
elevate Γ↝Γ'↝Γ'' (EApp e e₁) = EApp (elevate Γ↝Γ'↝Γ'' e) (elevate Γ↝Γ'↝Γ'' e₁)
elevate Γ↝Γ'↝Γ'' (e , e₁) = ((elevate Γ↝Γ'↝Γ'' e) , (elevate Γ↝Γ'↝Γ'' e₁))
elevate Γ↝Γ'↝Γ'' (Tl e) = Tl (elevate Γ↝Γ'↝Γ'' e)
elevate Γ↝Γ'↝Γ'' (Tr e) = Tr (elevate Γ↝Γ'↝Γ'' e)
elevate Γ↝Γ'↝Γ'' (EFst e) = EFst (elevate Γ↝Γ'↝Γ'' e)
elevate Γ↝Γ'↝Γ'' (ESnd e) = ESnd (elevate Γ↝Γ'↝Γ'' e)
elevate Γ↝Γ'↝Γ'' (ECase c e₁ e₂) = ECase (elevate Γ↝Γ'↝Γ'' c) (elevate (↝↝-extend Γ↝Γ'↝Γ'') e₁) (elevate (↝↝-extend Γ↝Γ'↝Γ'') e₂)
liftE : ∀ {τ Γ Γ'} → Γ ↝ Γ' → Exp Γ τ → Exp Γ' τ
liftE Γ↝Γ' e = elevate (↝↝-base Γ↝Γ') e
-------------------------------------------------------------
-- --case 1. a first-order static value in a dynamic environment
-- lift1 : AExp [] AInt
-- lift1 = (AInt 0)
-- e1 : Imp [] AInt
-- e1 = 0
-- lifted1 : Exp [] (typeof AInt)
-- lifted1 = EInt e1
-- --case 2. higher-order static function in a dynamic environment
-- --a. a function whose input argument is of static integer
-- --lift2 : AExp [] (AFun AInt AInt)
-- --lift2 = ALam (Var hd)
-- --e2 : Imp [] (AFun AInt AInt)
-- --e2 = λ Γ↝Γ' x → x
-- --lifted2 : Exp [] (typeof (AFun AInt AInt))
-- --lifted2 = ELam {!!}
-- --Note that as explained above it is impossible to construct the right term using [e2]
-- --to fill in the above hole!
-- --b. a function whose input argument is of dynamic integer
-- --b.1. when return type is of dynamic integer
-- lift3 : AExp [] (AFun (D Int) (D Int))
-- lift3 = ALam (Var hd)
-- e3 : Imp [] (AFun (D Int) (D Int))
-- e3 = λ Γ↝Γ' x → x
-- liftede3 : Exp [] (typeof (AFun (D Int) (D Int)))
-- liftede3 = ELam (e3 (↝-extend ↝-refl) (EVar hd))
-- --b.2. when return type is of static integer
-- lift4 : AExp [] (AFun (D Int) AInt)
-- lift4 = ALam (AInt 0)
-- e4 : Imp [] (AFun (D Int) AInt)
-- e4 = λ Γ↝Γ' x → 0
-- liftede4 : Exp [] (typeof (AFun (D Int) AInt))
-- liftede4 = ELam ( EInt {Int ∷ []} (e4 (↝-extend ↝-refl) (EVar hd)))
-- --c. a function whose input argument is of static function type
-- --c.1. static function type returns a static integer
-- --lift5 : AExp [] (AFun (AFun AInt AInt) AInt)
-- --lift5 = ALam (AApp (Var hd) (AInt 0))
-- --e5 : Imp [] (AFun (AFun AInt AInt) AInt)
-- --e5 = λ Γ↝Γ' x → x ↝-refl 0
-- --liftede5 : Exp [] (typeof ( AFun (AFun AInt AInt) AInt))
-- --liftede5 = ELam (EInt (e5 (↝-extend {τ = Fun Int Int} ↝-refl) (λ Γ↝Γ' e' → {!!})))
-- --Note that again it is impossible to construct the right residual term
-- --c.2. static function type returns a dynamic integer
-- --c.2.1. the input of the function type is of static integer
-- lift6 : AExp [] (AFun (AFun AInt (D Int)) (D Int))
-- lift6 = ALam (AApp (Var hd) (AInt 0))
-- e6 : Imp [] (AFun (AFun AInt (D Int)) (D Int))
-- e6 = λ Γ↝Γ' x → x ↝-refl 0
-- liftede6 : Exp [] (typeof ( AFun (AFun AInt (D Int)) (D Int)))
-- liftede6 = ELam ((e6 (↝-extend {τ = Fun Int Int} ↝-refl)
-- (λ Γ↝Γ' e' → EApp (liftE Γ↝Γ' (EVar {Fun Int Int ∷ []} hd)) (EInt e'))))
-- --c.2.1. the input of the function type is of dynamic integer
-- lift7 : AExp [] (AFun (AFun (D Int) (D Int)) (D Int))
-- lift7 = ALam (AApp (Var hd) (DInt 0))
-- e7 : Imp [] (AFun (AFun (D Int) (D Int)) (D Int))
-- e7 = λ Γ↝Γ' x → x ↝-refl (EInt 0)
-- liftede7 : Exp [] (typeof ( AFun (AFun (D Int) (D Int)) (D Int)))
-- liftede7 = ELam ((e7 (↝-extend {τ = Fun Int Int} ↝-refl)
-- (λ Γ↝Γ' e' → EApp (liftE Γ↝Γ' (EVar {Fun Int Int ∷ []} hd)) e')))
-- --c.3. the output of the function type is of higher-order static value
-- --c.3.1 the return value has one static integer as input
-- -- lift8 : AExp [] (AFun (D Int) (AFun AInt (D Int)))
-- -- lift8 = ALam (ALam (Var (tl hd)))
-- -- e8 : Imp [] (AFun (D Int) (AFun AInt (D Int)))
-- -- e8 = λ Γ↝Γ' x Γ'↝Γ'' y → liftE Γ'↝Γ'' x
-- -- liftede8 : Exp [] (typeof ( AFun (D Int) (AFun AInt (D Int))))
-- -- liftede8 = ELam (ELam (e8 (↝-extend (↝-extend ↝-refl)) (EVar (tl hd)) ↝-refl {!!}))
-- --c.3.2 the return value has one dynamic integer as input
-- lift9 : AExp [] (AFun (D Int) (AFun (D Int) (D Int)))
-- lift9 = ALam (ALam (Var (tl hd)))
-- e9 : Imp [] (AFun (D Int) (AFun (D Int) (D Int)))
-- e9 = λ Γ↝Γ' x Γ'↝Γ'' y → liftE Γ'↝Γ'' x
-- liftede9 : Exp [] (typeof ( AFun (D Int) (AFun (D Int) (D Int))))
-- liftede9 = ELam (ELam (e9 (↝-extend (↝-extend ↝-refl)) (EVar (tl hd)) ↝-refl (EVar hd)))
-- --d. static pairs and sums in dynamic environment
-- --d.1. identity function with static sum as its input
-- lift10 : AExp [] (AFun ((D Int) ⊎ (D Int)) ((D Int) ⊎ (D Int)))
-- lift10 = ALam (Var hd)
-- e10 : Imp [] (AFun ((D Int) ⊎ (D Int)) ((D Int) ⊎ (D Int)))
-- e10 = λ Γ↝Γ' x → x
-- liftede10 : Exp [] (typeof (AFun ((D Int) ⊎ (D Int)) ((D Int) ⊎ (D Int))))
-- liftede10 = ELam {!e10!}
-- --d.1. identity function with static sum as its input
-- lift11 : AExp [] (AFun ((D Int) • (D Int)) ((D Int) • (D Int)))
-- lift11 = ALam (Var hd)
-- e11 : Imp [] (AFun ((D Int) • (D Int)) ((D Int) • (D Int)))
-- e11 = λ Γ↝Γ' x → x
-- liftede11 : Exp [] (typeof (AFun ((D Int) • (D Int)) ((D Int) • (D Int))))
-- liftede11 = ELam (fst (e11 (↝-extend ↝-refl) (EFst (EVar hd) , ESnd (EVar hd))) ,
-- snd (e11 (↝-extend ↝-refl) (EFst (EVar hd) , ESnd (EVar hd))))
--Note that the above two examples in section "d" clearly shows that
--"static functions with inputs of static sum type are not liftable
-- while with inputs of static pair type are liftable ".
---------------------------
--summary on liftable terms
---------------------------
--a. Regarding static first-order static value (static integer) in dynamic environment
-- All terms of static integer type are liftable
--b. Regarding static higher-order static value in dynamic environment
--b.1. given that output value is liftable
-- • when input is of first-order dynamic type,liftable
-- • when input is of higher-order static type and output
-- of that input is of dynamic type,liftable
--b.2. given that input value is liftable
-- • when output is of first-order type,liftable
-- • when output is of higher-order type and inputs
-- of that type are of dynamic type,liftable
-------------------------------------------
--specification of the liftable restriction
-------------------------------------------
mutual
data Liftable : AType → Set where
D : ∀ τ → Liftable (D τ)
AInt : Liftable AInt
_⊎_ : ∀ {α₁ α₂} → Liftable α₁ → Liftable α₂ → Liftable (α₁ ⊎ α₂)
_•_ : ∀ {α₁ α₂} → Liftable α₁ → Liftable α₂ → Liftable (α₁ • α₂)
AFun : ∀ {α₁ α₂} → Liftable⁻ α₁ → Liftable α₂ → Liftable (AFun α₁ α₂)
data Liftable⁻ : AType → Set where
D : ∀ τ → Liftable⁻ (D τ)
_•_ : ∀ {α₁ α₂} → Liftable⁻ α₁ → Liftable⁻ α₂ → Liftable⁻ (α₁ • α₂)
AFun : ∀ {α₁ α₂} → Liftable α₁ → Liftable⁻ α₂ → Liftable⁻ (AFun α₁ α₂)
----------------------------------------
--[AExp] with liftable terms
----------------------------------------
data AExp (Δ : ACtx) : AType → Set where
Var : ∀ {α} → α ∈ Δ → AExp Δ α
AInt : ℕ → AExp Δ AInt
AAdd : AExp Δ AInt → AExp Δ AInt → AExp Δ AInt
ALam : ∀ {α₁ α₂} → AExp (α₁ ∷ Δ) α₂ → AExp Δ (AFun α₁ α₂)
AApp : ∀ {α₁ α₂} → AExp Δ (AFun α₂ α₁) → AExp Δ α₂ → AExp Δ α₁
DInt : ℕ → AExp Δ (D Int)
DAdd : AExp Δ (D Int) → AExp Δ (D Int) → AExp Δ (D Int)
DLam : ∀ {σ₁ σ₂} → AExp ((D σ₁) ∷ Δ) (D σ₂) → AExp Δ (D (Fun σ₁ σ₂))
DApp : ∀ {α₁ α₂} → AExp Δ (D (Fun α₂ α₁)) → AExp Δ (D α₂) → AExp Δ (D α₁)
-- Static pairs and sums
_,_ : ∀ {α₁ α₂} → AExp Δ α₁ → AExp Δ α₂ → AExp Δ (α₁ • α₂)
Tl : ∀ {α₁ α₂} → AExp Δ α₁ → AExp Δ (α₁ ⊎ α₂)
Tr : ∀ {α₁ α₂} → AExp Δ α₂ → AExp Δ (α₁ ⊎ α₂)
Fst : ∀ {α₁ α₂} → AExp Δ (α₁ • α₂) → AExp Δ α₁
Snd : ∀ {α₁ α₂} → AExp Δ (α₁ • α₂) → AExp Δ α₂
Case : ∀ {α₁ α₂ α₃} → AExp Δ (α₁ ⊎ α₂) → AExp (α₁ ∷ Δ) α₃ → AExp (α₂ ∷ Δ) α₃ → AExp Δ α₃
-- Dynamic pairs and sums
_ḋ_ : ∀ {σ₁ σ₂} → AExp Δ (D σ₁) → AExp Δ (D σ₂) → AExp Δ (D (σ₁ • σ₂))
DTl : ∀ {σ₁ σ₂} → AExp Δ (D σ₁) → AExp Δ (D (σ₁ ⊎ σ₂))
DTr : ∀ {σ₁ σ₂} → AExp Δ (D σ₂) → AExp Δ (D (σ₁ ⊎ σ₂))
DFst : ∀ {σ₁ σ₂} → AExp Δ (D (σ₁ • σ₂)) → AExp Δ (D σ₁)
DSnd : ∀ {σ₁ σ₂} → AExp Δ (D (σ₁ • σ₂)) → AExp Δ (D σ₂)
DCase : ∀ {σ₁ σ₂ σ₃} → AExp Δ (D (σ₁ ⊎ σ₂)) → AExp ((D σ₁) ∷ Δ) (D σ₃) → AExp ((D σ₂) ∷ Δ) (D σ₃) → AExp Δ (D σ₃)
-- Liftable static terms
↑ : ∀ {α} → Liftable α → AExp Δ α → AExp Δ (D (typeof α))
-- The terms of AExp assign a binding time to each subterm. For
-- program specialization, we interpret terms with dynamic binding
-- time as the programs subject to specialization, and their subterms
-- with static binding time as statically known inputs. A partial
-- evaluation function (or specializer) then compiles the program into
-- a residual term for that is specialized for the static inputs. The
-- main complication when defining partial evaluation as a total,
-- primitively recursive function will be the treatment of the De
-- Bruijn variables of non-closed residual expressions.
lift : ∀ {Γ Γ'} α → Γ ↝ Γ' → Imp Γ α → Imp Γ' α
lift AInt p v = v
lift (AFun x x₁) Γ↝Γ' v = λ Γ'↝Γ'' → v (↝-trans Γ↝Γ' Γ'↝Γ'')
lift (D x₁) Γ↝Γ' v = elevate (↝↝-base Γ↝Γ') v
lift (α₁ • α₂) Γ↝Γ' (v₁ , v₂) = (lift α₁ Γ↝Γ' v₁) , (lift α₂ Γ↝Γ' v₂)
lift (α₁ ⊎ α₂) Γ↝Γ' (tl v) = tl (lift α₁ Γ↝Γ' v)
lift (α₁ ⊎ α₂) Γ↝Γ' (tr v) = tr (lift α₂ Γ↝Γ' v)
module SimpleAEnv where
-- A little weaker, but much simpler
data AEnv (Γ : Ctx) : ACtx → Set where
[] : AEnv Γ []
--cons : ∀ {Δ} (α : AType) → Imp Γ α → AEnv Γ Δ → AEnv Γ (α ∷ Δ)
cons : ∀ {Δ} {α : AType} → Imp Γ α → AEnv Γ Δ → AEnv Γ (α ∷ Δ)
lookup : ∀ {α Δ Γ} → AEnv Γ Δ → α ∈ Δ → Imp Γ α
lookup [] ()
--lookup {α} (cons .α x aenv) hd = x
--lookup {α} (cons .y x aenv) (tl {.α} {y} id) = lookup aenv id
lookup {α} (cons x aenv) hd = x
lookup {α} (cons x aenv) (tl {.α} {y} id) = lookup aenv id
liftEnv : ∀ {Γ Γ' Δ} → Γ ↝ Γ' → AEnv Γ Δ → AEnv Γ' Δ
liftEnv Γ↝Γ' [] = []
--liftEnv Γ↝Γ' (cons α x env) = cons α (lift α Γ↝Γ' x) (liftEnv Γ↝Γ' env)
liftEnv Γ↝Γ' (cons {α = α} x env) = cons {α = α} (lift α Γ↝Γ' x) (liftEnv Γ↝Γ' env)
consD : ∀ {Γ Δ} σ → AEnv Γ Δ → AEnv (σ ∷ Γ) (D σ ∷ Δ)
--consD σ env = (cons (D σ) (EVar hd) (liftEnv (↝-extend {τ = σ} ↝-refl) env))
consD σ env = (cons {α = D σ} (EVar hd) (liftEnv (↝-extend {τ = σ} ↝-refl) env))
----------------------------------------------
-- Helper for the evaluation of liftable terms
----------------------------------------------
mutual
lift' : ∀ {Γ α} → Liftable α → Imp Γ α → (Exp Γ (typeof α))
lift' (D τ) v = v
lift' AInt v = EInt v
lift' (ty ⊎ ty₁) (tl a) = Tl (lift' ty a)
lift' (ty ⊎ ty₁) (tr b) = Tr (lift' ty₁ b)
lift' (ty • ty₁) (ffst , ssnd) = lift' ty ffst , lift' ty₁ ssnd
lift' {Γ} (AFun {α₁} ty₁ ty₂) v = ELam
((λ x → lift' ty₂ (v (↝-extend {τ = typeof α₁} ↝-refl) x))
(embed ty₁ (EVar {Γ = typeof α₁ ∷ Γ} hd)))
embed : ∀ {Γ α} → Liftable⁻ α → Exp Γ (typeof α) → (Imp Γ α)
embed (D τ) e = e
-- embed (ty ⊎ ty₁) e = {! (ECase e (EVar hd) ?)!}
-- embed (ty ⊎ ty₁) (EVar x) = {!!}
-- embed (ty ⊎ ty₁) (EApp e e₁) = {!!}
-- embed (ty ⊎ ty₁) (Tl e) = tl (embed ty e)
-- embed (ty ⊎ ty₁) (Tr e) = tr (embed ty₁ e)
-- embed (ty ⊎ ty₁) (EFst e) = {!!}
-- embed (ty ⊎ ty₁) (ESnd e) = {!!}
-- embed (ty ⊎ ty₁) (ECase e e₁ e₂) = {!!}
embed (ty • ty₁) e = embed ty (EFst e) , embed ty₁ (ESnd e)
embed {Γ} (AFun {α} ty₁ ty₂) e =
λ Γ↝Γ' v₁ → embed ty₂ (EApp (liftE Γ↝Γ' e) (lift' ty₁ v₁))
--------------------
-- Partial Evaluator
--------------------
pe : ∀ {α Δ Γ} → AExp Δ α → AEnv Γ Δ → Imp Γ α
pe (Var x) env = lookup env x
pe (AInt x) env = x
pe (AAdd e e₁) env = pe e env + pe e₁ env
pe (ALam {α} e) env = λ Γ↝Γ' → λ y → pe e (cons {α = α} y (liftEnv Γ↝Γ' env))
pe (AApp e e₁) env = pe e env ↝-refl (pe e₁ env)
pe (DInt x) env = EInt x
pe (DAdd e e₁) env = EAdd (pe e env) (pe e₁ env)
pe (DLam {σ} e) env = ELam (pe e (consD σ env))
pe (DApp e e₁) env = EApp (pe e env) (pe e₁ env)
pe {Γ = Γ} (e , e₁) env = pe {Γ = Γ} e env , pe {Γ = Γ} e₁ env
pe {α = α₁ ⊎ α₂} {Γ = Γ} (Tl e) env = tl (pe {α = α₁} {Γ = Γ} e env)
pe {α = α₁ ⊎ α₂} {Γ = Γ} (Tr e) env = tr (pe {α = α₂} {Γ = Γ} e env)
pe {Γ = Γ} (Fst e) env = fst (pe {Γ = Γ} e env)
pe {Γ = Γ} (Snd e) env = snd (pe {Γ = Γ} e env)
pe {Γ = Γ} (Case e e₁ e₂) env with pe {Γ = Γ} e env
pe {Γ = Γ} (Case {α₁ = α} e e₁ e₂) env | tl y = (λ Γ↝Γ' → λ y → pe e₁ (cons {α = α} y (liftEnv Γ↝Γ' env))) ↝-refl y
pe {Γ = Γ} (Case {α₂ = α} e e₁ e₂) env | tr y = (λ Γ↝Γ' → λ y → pe e₂ (cons {α = α} y (liftEnv Γ↝Γ' env))) ↝-refl y
pe (e ḋ e₁) env = pe e env , pe e₁ env
pe (DTl e) env = Tl (pe e env)
pe (DTr e) env = Tr (pe e env)
pe (DFst e) env = EFst (pe e env)
pe (DSnd e) env = ESnd (pe e env)
pe (DCase {σ₁} {σ₂} e e₁ e₂) env = ECase (pe e env) (pe e₁ (consD σ₁ env)) (pe e₂ (consD σ₂ env))
pe (↑ x e) env = lift' x (pe e env)
-- Correctness proof
module Correctness where
open SimpleAEnv
open Exp-Eval
-- TODO: rename occurences of stripα to typeof
stripα = typeof
stripΔ : ACtx → Ctx
stripΔ = map stripα
strip-lookup : ∀ { α Δ} → α ∈ Δ → stripα α ∈ stripΔ Δ
strip-lookup hd = hd
strip-lookup (tl x) = tl (strip-lookup x)
strip : ∀ {α Δ} → AExp Δ α → Exp (stripΔ Δ) (stripα α)
strip (Var x) = EVar (strip-lookup x)
strip (AInt x) = EInt x
strip (AAdd e e₁) = EAdd (strip e) (strip e₁)
strip (ALam e) = ELam (strip e)
strip (AApp e e₁) = EApp (strip e) (strip e₁)
strip (DInt x) = EInt x
strip (DAdd e e₁) = EAdd (strip e) (strip e₁)
strip (DLam e) = ELam (strip e)
strip (DApp e e₁) = EApp (strip e) (strip e₁)
strip (e , e₁) = strip e , strip e₁
strip (Tl e) = Tl (strip e)
strip (Tr e) = Tr (strip e)
strip (Fst e) = EFst (strip e)
strip (Snd e) = ESnd (strip e)
strip (Case e e₁ e₂) = ECase (strip e) (strip e₁) (strip e₂)
strip (e ḋ e₁) = strip e , strip e₁
strip (DTl e) = Tl (strip e)
strip (DTr e) = Tr (strip e)
strip (DFst e) = EFst (strip e)
strip (DSnd e) = ESnd (strip e)
strip (DCase e e₁ e₂) = ECase (strip e) (strip e₁) (strip e₂)
strip (↑ x e) = strip e
--liftE : ∀ {τ Γ Γ'} → Γ ↝ Γ' → Exp Γ τ → Exp Γ' τ
--liftE Γ↝Γ' e = elevate (↝↝-base Γ↝Γ') e
stripLift : ∀ {α Δ Γ} → stripΔ Δ ↝ Γ → AExp Δ α → Exp Γ (stripα α)
stripLift Δ↝Γ = liftE Δ↝Γ ∘ strip
-- --------------------------------
-- --"lift-strip" equivalence lemma
-- --------------------------------
-- ↑≡↓ : ∀ x e env env' aenv → Equiv-Env env' aenv env → ev (lift' x (pe e aenv)) env' ≡ ev (strip e) env
-- ↑≡↓ x e env env' aenv eqenv = {!!}
-- We want to show that pe preserves the semantics of the
-- program. Roughly, Exp-Eval.ev-ing a stripped program is
-- equivalent to first pe-ing a program and then Exp-Eval.ev-ing the
-- result. But as the pe-result of a static function ``can do more''
-- than the (ev ∘ strip)ped function we need somthing more refined.
module Equiv where
open import Relation.Binary.PropositionalEquality
-- Extending a value environment according to an extension of a
-- type environment
data _⊢_↝_ {Γ} : ∀ {Γ'} → Γ ↝ Γ' → Env Γ → Env Γ' → Set where
refl : ∀ env → ↝-refl ⊢ env ↝ env
extend : ∀ {τ Γ' env env'} → {Γ↝Γ' : Γ ↝ Γ'} →
(v : EImp τ) → (Γ↝Γ' ⊢ env ↝ env') →
↝-extend Γ↝Γ' ⊢ env ↝ (v ∷ env')
env↝trans : ∀ {Γ Γ' Γ''} {Γ↝Γ' : Γ ↝ Γ'} {Γ'↝Γ'' : Γ' ↝ Γ''}
{env env' env''} →
Γ↝Γ' ⊢ env ↝ env' → Γ'↝Γ'' ⊢ env' ↝ env'' →
let Γ↝Γ'' = ↝-trans Γ↝Γ' Γ'↝Γ'' in
Γ↝Γ'' ⊢ env ↝ env''
env↝trans {Γ} {.Γ''} {Γ''} {Γ↝Γ'} {.↝-refl} {env} {.env''} {env''} env↝env' (refl .env'') = env↝env'
env↝trans env↝env' (extend v env'↝env'') = extend v (env↝trans env↝env' env'↝env'')
-- Equivalent Imp Γ α and EImp τ values (where τ = stripα α). As
-- (v : Imp Γ α) is not necessarily closed, equivalence is defined for
-- the closure (Env Γ, ImpΓ α)
Equiv : ∀ {α Γ} → Env Γ → Imp Γ α → EImp (stripα α) → Set
Equiv {AInt} env av v = av ≡ v
Equiv {AFun α₁ α₂} {Γ} env av v = ∀ {Γ' env' Γ↝Γ'} →
(Γ↝Γ' ⊢ env ↝ env') →
{av' : Imp Γ' α₁} →
{v' : EImp (stripα α₁)} →
Equiv env' av' v' → Equiv env' (av Γ↝Γ' av') (v v')
Equiv {D x} env av v = ev av env ≡ v
Equiv {α • α₁} env (ffst , ssnd) (ffst₁ , ssnd₁) = Equiv {α} env ffst ffst₁ ∧ Equiv {α₁} env ssnd ssnd₁
Equiv {α ⊎ α₁} env (tl a) (tl a₁) = Equiv {α} env a a₁
--------------------------------------------------------------------
Equiv {α ⊎ α₁} env (tl a) (tr b) = ⊥ -- Interesting case!
Equiv {α ⊎ α₁} env (tr b) (tl a) = ⊥ -- Interesting case!
--------------------------------------------------------------------
Equiv {α ⊎ α₁} env (tr b) (tr b₁) = Equiv {α₁} env b b₁
-- Equiv {AInt} env av v = av ≡ v
-- Equiv {AFun α₁ α₂} {Γ} env av v = -- extensional equality, given -- an extended context
-- ∀ {Γ' env' Γ↝Γ'} → (Γ↝Γ' ⊢ env ↝ env') →
-- {av' : Imp Γ' α₁} → {v' : EImp (stripα α₁)} →
-- Equiv env' av' v' → Equiv env' (av Γ↝Γ' av') (v v')
-- Equiv {D x} {Γ} env av v = ev av env ≡ v -- actually we mean extensional equality
-- TODO: Define a proper equivalence for EImps
-- Equivalence of AEnv and Env environments. They need to provide
-- Equivalent bindings for a context Δ/stripΔ Δ. Again, the
-- equivalence is defined for a closure (Env Γ', AEnv Γ' Δ).
data Equiv-Env {Γ' : _} (env' : Env Γ') :
∀ {Δ} → let Γ = stripΔ Δ in
AEnv Γ' Δ → Env Γ → Set where
[] : Equiv-Env env' [] []
cons : ∀ {α Δ} → let τ = stripα α
Γ = stripΔ Δ in
{env : Env Γ} → {aenv : AEnv Γ' Δ} →
Equiv-Env env' aenv env →
(va : Imp (Γ') α) → (v : EImp τ) →
Equiv env' va v →
--Equiv-Env env' (cons α va (aenv)) (v ∷ env)
Equiv-Env env' (cons {α = α} va (aenv)) (v ∷ env)
--------------------------------
--"lift-strip" equivalence lemma
--------------------------------
-- ↑≡↓ : ∀ {Γ' Δ α} x e env env' aenv → Equiv-Env {Γ'} env' {Δ} aenv env → ev (lift' {Γ = Γ'} {α = α} x (pe e aenv)) env' ≡ ev (strip e) env
-- ↑≡↓ x e env env' aenv eqenv = {!!}
-- Now for the proof...
module Proof where
open Equiv
open import Relation.Binary.PropositionalEquality
-- Extensional equality as an axiom to prove the Equivalence of
-- function values. We could (should?) define it locally for
-- Equiv.
postulate ext : ∀ {τ₁ τ₂} {f g : EImp τ₁ → EImp τ₂} →
(∀ x → f x ≡ g x) → f ≡ g
-- Ternary helper relation for environment extensions, analogous to _↝_↝_ for contexts
data _⊢_↝_↝_⊣ : ∀ { Γ Γ' Γ''} → Γ ↝ Γ' ↝ Γ'' → Env Γ → Env Γ' → Env Γ'' → Set where
refl : ∀ {Γ Γ''} {Γ↝Γ'' : Γ ↝ Γ''} { env env'' } →
Γ↝Γ'' ⊢ env ↝ env'' →
↝↝-base Γ↝Γ'' ⊢ env ↝ [] ↝ env'' ⊣
extend : ∀ {Γ Γ' Γ'' τ} {Γ↝Γ'↝Γ'' : Γ ↝ Γ' ↝ Γ''} { env env' env'' } →
Γ↝Γ'↝Γ'' ⊢ env ↝ env' ↝ env'' ⊣ →
(v : EImp τ) → ↝↝-extend Γ↝Γ'↝Γ'' ⊢ (v ∷ env) ↝ (v ∷ env') ↝ (v ∷ env'') ⊣
-- the following lemmas are strong versions of the shifting
-- functions, proving that consistent variable renaming preserves
-- equivalence (and not just typing).
lookup-elevate-≡ : ∀ {τ Γ Γ'} {Γ↝Γ' : Γ ↝ Γ'}
{env : Env Γ} {env' : Env Γ'} →
Γ↝Γ' ⊢ env ↝ env' →
(x : τ ∈ Γ) → lookupE x env ≡ lookupE (elevate-var Γ↝Γ' x) env'
lookup-elevate-≡ {τ} {.Γ'} {Γ'} {.↝-refl} {.env'} {env'} (refl .env') x = refl
lookup-elevate-≡ (extend v env↝env') x = lookup-elevate-≡ env↝env' x
lookup-elevate2-≡ : ∀ {τ Γ Γ' Γ''} {Γ↝Γ'↝Γ'' : Γ ↝ Γ' ↝ Γ''}
{env : Env Γ} {env' : Env Γ'} {env'' : Env Γ''} →
Γ↝Γ'↝Γ'' ⊢ env ↝ env' ↝ env'' ⊣ →
(x : τ ∈ Γ) → lookupE x env ≡ lookupE (elevate-var2 Γ↝Γ'↝Γ'' x) env''
lookup-elevate2-≡ (refl Γ↝Γ') x = lookup-elevate-≡ Γ↝Γ' x
lookup-elevate2-≡ (extend env↝env'↝env'' v) hd = refl
lookup-elevate2-≡ (extend env↝env'↝env'' _) (tl x)
rewrite lookup-elevate2-≡ env↝env'↝env'' x = refl
lem-elevate-≡ : ∀ {τ Γ Γ' Γ''}
{Γ↝Γ'↝Γ'' : Γ ↝ Γ' ↝ Γ''}
{env : Env Γ} {env' : Env Γ'} {env'' : Env Γ''} →
Γ↝Γ'↝Γ'' ⊢ env ↝ env' ↝ env'' ⊣ →
(e : Exp Γ τ) →
ev e env ≡ ev (elevate Γ↝Γ'↝Γ'' e) env''
lem-elevate-≡ env↝env' (EVar x) = lookup-elevate2-≡ env↝env' x
lem-elevate-≡ env↝env' (EInt x) = refl
lem-elevate-≡ env↝env' (EAdd e e₁) with lem-elevate-≡ env↝env' e | lem-elevate-≡ env↝env' e₁
... | IA1 | IA2 = cong₂ _+_ IA1 IA2
lem-elevate-≡ {Γ↝Γ'↝Γ'' = Γ↝Γ'↝Γ''}
{env = env}
{env'' = env''}
env↝env' (ELam e) = ext lem-elevate-≡-body
where lem-elevate-≡-body : ∀ x → ev e (x ∷ env) ≡ ev (elevate (↝↝-extend Γ↝Γ'↝Γ'') e) (x ∷ env'')
lem-elevate-≡-body x = lem-elevate-≡ (extend env↝env' x) e
lem-elevate-≡ env↝env' (EApp e e₁) with lem-elevate-≡ env↝env' e | lem-elevate-≡ env↝env' e₁
... | IA1 | IA2 = cong₂ (λ f₁ x → f₁ x) IA1 IA2
lem-elevate-≡ env↝env' (e , e₁) with lem-elevate-≡ env↝env' e | lem-elevate-≡ env↝env' e₁
... | IA1 | IA2 = cong₂ (λ x y → x , y) IA1 IA2
lem-elevate-≡ env↝env' (Tl e) with lem-elevate-≡ env↝env' e
... | IA = cong (λ x → tl x) IA
lem-elevate-≡ env↝env' (Tr e) with lem-elevate-≡ env↝env' e
... | IA = cong (λ x → tr x) IA
lem-elevate-≡ env↝env' (EFst e) with lem-elevate-≡ env↝env' e
... | IA = cong (λ x → fst x) IA
lem-elevate-≡ env↝env' (ESnd e) with lem-elevate-≡ env↝env' e
... | IA = cong (λ x → snd x) IA
lem-elevate-≡ {Γ↝Γ'↝Γ'' = Γ↝Γ'↝Γ''}
{env = env}
{env'' = env''}
env↝env' (ECase e e₁ e₂) with ev e env | ev (elevate Γ↝Γ'↝Γ'' e) env'' | lem-elevate-≡ env↝env' e
... | tl c | tl c' | IA rewrite (→tl {x' = c} {y' = c'} (tl c) (tl c') IA refl refl) = lem-elevate-≡-body c'
where lem-elevate-≡-body : ∀ x → ev e₁ (x ∷ env) ≡ ev (elevate (↝↝-extend Γ↝Γ'↝Γ'') e₁) (x ∷ env'')
lem-elevate-≡-body x = lem-elevate-≡ (extend env↝env' x) e₁
... | tl c | tr c' | ()
... | tr c | tl c' | ()
... | tr c | tr c' | IA rewrite (→tr {x' = c} {y' = c'} (tr c) (tr c') IA refl refl) = lem-elevate-≡-body c'
where lem-elevate-≡-body : ∀ x → ev e₂ (x ∷ env) ≡ ev (elevate (↝↝-extend Γ↝Γ'↝Γ'') e₂) (x ∷ env'')
lem-elevate-≡-body x = lem-elevate-≡ (extend env↝env' x) e₂
lem-lift-refl-id : ∀ {α Γ} → let τ = stripα α in
(env : Env Γ) →
(v : EImp τ) (va : Imp Γ α) →
Equiv env va v →
Equiv env (lift α ↝-refl va) v
lem-lift-refl-id {AInt} env v va eq = eq
lem-lift-refl-id {AFun α α₁} {Γ} env v va eq = body
where body : ∀ {Γ'} {env' : Env Γ'} {Γ↝Γ' : Γ ↝ Γ'} →
Γ↝Γ' ⊢ env ↝ env' →
{av' : Imp Γ' α} {v' : EImp (stripα α)} →
Equiv env' av' v' → Equiv env' (va (↝-trans ↝-refl Γ↝Γ') av') (v v')
body {Γ↝Γ' = Γ↝Γ'} env↝env' eq' rewrite sym (lem-↝-refl-id Γ↝Γ') = eq env↝env' eq'
lem-lift-refl-id {D x} env v va eq rewrite sym eq = sym (lem-elevate-≡ (refl (refl env)) va)
lem-lift-refl-id {α • α₁} env (ffst , ssnd) (ffst₁ , ssnd₁) (∧-intro x x₁) = ∧-intro (lem-lift-refl-id {α} env ffst ffst₁ x)
(lem-lift-refl-id {α₁} env ssnd ssnd₁ x₁)
lem-lift-refl-id {α ⊎ α₁} env (tl a) (tl a₁) eq = lem-lift-refl-id env a a₁ eq
lem-lift-refl-id {α ⊎ α₁} env (tl a) (tr b) ()
lem-lift-refl-id {α ⊎ α₁} env (tr b) (tl a) ()
lem-lift-refl-id {α ⊎ α₁} env (tr b) (tr b₁) eq = lem-lift-refl-id env b b₁ eq
-- lifting an Imp does not affect equivalence
lem-lift-equiv : ∀ {α Γ Γ'} → let τ = stripα α in
{Γ↝Γ' : Γ ↝ Γ'} →
(va : Imp Γ α) (v : EImp τ) →
{env : Env Γ} {env' : Env Γ'} →
Γ↝Γ' ⊢ env ↝ env' →
Equiv env va v →
Equiv env' (lift α Γ↝Γ' va) v
lem-lift-equiv va v {.env'} {env'} (refl .env') eq = lem-lift-refl-id env' v va eq
lem-lift-equiv {AInt} va v (extend v₁ env↝env') eq = eq
lem-lift-equiv {AFun α α₁} va v (extend v₁ env↝env') eq =
λ v₁env₁↝env' eq₁ → eq (env↝trans (extend v₁ env↝env') v₁env₁↝env') eq₁
lem-lift-equiv {D x} va v (extend v₁ env↝env') eq rewrite sym eq = sym (lem-elevate-≡ (refl (extend v₁ env↝env')) va)
lem-lift-equiv {α • α₁} (ffst , ssnd) (ffst₁ , ssnd₁) (extend v₁ env↝env') (∧-intro x x₁) =
∧-intro (lem-lift-equiv {α} ffst ffst₁ (extend v₁ env↝env') x) (lem-lift-equiv {α₁} ssnd ssnd₁ (extend v₁ env↝env') x₁)
lem-lift-equiv {α ⊎ α₁} (tl a) (tl a₁) (extend v₁ env↝env') eq = lem-lift-equiv a a₁ (extend v₁ env↝env') eq
lem-lift-equiv {α ⊎ α₁} (tl a) (tr b) (extend v₁ env↝env') ()
lem-lift-equiv {α ⊎ α₁} (tr b) (tl a) (extend v₁ env↝env') ()
lem-lift-equiv {α ⊎ α₁} (tr b) (tr b₁) (extend v₁ env↝env') eq = lem-lift-equiv b b₁ (extend v₁ env↝env') eq
lem-equiv-lookup : ∀ {α Δ Γ'} → let Γ = stripΔ Δ in
{ aenv : AEnv Γ' Δ } {env : Env Γ} →
(env' : Env Γ') →
Equiv-Env env' aenv env →
∀ x → Equiv {α} env' (lookup aenv x) (lookupE (strip-lookup x) env)
lem-equiv-lookup env' [] ()
lem-equiv-lookup env' (cons enveq va v eq) hd = eq
lem-equiv-lookup env' (cons enveq va v eq) (tl x) = lem-equiv-lookup env' enveq x
lem-equiv-env-lift-extend :
∀ {σ Γ' Δ} (env' : Env Γ') → let Γ = stripΔ Δ in
{env : Env Γ} {aenv : AEnv Γ' Δ} →
Equiv-Env env' aenv env → (x : EImp σ) →
Equiv-Env (x ∷ env') (liftEnv (↝-extend ↝-refl) aenv) env
lem-equiv-env-lift-extend _ [] x = []
lem-equiv-env-lift-extend env' (cons {α} eqenv va v x) x₁ =
cons (lem-equiv-env-lift-extend env' eqenv x₁)
(lift α (↝-extend ↝-refl) va) v (lem-lift-equiv va v (extend x₁ (refl env')) x)
lem-equiv-env-lift-lift :
∀ {Γ' Γ'' Δ} → let Γ = stripΔ Δ in
{Γ↝Γ' : Γ' ↝ Γ''}
{env' : Env Γ'} {env'' : Env Γ''}
(env'↝env'' : Γ↝Γ' ⊢ env' ↝ env'') →
{env : Env Γ} {aenv : AEnv Γ' Δ} →
Equiv-Env env' aenv env →
Equiv-Env env'' (liftEnv Γ↝Γ' aenv) env
lem-equiv-env-lift-lift env'↝env'' [] = []
lem-equiv-env-lift-lift {Γ↝Γ' = Γ↝Γ'} env'↝env'' (cons {α} eqenv va v x)
with lem-equiv-env-lift-lift env'↝env'' eqenv
... | IA = cons IA (lift α Γ↝Γ' va) v (lem-lift-equiv va v env'↝env'' x)
--------------------------------
--"lift-correct" equivalence lemma
--------------------------------
open import Data.Product
mutual
lift-correct : ∀ {Γ α} (lft : Liftable α) (env : Env Γ) (av : Imp Γ α) (v : EImp (typeof α)) →
Equiv env av v → (Equiv env (lift' lft av) v)
lift-correct (D τ) env av v eq = eq
lift-correct AInt env av v eq = eq
lift-correct (lft ⊎ lft₁) env (tl a) (tl a₁) eq with lift-correct lft env a a₁
... | IA rewrite IA eq = refl
lift-correct (lft ⊎ lft₁) env (tr b) (tl a) ()
lift-correct (lft ⊎ lft₁) env (tl a) (tr b) ()
lift-correct (lft ⊎ lft₁) env (tr b) (tr b₁) eq with lift-correct lft₁ env b b₁
... | IA rewrite IA eq = refl
lift-correct (lft • lft₁) env (ffst , ssnd) (ffst₁ , ssnd₁) (∧-intro x x₁)
rewrite lift-correct lft env ffst ffst₁ x | lift-correct lft₁ env ssnd ssnd₁ x₁ = refl
lift-correct (AFun x lft) env av v eq =
ext (λ x₁ →
lift-correct lft (x₁ ∷ env)
(av (↝-extend ↝-refl) (embed x (EVar hd))) (v x₁) (eq (extend x₁ (refl env)) (embed-correct x (x₁ ∷ env) (EVar hd) x₁ refl)))
embed-correct : ∀ {Γ α} (lft : Liftable⁻ α) (env : Env Γ) → (e : Exp Γ (typeof α)) → (v : EImp (typeof α)) →
ev e env ≡ v → Equiv env (embed lft e) v
embed-correct (D τ) env e v eq rewrite eq = refl
embed-correct (lft • lft₁) env e (fstv , sndv) eq = ∧-intro (embed-correct lft env (EFst e) fstv (subst (λ x → ffst x ≡ fstv) (sym eq) refl))
(embed-correct lft₁ env (ESnd e) sndv
(subst (λ x → ssnd x ≡ sndv) (sym eq) refl))
embed-correct {α = AFun α₁ α₂} (AFun x lft) env e v eq = f
where
f : ∀ {Γ' env' Γ↝Γ'} (x₁ : Γ↝Γ' ⊢ env ↝ env') {x₂ : Imp Γ' α₁} {x₃ : EImp (typeof α₁)}
(x₄ : Equiv env' x₂ x₃) →
Equiv env'
(embed lft (EApp (elevate (↝↝-base Γ↝Γ') e) (lift' x x₂))) (v x₃)
f {Γ'} {env'} {Γext} envext {av'} {v'} eq' =
embed-correct lft env' (EApp (elevate (↝↝-base Γext) e) (lift' x av')) (v v')
g
where g : ev (elevate (↝↝-base Γext) e) env' (ev (lift' x av') env') ≡ v v'
g rewrite lift-correct x env' av' v' eq'
| sym (cong (λ f → f v') (lem-elevate-≡ (refl envext) e))
| (cong (λ f → f v') eq) = refl
---------------------------------------
--Correctness proof with liftable terms
---------------------------------------
-- When we partially evaluate somthing under an environment , it
-- will give equivalent results to a ``complete'' evaluation under
-- an equivalent environment
pe-correct : ∀ { α Δ Γ' } → (e : AExp Δ α) →
let Γ = stripΔ Δ in
{aenv : AEnv Γ' Δ} → {env : Env Γ} →
(env' : Env Γ') →
Equiv-Env env' aenv env →
Equiv env' (pe e aenv) (ev (strip e) env)
pe-correct (Var x) env' eqenv = lem-equiv-lookup env' eqenv x
pe-correct (AInt x) env' eqenv = refl
pe-correct (AAdd e e₁) env' eqenv
rewrite pe-correct e env' eqenv | pe-correct e₁ env' eqenv = refl
pe-correct (ALam e) env' eqenv =
λ {_} {env''} env'↝env'' {av'} {v'} eq →
let eqenv' : _
eqenv' = lem-equiv-env-lift-lift env'↝env'' eqenv
eqenv'' : _
eqenv'' = cons eqenv' av' v' eq
in pe-correct e env'' eqenv''
pe-correct (AApp e e₁) env' eqenv
with pe-correct e env' eqenv | pe-correct e₁ env' eqenv
... | IAe | IAf = IAe (refl env') IAf
pe-correct (DInt x) env' eqenv = refl
pe-correct (DAdd e e₁) env' eqenv
rewrite pe-correct e env' eqenv | pe-correct e₁ env' eqenv = refl
pe-correct (DLam e) env' eqenv =
ext
(λ x →
let eqenv₁ : _
eqenv₁ = lem-equiv-env-lift-extend env' eqenv x
eqenv₂ : _
eqenv₂ = cons eqenv₁ (EVar hd) x refl
in pe-correct e (x ∷ env') eqenv₂)
pe-correct (DApp e e₁) env' eqenv
with pe-correct e₁ env' eqenv | pe-correct e env' eqenv
... | IA' | IA = cong₂ (λ f x → f x) IA IA'
pe-correct (e , e₁) env' eqenv = ∧-intro (pe-correct e env' eqenv) (pe-correct e₁ env' eqenv)
pe-correct (Tl e) env' eqenv = pe-correct e env' eqenv
pe-correct (Tr e) env' eqenv = pe-correct e env' eqenv
pe-correct (Fst (e , e₁)) env' eqenv = pe-correct e env' eqenv
pe-correct (Fst e) {aenv = aenv} {env = env} env' eqenv with pe e aenv | ev (strip e) env | pe-correct e env' eqenv
... | e₁ , e₂ | e₁' , e₂' | ∧-intro A B = A
pe-correct (Snd (e , e₁)) env' eqenv = pe-correct e₁ env' eqenv
pe-correct (Snd e) {aenv = aenv} {env = env} env' eqenv with pe e aenv | ev (strip e) env | pe-correct e env' eqenv
... | e₁ , e₂ | e₁' , e₂' | ∧-intro A B = B
pe-correct {α} (Case e e₁ e₂) {aenv = aenv} {env = env} env' eqenv with pe e aenv | ev (strip e) env | pe-correct e env' eqenv
... | tl c | tl c' | L = pe-correct e₁ {aenv = cons c (liftEnv ↝-refl aenv)}
{env = c' ∷ env} env'
(cons (lem-equiv-env-lift-lift (refl env') eqenv) c c' L)
... | tr c | tr c' | R = pe-correct e₂ {aenv = cons c (liftEnv ↝-refl aenv)}
{env = c' ∷ env} env'
(cons (lem-equiv-env-lift-lift (refl env') eqenv) c c' R)
... | tr c | tl c' | ()
... | tl c | tr c' | ()
pe-correct (e ḋ e₁) env' eqenv with pe-correct e env' eqenv | pe-correct e₁ env' eqenv
... | IA | IA' rewrite IA | IA' = refl
pe-correct (DTl e) env' eqenv with pe-correct e env' eqenv
... | IA rewrite IA = refl
pe-correct (DTr e) env' eqenv with pe-correct e env' eqenv
... | IA rewrite IA = refl
pe-correct (DFst e) env' eqenv with pe-correct e env' eqenv
... | IA rewrite IA = refl
pe-correct (DSnd e) env' eqenv with pe-correct e env' eqenv
... | IA rewrite IA = refl
pe-correct (DCase e e₁ e₂) {aenv = aenv} {env = env} env' eqenv with ev (pe e aenv) env' | ev (strip e) env | pe-correct e env' eqenv
... | tl c | tl c' | IA rewrite (→tl {x' = c} {y' = c'} (tl c) (tl c') IA refl refl) =
pe-correct e₁
{aenv = cons (EVar hd) (liftEnv (↝-extend ↝-refl) aenv)}
{env = c' ∷ env} (c' ∷ env') (cons (lem-equiv-env-lift-lift (extend c' (refl env')) eqenv) (EVar hd) c' refl)
... | tr c | tr c' | IA rewrite (→tr {x' = c} {y' = c'} (tr c) (tr c') IA refl refl) =
pe-correct e₂
{aenv = cons (EVar hd) (liftEnv (↝-extend ↝-refl) aenv)}
{env = c' ∷ env} (c' ∷ env')
(cons (lem-equiv-env-lift-lift (extend c' (refl env')) eqenv)
(EVar hd) c' refl)
... | tl c | tr c' | ()
... | tr c | tl c' | ()
pe-correct (↑ x e) {aenv = aenv} {env = env} env' eqenv
with pe-correct e env' eqenv
... | IA = lift-correct x env' (pe e aenv) (ev (strip e) env) IA
| 44.475104
| 149
| 0.515581
|
1b4bde6a241f8f98f571c54e921ebf12a8ccd178
| 207
|
agda
|
Agda
|
Naturals.agda
|
Smaug123/CubicalTutorial
|
3d56e649152d2cd906281943860ca19da1d1f344
|
[
"MIT"
] | 3
|
2020-04-26T17:02:42.000Z
|
2021-01-16T23:14:13.000Z
|
Naturals.agda
|
Smaug123/CubicalTutorial
|
3d56e649152d2cd906281943860ca19da1d1f344
|
[
"MIT"
] | null | null | null |
Naturals.agda
|
Smaug123/CubicalTutorial
|
3d56e649152d2cd906281943860ca19da1d1f344
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --safe --warning=error --without-K #-}
module Naturals where
data ℕ : Set where
zero : ℕ
succ : ℕ → ℕ
{-# BUILTIN NATURAL ℕ #-}
_+N_ : ℕ → ℕ → ℕ
zero +N b = b
succ a +N b = succ (a +N b)
| 14.785714
| 50
| 0.560386
|
36a8494bb9ea1d5f81fbba9dcfb1a4acf566e3d6
| 1,020
|
agda
|
Agda
|
src/Categories/Diagram/Colimit/Properties.agda
|
jaykru/agda-categories
|
a4053cf700bcefdf73b857c3352f1eae29382a60
|
[
"MIT"
] | 279
|
2019-06-01T14:36:40.000Z
|
2022-03-22T00:40:14.000Z
|
src/Categories/Diagram/Colimit/Properties.agda
|
seanpm2001/agda-categories
|
d9e4f578b126313058d105c61707d8c8ae987fa8
|
[
"MIT"
] | 236
|
2019-06-01T14:53:54.000Z
|
2022-03-28T14:31:43.000Z
|
src/Categories/Diagram/Colimit/Properties.agda
|
seanpm2001/agda-categories
|
d9e4f578b126313058d105c61707d8c8ae987fa8
|
[
"MIT"
] | 64
|
2019-06-02T16:58:15.000Z
|
2022-03-14T02:00:59.000Z
|
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
open import Categories.Functor hiding (id)
module Categories.Diagram.Colimit.Properties
{o ℓ e} {o′ ℓ′ e′} {C : Category o ℓ e} {J : Category o′ ℓ′ e′} (F : Functor J C) where
private
module F = Functor F
module C = Category C
open C
open import Categories.Diagram.Limit F.op
open import Categories.Diagram.Colimit F
open import Categories.Category.Construction.Cocones F
open import Categories.Diagram.Duality C
module _ (X : Obj) (coapex₁ : Coapex X) (coapex₂ : Coapex X) (L : Colimit) where
private
module coapex₁ = Coapex coapex₁
module coapex₂ = Coapex coapex₂
module L = Colimit L
K₁ : Cocone
K₁ = record { coapex = coapex₁ }
module K₁ = Cocone K₁
K₂ : Cocone
K₂ = record { coapex = coapex₂ }
module K₂ = Cocone K₂
coψ-≈⇒rep-≈ : (∀ A → coapex₁.ψ A ≈ coapex₂.ψ A) → L.rep K₁ ≈ L.rep K₂
coψ-≈⇒rep-≈ = ψ-≈⇒rep-≈ X (Coapex⇒coApex X coapex₁) (Coapex⇒coApex X coapex₂) (Colimit⇒coLimit L)
| 29.142857
| 99
| 0.668627
|
3558758de83b501783aebdf96e80c1101c20bf1c
| 9,656
|
agda
|
Agda
|
src/fot/LTC-PCF/Program/GCD/Partial/ConversionRules.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 11
|
2015-09-03T20:53:42.000Z
|
2021-09-12T16:09:54.000Z
|
src/fot/LTC-PCF/Program/GCD/Partial/ConversionRules.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 2
|
2016-10-12T17:28:16.000Z
|
2017-01-01T14:34:26.000Z
|
src/fot/LTC-PCF/Program/GCD/Partial/ConversionRules.agda
|
asr/fotc
|
2fc9f2b81052a2e0822669f02036c5750371b72d
|
[
"MIT"
] | 3
|
2016-09-19T14:18:30.000Z
|
2018-03-14T08:50:00.000Z
|
------------------------------------------------------------------------------
-- Conversion rules for the greatest common divisor
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module LTC-PCF.Program.GCD.Partial.ConversionRules where
open import Common.FOL.Relation.Binary.EqReasoning
open import LTC-PCF.Base
open import LTC-PCF.Data.Nat
open import LTC-PCF.Data.Nat.Inequalities
open import LTC-PCF.Data.Nat.Inequalities.Properties
open import LTC-PCF.Loop
open import LTC-PCF.Program.GCD.Partial.GCD
------------------------------------------------------------------------------
private
-- Before to prove some properties for the gcd it is convenient to
-- descompose the behavior of the function step by step.
-- Initially, we define the possible states (gcd-s₁, gcd-s₂,
-- ...). Then we write down the proof for the execution step from
-- the state p to the state q, e.g.
--
-- proof₂₋₃ : ∀ m n → gcd-s₂ m n → gcd-s₃ m n.
-- The functions gcd-00, gcd-S0, gcd-0S, gcd-Sm>Sn and gcd-Sm≯Sn
-- show the use of the states gcd-s₁, gcd-s₂, ..., and the proofs
-- associated with the execution steps.
----------------------------------------------------------------------------
-- The steps
-- Initially, the conversion rule fix-eq is applied.
gcd-s₁ : D → D → D
gcd-s₁ m n = gcdh (fix gcdh) · m · n
-- First argument application.
gcd-s₂ : D → D
gcd-s₂ m = lam (λ n →
if (iszero₁ n)
then (if (iszero₁ m) then error else m)
else (if (iszero₁ m)
then n
else (if (gt m n)
then fix gcdh · (m ∸ n) · n
else fix gcdh · m · (n ∸ m))))
-- Second argument application.
gcd-s₃ : D → D → D
gcd-s₃ m n = if (iszero₁ n)
then (if (iszero₁ m) then error else m)
else (if (iszero₁ m)
then n
else (if (gt m n)
then fix gcdh · (m ∸ n) · n
else fix gcdh · m · (n ∸ m)))
-- First if_then_else_ iszero₁ n = b.
gcd-s₄ : D → D → D → D
gcd-s₄ m n b = if b
then (if (iszero₁ m) then error else m)
else (if (iszero₁ m)
then n
else (if (gt m n)
then fix gcdh · (m ∸ n) · n
else fix gcdh · m · (n ∸ m)))
-- First if_then_else_ when if true ...
gcd-s₅ : D → D
gcd-s₅ m = if (iszero₁ m) then error else m
-- First if_then_else_ when if false ...
gcd-s₆ : D → D → D
gcd-s₆ m n = if (iszero₁ m)
then n
else (if (gt m n)
then fix gcdh · (m ∸ n) · n
else fix gcdh · m · (n ∸ m))
-- Second if_then_else_ iszero₁ m = b.
gcd-s₇ : D → D → D
gcd-s₇ m b = if b then error else m
-- Third if_then_else_ iszero₁ m = b.
gcd-s₈ : D → D → D → D
gcd-s₈ m n b = if b
then n
else (if (gt m n)
then fix gcdh · (m ∸ n) · n
else fix gcdh · m · (n ∸ m))
-- Third if_then_else_ when if false ...
gcd-s₉ : D → D → D
gcd-s₉ m n = if (gt m n)
then fix gcdh · (m ∸ n) · n
else fix gcdh · m · (n ∸ m)
-- Fourth if_then_else_ gt m n = b.
gcd-s₁₀ : D → D → D → D
gcd-s₁₀ m n b = if b then fix gcdh · (m ∸ n) · n else fix gcdh · m · (n ∸ m)
----------------------------------------------------------------------------
-- Congruence properties
gcd-s₁₀Cong₃ : ∀ {m n b b'} → b ≡ b' → gcd-s₁₀ m n b ≡ gcd-s₁₀ m n b'
gcd-s₁₀Cong₃ refl = refl
----------------------------------------------------------------------------
-- The execution steps
{-
To prove the execution steps, e.g.
proof₃₋₄ : ∀ m n → gcd-s₃ m n → gcd_s₄ m n,
we usually need to prove that
C [m] ≡ C [n] (1)
given that
m ≡ n, (2)
where (2) is a conversion rule usually.
We prove (1) using
subst : ∀ {x y} (D : A → Set) → x ≡ y → P x → P y
where
• P is given by λ m → C [m ] ≡ C [n],
• x ≡ y is given n ≡ m (actually, we use sym (m ≡ n)) and
• P x is given by C [n] ≡ C [n] (i.e. refl).
-}
proof₀₋₁ : ∀ m n → fix gcdh · m · n ≡ gcd-s₁ m n
proof₀₋₁ m n = subst (λ x → x · m · n ≡ gcdh (fix gcdh) · m · n)
(sym (fix-eq gcdh))
refl
proof₁₋₂ : ∀ m n → gcd-s₁ m n ≡ gcd-s₂ m · n
proof₁₋₂ m n = subst (λ x → x · n ≡ gcd-s₂ m · n)
(sym (beta gcd-s₂ m))
refl
proof₂₋₃ : ∀ m n → gcd-s₂ m · n ≡ gcd-s₃ m n
proof₂₋₃ m n = beta (gcd-s₃ m) n
-- 25 April 2014. Failed with Andreas' --without-K.
proof₃₋₄ : ∀ m n b → iszero₁ n ≡ b → gcd-s₃ m n ≡ gcd-s₄ m n b
proof₃₋₄ m n .(iszero₁ n) refl = refl
proof₄₋₅ : ∀ m n → gcd-s₄ m n true ≡ gcd-s₅ m
proof₄₋₅ m _ = if-true (gcd-s₅ m)
proof₄₋₆ : ∀ m n → gcd-s₄ m n false ≡ gcd-s₆ m n
proof₄₋₆ m n = if-false (gcd-s₆ m n)
proof₅₋₇ : ∀ m b → iszero₁ m ≡ b → gcd-s₅ m ≡ gcd-s₇ m b
proof₅₋₇ m .(iszero₁ m) refl = refl
proof₆₋₈ : ∀ m n b → iszero₁ m ≡ b → gcd-s₆ m n ≡ gcd-s₈ m n b
proof₆₋₈ m n .(iszero₁ m) refl = refl
proof₇₊ : ∀ m → gcd-s₇ m true ≡ error
proof₇₊ _ = if-true error
proof₇₋ : ∀ m → gcd-s₇ m false ≡ m
proof₇₋ m = if-false m
proof₈₊ : ∀ m n → gcd-s₈ m n true ≡ n
proof₈₊ _ n = if-true n
proof₈₋₉ : ∀ m n → gcd-s₈ m n false ≡ gcd-s₉ m n
proof₈₋₉ m n = if-false (gcd-s₉ m n)
proof₉₋₁₀ : ∀ m n b → gt m n ≡ b → gcd-s₉ m n ≡ gcd-s₁₀ m n b
proof₉₋₁₀ m n b = gcd-s₁₀Cong₃
proof₁₀₊ : ∀ m n → gcd-s₁₀ m n true ≡ fix gcdh · (m ∸ n) · n
proof₁₀₊ m n = if-true (fix gcdh · (m ∸ n) · n)
proof₁₀₋ : ∀ m n → gcd-s₁₀ m n false ≡ fix gcdh · m · (n ∸ m)
proof₁₀₋ m n = if-false (fix gcdh · m · (n ∸ m))
------------------------------------------------------------------------------
-- The five equations for gcd
-- First equation.
--
-- We do not use this equation for reasoning about gcd.
gcd-00 : gcd zero zero ≡ error
gcd-00 =
gcd zero zero ≡⟨ proof₀₋₁ zero zero ⟩
gcd-s₁ zero zero ≡⟨ proof₁₋₂ zero zero ⟩
gcd-s₂ zero · zero ≡⟨ proof₂₋₃ zero zero ⟩
gcd-s₃ zero zero ≡⟨ proof₃₋₄ zero zero true iszero-0 ⟩
gcd-s₄ zero zero true ≡⟨ proof₄₋₅ zero zero ⟩
gcd-s₅ zero ≡⟨ proof₅₋₇ zero true iszero-0 ⟩
gcd-s₇ zero true ≡⟨ proof₇₊ zero ⟩
error ∎
-- Second equation.
gcd-S0 : ∀ n → gcd (succ₁ n) zero ≡ succ₁ n
gcd-S0 n =
gcd (succ₁ n) zero ≡⟨ proof₀₋₁ (succ₁ n) zero ⟩
gcd-s₁ (succ₁ n) zero ≡⟨ proof₁₋₂ (succ₁ n) zero ⟩
gcd-s₂ (succ₁ n) · zero ≡⟨ proof₂₋₃ (succ₁ n) zero ⟩
gcd-s₃ (succ₁ n) zero ≡⟨ proof₃₋₄ (succ₁ n) zero true iszero-0 ⟩
gcd-s₄ (succ₁ n) zero true ≡⟨ proof₄₋₅ (succ₁ n) zero ⟩
gcd-s₅ (succ₁ n) ≡⟨ proof₅₋₇ (succ₁ n) false (iszero-S n) ⟩
gcd-s₇ (succ₁ n) false ≡⟨ proof₇₋ (succ₁ n) ⟩
succ₁ n ∎
-- Third equation.
gcd-0S : ∀ n → gcd zero (succ₁ n) ≡ succ₁ n
gcd-0S n =
gcd zero (succ₁ n) ≡⟨ proof₀₋₁ zero (succ₁ n) ⟩
gcd-s₁ zero (succ₁ n) ≡⟨ proof₁₋₂ zero (succ₁ n) ⟩
gcd-s₂ zero · (succ₁ n) ≡⟨ proof₂₋₃ zero (succ₁ n) ⟩
gcd-s₃ zero (succ₁ n) ≡⟨ proof₃₋₄ zero (succ₁ n) false (iszero-S n) ⟩
gcd-s₄ zero (succ₁ n) false ≡⟨ proof₄₋₆ zero (succ₁ n) ⟩
gcd-s₆ zero (succ₁ n) ≡⟨ proof₆₋₈ zero (succ₁ n) true iszero-0 ⟩
gcd-s₈ zero (succ₁ n) true ≡⟨ proof₈₊ zero (succ₁ n) ⟩
succ₁ n ∎
-- Fourth equation.
gcd-S>S : ∀ m n → succ₁ m > succ₁ n →
gcd (succ₁ m) (succ₁ n) ≡ gcd (succ₁ m ∸ succ₁ n) (succ₁ n)
gcd-S>S m n Sm>Sn =
gcd (succ₁ m) (succ₁ n)
≡⟨ proof₀₋₁ (succ₁ m) (succ₁ n) ⟩
gcd-s₁ (succ₁ m) (succ₁ n)
≡⟨ proof₁₋₂ (succ₁ m) (succ₁ n) ⟩
gcd-s₂ (succ₁ m) · (succ₁ n)
≡⟨ proof₂₋₃ (succ₁ m) (succ₁ n) ⟩
gcd-s₃ (succ₁ m) (succ₁ n)
≡⟨ proof₃₋₄ (succ₁ m) (succ₁ n) false (iszero-S n) ⟩
gcd-s₄ (succ₁ m) (succ₁ n) false
≡⟨ proof₄₋₆ (succ₁ m) (succ₁ n) ⟩
gcd-s₆ (succ₁ m) (succ₁ n)
≡⟨ proof₆₋₈ (succ₁ m) (succ₁ n) false (iszero-S m) ⟩
gcd-s₈ (succ₁ m) (succ₁ n) false
≡⟨ proof₈₋₉ (succ₁ m) (succ₁ n) ⟩
gcd-s₉ (succ₁ m) (succ₁ n)
≡⟨ proof₉₋₁₀ (succ₁ m) (succ₁ n) true Sm>Sn ⟩
gcd-s₁₀ (succ₁ m) (succ₁ n) true
≡⟨ proof₁₀₊ (succ₁ m) (succ₁ n) ⟩
fix gcdh · (succ₁ m ∸ succ₁ n) · succ₁ n ∎
-- Fifth equation.
gcd-S≯S : ∀ m n → succ₁ m ≯ succ₁ n →
gcd (succ₁ m) (succ₁ n) ≡ gcd (succ₁ m) (succ₁ n ∸ succ₁ m)
gcd-S≯S m n Sm≯Sn =
gcd (succ₁ m) (succ₁ n)
≡⟨ proof₀₋₁ (succ₁ m) (succ₁ n) ⟩
gcd-s₁ (succ₁ m) (succ₁ n)
≡⟨ proof₁₋₂ (succ₁ m) (succ₁ n) ⟩
gcd-s₂ (succ₁ m) · (succ₁ n)
≡⟨ proof₂₋₃ (succ₁ m) (succ₁ n) ⟩
gcd-s₃ (succ₁ m) (succ₁ n)
≡⟨ proof₃₋₄ (succ₁ m) (succ₁ n) false (iszero-S n) ⟩
gcd-s₄ (succ₁ m) (succ₁ n) false
≡⟨ proof₄₋₆ (succ₁ m) (succ₁ n) ⟩
gcd-s₆ (succ₁ m) (succ₁ n)
≡⟨ proof₆₋₈ (succ₁ m) (succ₁ n) false (iszero-S m) ⟩
gcd-s₈ (succ₁ m) (succ₁ n) false
≡⟨ proof₈₋₉ (succ₁ m) (succ₁ n) ⟩
gcd-s₉ (succ₁ m) (succ₁ n)
≡⟨ proof₉₋₁₀ (succ₁ m) (succ₁ n) false Sm≯Sn ⟩
gcd-s₁₀ (succ₁ m) (succ₁ n) false
≡⟨ proof₁₀₋ (succ₁ m) (succ₁ n) ⟩
fix gcdh · succ₁ m · (succ₁ n ∸ succ₁ m) ∎
| 34.362989
| 78
| 0.485708
|
73578d7b0fbb9a52d3c9c47e4f2930cbe560d300
| 2,745
|
agda
|
Agda
|
agda-stdlib-0.9/src/Data/Fin/Subset.agda
|
qwe2/try-agda
|
9d4c43b1609d3f085636376fdca73093481ab882
|
[
"Apache-2.0"
] | 1
|
2016-10-20T15:52:05.000Z
|
2016-10-20T15:52:05.000Z
|
agda-stdlib-0.9/src/Data/Fin/Subset.agda
|
qwe2/try-agda
|
9d4c43b1609d3f085636376fdca73093481ab882
|
[
"Apache-2.0"
] | null | null | null |
agda-stdlib-0.9/src/Data/Fin/Subset.agda
|
qwe2/try-agda
|
9d4c43b1609d3f085636376fdca73093481ab882
|
[
"Apache-2.0"
] | null | null | null |
------------------------------------------------------------------------
-- The Agda standard library
--
-- Subsets of finite sets
------------------------------------------------------------------------
module Data.Fin.Subset where
open import Algebra
import Algebra.Properties.BooleanAlgebra as BoolAlgProp
import Algebra.Properties.BooleanAlgebra.Expression as BAExpr
import Data.Bool.Properties as BoolProp
open import Data.Fin
open import Data.List as List using (List)
open import Data.Nat
open import Data.Product
open import Data.Vec using (Vec; _∷_; _[_]=_)
import Relation.Binary.Vec.Pointwise as Pointwise
open import Relation.Nullary
infix 4 _∈_ _∉_ _⊆_ _⊈_
------------------------------------------------------------------------
-- Definitions
-- Sides.
open import Data.Bool public
using () renaming (Bool to Side; true to inside; false to outside)
-- Partitions a finite set into two parts, the inside and the outside.
Subset : ℕ → Set
Subset = Vec Side
------------------------------------------------------------------------
-- Membership and subset predicates
_∈_ : ∀ {n} → Fin n → Subset n → Set
x ∈ p = p [ x ]= inside
_∉_ : ∀ {n} → Fin n → Subset n → Set
x ∉ p = ¬ (x ∈ p)
_⊆_ : ∀ {n} → Subset n → Subset n → Set
p₁ ⊆ p₂ = ∀ {x} → x ∈ p₁ → x ∈ p₂
_⊈_ : ∀ {n} → Subset n → Subset n → Set
p₁ ⊈ p₂ = ¬ (p₁ ⊆ p₂)
------------------------------------------------------------------------
-- Set operations
-- Pointwise lifting of the usual boolean algebra for booleans gives
-- us a boolean algebra for subsets.
--
-- The underlying equality of the returned boolean algebra is
-- propositional equality.
booleanAlgebra : ℕ → BooleanAlgebra _ _
booleanAlgebra n =
BoolAlgProp.replace-equality
(BAExpr.lift BoolProp.booleanAlgebra n)
Pointwise.Pointwise-≡
private
open module BA {n} = BooleanAlgebra (booleanAlgebra n) public
using
( ⊥ -- The empty subset.
; ⊤ -- The subset containing all elements.
)
renaming
( _∨_ to _∪_ -- Binary union.
; _∧_ to _∩_ -- Binary intersection.
; ¬_ to ∁ -- Complement.
)
-- A singleton subset, containing just the given element.
⁅_⁆ : ∀ {n} → Fin n → Subset n
⁅ zero ⁆ = inside ∷ ⊥
⁅ suc i ⁆ = outside ∷ ⁅ i ⁆
-- N-ary union.
⋃ : ∀ {n} → List (Subset n) → Subset n
⋃ = List.foldr _∪_ ⊥
-- N-ary intersection.
⋂ : ∀ {n} → List (Subset n) → Subset n
⋂ = List.foldr _∩_ ⊤
------------------------------------------------------------------------
-- Properties
Nonempty : ∀ {n} (p : Subset n) → Set
Nonempty p = ∃ λ f → f ∈ p
Empty : ∀ {n} (p : Subset n) → Set
Empty p = ¬ Nonempty p
-- Point-wise lifting of properties.
Lift : ∀ {n} → (Fin n → Set) → (Subset n → Set)
Lift P p = ∀ {x} → x ∈ p → P x
| 25.654206
| 72
| 0.539162
|
117ab25f63014c9dc44a615d1e32d6866ce01181
| 17,431
|
agda
|
Agda
|
test/Compiler/simple/Floats.agda
|
LaloHao/agda
|
7de768bb7bc65dbe1efa35c699cfa8b8f9510573
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Compiler/simple/Floats.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Compiler/simple/Floats.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
module _ where
open import Common.IO
renaming (then to _>>_
)
open import Agda.Builtin.Unit
open import Agda.Builtin.Bool
open import Agda.Builtin.Equality using (_≡_; refl)
open import Agda.Builtin.Float
renaming ( primFloatEquality to _≡ᵇ_
; primFloatInequality to _≤ᵇ_
; primFloatLess to _<ᵇ_
; primFloatPlus to infixl 6 _+_
; primFloatMinus to infixl 6 _-_
; primFloatTimes to infixl 7 _*_
; primFloatDiv to infixl 7 _÷_
; primFloatPow to infix 8 _**_
; primFloatNegate to infix 9 -_
; primFloatSqrt to sqrt
; primFloatExp to e^_
; primFloatLog to log
; primFloatSin to sin
; primFloatCos to cos
; primFloatTan to tan
; primFloatASin to asin
; primFloatACos to acos
; primFloatATan to atan
; primFloatATan2 to atan2
; primFloatSinh to sinh
; primFloatCosh to cosh
; primFloatTanh to tanh
; primFloatASinh to asinh
; primFloatACosh to acosh
; primFloatATanh to atanh
; primFloatRound to round
; primFloatFloor to floor
; primFloatCeiling to ceiling
; primShowFloat to showF
; primFloatToWord64 to toWord
; primFloatToRatio to toRatio
; primRatioToFloat to fromRatio
; primFloatDecode to decode
; primFloatEncode to encode
; primFloatIsInfinite to isInfinite
; primFloatIsNaN to isNaN
; primFloatIsNegativeZero to isNegativeZero
; primFloatIsSafeInteger to isSafeInteger
)
open import Agda.Builtin.Int
using (Int; pos; negsuc)
renaming ( primShowInteger to showI
)
open import Agda.Builtin.Nat
using (Nat)
renaming ( _==_ to _==N_
)
open import Agda.Builtin.Maybe
open import Agda.Builtin.Sigma
open import Agda.Builtin.String
using (String)
renaming ( primStringEquality to _==S_
; primShowNat to showN
; primStringAppend to _++_
)
open import Agda.Builtin.Word
using (Word64)
renaming ( primWord64ToNat to toℕ
)
-- Prelude
data ⊥ : Set where
_≢_ : {A : Set} (P Q : A) → Set
P ≢ Q = P ≡ Q → ⊥
NaN : Float
NaN = 0.0 ÷ 0.0
-NaN : Float
-NaN = - NaN
Infinity : Float
Infinity = 1.0 ÷ 0.0
-Infinity : Float
-Infinity = - Infinity
MaxFloat : Float
MaxFloat = 1.7976931348623157e308
MinFloat : Float
MinFloat = 2.2250738585072014e-308
MaxSafeIntF : Float
MaxSafeIntF = 9007199254740991.0
MaxSafeIntZ : Int
MaxSafeIntZ = pos 9007199254740991
-- * Tests
showB : Bool → String
showB false = "false"
showB true = "true"
maybeShow : {A : Set} (show : A → String) → Maybe A → String
maybeShow show (just x) = "(just (" ++ (show x ++ "))")
maybeShow show nothing = "nothing"
pairShow : {A B : Set} (showA : A → String) (showB : B → String) → Σ A (λ _ → B) → String
pairShow showA showB (x , y) = "(" ++ (showA x ++ (" , " ++ (showB y ++ ")")))
showR = pairShow showI showI
newline : IO ⊤
newline = putStr "\n"
T : Bool → Set
T false = ⊥
T true = ⊤
_==F_ : Float → Float → Bool
x ==F y = toℕ (toWord x) ==N toℕ (toWord x)
_==B_ : Bool → Bool → Bool
false ==B false = true
false ==B true = false
true ==B false = false
true ==B true = true
_==I_ : Int → Int → Bool
pos n ==I pos m = n ==N m
pos n ==I negsuc m = false
negsuc n ==I pos m = false
negsuc n ==I negsuc m = n ==N m
maybeEq : {A : Set} (eq : A → A → Bool) → Maybe A → Maybe A → Bool
maybeEq eq (just x) (just y) = eq x y
maybeEq eq (just x) nothing = false
maybeEq eq nothing (just y) = false
maybeEq eq nothing nothing = true
pairEq : {A B : Set} (eqA : A → A → Bool) (eqB : B → B → Bool) → Σ A (λ _ → B) → Σ A (λ _ → B) → Bool
pairEq eqA eqB (x , y) (z , w) = eqA x z && eqB y w
where
_&&_ : Bool → Bool → Bool
true && true = true
x && y = false
_==R_ = pairEq _==I_ _==I_
check : {A : Set} (show : A → String) (eq : A → A → Bool) (str : String) (exp act : A) {p : T (eq act exp)} → IO ⊤
check show eq str exp act = do
putStr str; putStr " = "; putStr (show exp); putStr " = "; putStr (show act); newline
checkB = check showB _==B_
checkS = check (λ x → x) _==S_
checkN = check showN _==N_
checkI = check showI _==I_
checkMI = check (maybeShow showI) (maybeEq _==I_)
checkR = check showR _==R_
checkF = check showF _==F_
checkMR = check (maybeShow showR) (maybeEq _==R_)
checkMF = check (maybeShow showF) (maybeEq _==F_)
-- ** Relations
main : IO ⊤
main = do
-- ** Relations
checkB " NaN ≡ᵇ NaN " false ( NaN ≡ᵇ NaN )
checkB "-NaN ≡ᵇ NaN " false (-NaN ≡ᵇ NaN )
checkB " NaN ≡ᵇ -NaN " false ( NaN ≡ᵇ -NaN )
checkB "-NaN ≡ᵇ -NaN " false (-NaN ≡ᵇ -NaN )
checkB " Infinity ≡ᵇ Infinity" true ( Infinity ≡ᵇ Infinity)
checkB "-Infinity ≡ᵇ Infinity" false (-Infinity ≡ᵇ Infinity)
checkB " Infinity ≡ᵇ -Infinity" false ( Infinity ≡ᵇ -Infinity)
checkB "-Infinity ≡ᵇ -Infinity" true (-Infinity ≡ᵇ -Infinity)
checkB " MaxFloat ≡ᵇ MaxFloat" true ( MaxFloat ≡ᵇ MaxFloat)
checkB " MinFloat ≡ᵇ MinFloat" true ( MinFloat ≡ᵇ MinFloat)
checkB " 1.0 ≡ᵇ 1.5 " false ( 1.0 ≡ᵇ 1.5 )
checkB " 1.0 ≡ᵇ 1.0 " true ( 1.0 ≡ᵇ 1.0 )
checkB " 1.5 ≡ᵇ 1.5 " true ( 1.5 ≡ᵇ 1.5 )
checkB " NaN ≤ᵇ NaN " false ( NaN ≤ᵇ NaN )
checkB "-NaN ≤ᵇ NaN " false (-NaN ≤ᵇ NaN )
checkB " NaN ≤ᵇ -NaN " false ( NaN ≤ᵇ -NaN )
checkB "-NaN ≤ᵇ -NaN " false (-NaN ≤ᵇ -NaN )
checkB " NaN ≤ᵇ 5.0 " false ( NaN ≤ᵇ 5.0 )
checkB "-NaN ≤ᵇ 5.0 " false (-NaN ≤ᵇ 5.0 )
checkB " 5.0 ≤ᵇ -NaN " false ( 5.0 ≤ᵇ -NaN )
checkB "-5.0 ≤ᵇ -NaN " false (-5.0 ≤ᵇ -NaN )
checkB " NaN ≤ᵇ Infinity" false ( NaN ≤ᵇ Infinity)
checkB "-NaN ≤ᵇ Infinity" false (-NaN ≤ᵇ Infinity)
checkB " Infinity ≤ᵇ -NaN " false ( Infinity ≤ᵇ -NaN )
checkB "-Infinity ≤ᵇ -NaN " false (-Infinity ≤ᵇ -NaN )
checkB " Infinity ≤ᵇ Infinity" true ( Infinity ≤ᵇ Infinity)
checkB "-Infinity ≤ᵇ Infinity" true (-Infinity ≤ᵇ Infinity)
checkB " Infinity ≤ᵇ -Infinity" false ( Infinity ≤ᵇ -Infinity)
checkB "-Infinity ≤ᵇ -Infinity" true (-Infinity ≤ᵇ -Infinity)
checkB " MaxFloat ≤ᵇ MaxFloat" true ( MaxFloat ≤ᵇ MaxFloat)
checkB " MinFloat ≤ᵇ MinFloat" true ( MinFloat ≤ᵇ MinFloat)
checkB " 1.0 ≤ᵇ 1.5 " true ( 1.0 ≤ᵇ 1.5 )
checkB " 1.0 ≤ᵇ 1.0 " true ( 1.0 ≤ᵇ 1.0 )
checkB " 1.5 ≤ᵇ 1.5 " true ( 1.5 ≤ᵇ 1.5 )
checkB " NaN <ᵇ NaN " false ( NaN <ᵇ NaN )
checkB "-NaN <ᵇ NaN " false (-NaN <ᵇ NaN )
checkB " NaN <ᵇ -NaN " false ( NaN <ᵇ -NaN )
checkB "-NaN <ᵇ -NaN " false (-NaN <ᵇ -NaN )
checkB " NaN <ᵇ 5.0 " false ( NaN <ᵇ 5.0 )
checkB "-NaN <ᵇ 5.0 " false (-NaN <ᵇ 5.0 )
checkB " 5.0 <ᵇ -NaN " false ( 5.0 <ᵇ -NaN )
checkB "-5.0 <ᵇ -NaN " false (-5.0 <ᵇ -NaN )
checkB " NaN <ᵇ Infinity" false ( NaN <ᵇ Infinity)
checkB "-NaN <ᵇ Infinity" false (-NaN <ᵇ Infinity)
checkB " Infinity <ᵇ -NaN " false ( Infinity <ᵇ -NaN )
checkB "-Infinity <ᵇ -NaN " false (-Infinity <ᵇ -NaN )
checkB " Infinity <ᵇ Infinity" false ( Infinity <ᵇ Infinity)
checkB "-Infinity <ᵇ Infinity" true (-Infinity <ᵇ Infinity)
checkB " Infinity <ᵇ -Infinity" false ( Infinity <ᵇ -Infinity)
checkB "-Infinity <ᵇ -Infinity" false (-Infinity <ᵇ -Infinity)
checkB " MaxFloat <ᵇ MaxFloat" false ( MaxFloat <ᵇ MaxFloat)
checkB " MinFloat <ᵇ MinFloat" false ( MinFloat <ᵇ MinFloat)
checkB " 1.0 <ᵇ 1.5 " true ( 1.0 <ᵇ 1.5 )
checkB " 1.0 <ᵇ 1.0 " false ( 1.0 <ᵇ 1.0 )
checkB " 1.5 <ᵇ 1.5 " false ( 1.5 <ᵇ 1.5 )
checkB "isNaN NaN " true (isNaN NaN )
checkB "isNaN -NaN " true (isNaN -NaN )
checkB "isNaN Infinity " false (isNaN Infinity )
checkB "isNaN -Infinity " false (isNaN -Infinity )
checkB "isNaN 0.0 " false (isNaN 0.0 )
checkB "isNaN -0.0 " false (isNaN -0.0 )
checkB "isNaN 1.0 " false (isNaN 1.0 )
checkB "isNaN 1.5 " false (isNaN 1.5 )
checkB "isInfinite NaN " false (isInfinite NaN )
checkB "isInfinite -NaN " false (isInfinite -NaN )
checkB "isInfinite Infinity " true (isInfinite Infinity )
checkB "isInfinite -Infinity " true (isInfinite -Infinity )
checkB "isInfinite 0.0 " false (isInfinite 0.0 )
checkB "isInfinite -0.0 " false (isInfinite -0.0 )
checkB "isInfinite 1.0 " false (isInfinite 1.0 )
checkB "isInfinite 1.5 " false (isInfinite 1.5 )
-- Depends on optimisation settings:
--
-- - with -O0 the test succeeds
-- - with -O the test fails
--
-- checkB "isInfinite ((MaxFloat * MaxFloat) ÷ MaxFloat)"
-- true
-- (isInfinite ((MaxFloat * MaxFloat) ÷ MaxFloat))
checkB "isNegativeZero NaN " false (isNegativeZero NaN )
checkB "isNegativeZero -NaN " false (isNegativeZero -NaN )
checkB "isNegativeZero Infinity " false (isNegativeZero Infinity )
checkB "isNegativeZero -Infinity " false (isNegativeZero -Infinity )
checkB "isNegativeZero 0.0 " false (isNegativeZero 0.0 )
checkB "isNegativeZero -0.0 " true (isNegativeZero -0.0 )
checkB "isNegativeZero 1.0 " false (isNegativeZero 1.0 )
checkB "isNegativeZero 1.5 " false (isNegativeZero 1.5 )
checkB "isSafeInteger 1.0 " true (isSafeInteger 1.0 )
checkB "isSafeInteger 1.5 " false (isSafeInteger 1.5 )
checkB "isSafeInteger MaxFloat " false (isSafeInteger MaxFloat )
checkB "isSafeInteger MinFloat " false (isSafeInteger MinFloat )
checkB "isSafeInteger MaxSafeIntF " true (isSafeInteger MaxSafeIntF )
-- ** Conversions
checkS "show NaN " "NaN" (showF NaN )
checkS "show -NaN " "NaN" (showF -NaN )
checkS "show 0.0 " "0.0" (showF 0.0 )
checkS "show -0.0 " "-0.0" (showF -0.0 )
checkS "show Infinity" "Infinity" (showF Infinity)
checkS "show -Infinity" "-Infinity" (showF -Infinity)
checkS "show 1.0 " "1.0" (showF 1.0 )
checkS "show 1.5 " "1.5" (showF 1.5 )
-- Breaks the JavaScript backend, on account of it being... too big:
--
-- checkN "toℕ (toWord 1.0) " 4607182418800017408 (toℕ (toWord 1.0) )
-- checkN "toℕ (toWord 1.5) " 4609434218613702656 (toℕ (toWord 1.5) )
-- checkN "toℕ (toWord 0.0) " 0 (toℕ (toWord 0.0) )
-- checkN "toℕ (toWord -0.0) " 9223372036854775808 (toℕ (toWord -0.0) )
-- checkN "toℕ (toWord NaN) " 18444492273895866368 (toℕ (toWord NaN) )
-- checkN "toℕ (toWord -NaN) " 18444492273895866368 (toℕ (toWord -NaN) )
-- checkN "toℕ (toWord Infinity) " 9218868437227405312 (toℕ (toWord Infinity) )
-- checkN "toℕ (toWord -Infinity)" 18442240474082181120 (toℕ (toWord -Infinity))
checkMI "round 1.0 " (just (pos 1)) (round 1.0 )
checkMI "round 1.5 " (just (pos 2)) (round 1.5 )
checkMI "round NaN " (nothing ) (round NaN )
checkMI "round -NaN " (nothing ) (round -NaN )
checkMI "round Infinity " (nothing ) (round Infinity )
checkMI "round -Infinity" (nothing ) (round -Infinity)
checkMI "round MinFloat " (just (pos 0)) (round MinFloat )
--
-- Breaks the JavaScript backend, on account of it being... too big:
--
-- checkMI "round MaxFloat " (just (pos 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368)) (round MaxFloat )
checkMI "floor 1.0 " (just (pos 1)) (floor 1.0 )
checkMI "floor 1.5 " (just (pos 1)) (floor 1.5 )
checkMI "floor NaN " (nothing ) (floor NaN )
checkMI "floor -NaN " (nothing ) (floor -NaN )
checkMI "floor Infinity " (nothing ) (floor Infinity )
checkMI "floor -Infinity" (nothing ) (floor -Infinity)
checkMI "floor MinFloat " (just (pos 0)) (floor MinFloat )
--
-- Breaks the JavaScript backend, on account of it being... too big:
--
-- checkMI "floor MaxFloat " (just (pos 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368)) (floor MaxFloat )
checkMI "ceiling 1.0 " (just (pos 1)) (ceiling 1.0 )
checkMI "ceiling 1.5 " (just (pos 2)) (ceiling 1.5 )
checkMI "ceiling NaN " (nothing ) (ceiling NaN )
checkMI "ceiling -NaN " (nothing ) (ceiling -NaN )
checkMI "ceiling Infinity " (nothing ) (ceiling Infinity )
checkMI "ceiling -Infinity" (nothing ) (ceiling -Infinity)
checkMI "ceiling MinFloat " (just (pos 1)) (ceiling MinFloat )
--
-- Breaks the JavaScript backend, on account of it being... too big:
--
-- checkMI "ceiling MaxFloat " (just (pos 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368)) (ceiling MaxFloat )
checkMR "decode NaN " (nothing ) (decode NaN )
checkMR "decode Infinity" (nothing ) (decode Infinity)
checkMR "decode -Infinity" (nothing ) (decode -Infinity)
checkMR "decode 1.0 " (just (pos 1 , pos 0)) (decode 1.0 )
checkMR "decode 1.5 " (just (pos 3 , negsuc 0)) (decode 1.5 )
checkMR "decode MinFloat" (just (pos 1 , negsuc 1021)) (decode MinFloat)
--
-- Breaks the JavaScript backend, on account of it being... too big:
--
-- checkMR "decode MaxFloat" (just (MaxSafeIntZ , pos 971)) (decode MaxFloat)
checkMF "encode (pos 1) (pos 0)" (just 1.0 ) (encode (pos 1) (pos 0))
checkMF "encode (pos 3) (negsuc 0)" (just 1.5 ) (encode (pos 3) (negsuc 0))
--
-- Breaks the JavaScript backend, on account of it being... too big:
--
-- checkMF "encode MaxSafeIntZ (pos 0)" (just MaxSafeIntF) (encode MaxSafeIntZ (pos 0))
-- checkMF "encode MaxSafeIntZ (pos 971)" (just MaxFloat ) (encode MaxSafeIntZ (pos 971))
-- checkMF "encode MaxSafeIntZ (pos 972)" (nothing ) (encode MaxSafeIntZ (pos 972))
-- checkMF "encode (pos 1) (negsuc 1021)" (just MinFloat ) (encode (pos 1) (negsuc 1021))
-- checkMF "encode MaxSafeIntZ (negsuc 1075)" (nothing ) (encode MaxSafeIntZ (negsuc 1075))
checkR "toRatio NaN " (pos 0 , pos 0) (toRatio NaN )
checkR "toRatio Infinity" (pos 1 , pos 0) (toRatio Infinity)
checkR "toRatio -Infinity" (negsuc 0 , pos 0) (toRatio -Infinity)
checkR "toRatio 1.0 " (pos 1 , pos 1) (toRatio 1.0 )
checkR "toRatio 1.5 " (pos 3 , pos 2) (toRatio 1.5 )
checkF "fromRatio (pos 0) (pos 0)" ( NaN ) (fromRatio (pos 0) (pos 0))
checkF "fromRatio (pos 1) (pos 0)" ( Infinity) (fromRatio (pos 1) (pos 0))
checkF "fromRatio (negsuc 0) (pos 0)" (-Infinity) (fromRatio (negsuc 0) (pos 0))
checkF "fromRatio (pos 1) (pos 1)" ( 1.0 ) (fromRatio (pos 1) (pos 1))
checkF "fromRatio (pos 3) (pos 2)" ( 1.5 ) (fromRatio (pos 3) (pos 2))
checkF "e^ 1.0 " 2.718281828459045 (e^ 1.0 )
checkF "sin (asin 0.6) " 0.6 (sin (asin 0.6) )
checkF "cos (acos 0.6) " 0.6 (cos (acos 0.6) )
checkF "tan (atan 0.4) " 0.4 (tan (atan 0.4) )
checkF "tan (atan2 0.4 1.0)" 0.4 (tan (atan2 0.4 1.0))
| 47.366848
| 375
| 0.560266
|
3f8f1534b1b0059942b4105c5fe509afad3c1903
| 396
|
agda
|
Agda
|
lib/types/Empty.agda
|
sattlerc/HoTT-Agda
|
c8fb8da3354fc9e0c430ac14160161759b4c5b37
|
[
"MIT"
] | null | null | null |
lib/types/Empty.agda
|
sattlerc/HoTT-Agda
|
c8fb8da3354fc9e0c430ac14160161759b4c5b37
|
[
"MIT"
] | null | null | null |
lib/types/Empty.agda
|
sattlerc/HoTT-Agda
|
c8fb8da3354fc9e0c430ac14160161759b4c5b37
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --without-K #-}
open import lib.Basics
module lib.types.Empty where
⊥ = Empty
⊥-elim : ∀ {i} {A : ⊥ → Type i} → ((x : ⊥) → A x)
⊥-elim = Empty-elim
Empty-rec : ∀ {i} {A : Type i} → (Empty → A)
Empty-rec = Empty-elim
⊥-rec : ∀ {i} {A : Type i} → (⊥ → A)
⊥-rec = Empty-rec
Empty-is-prop : is-prop Empty
Empty-is-prop = Empty-elim
⊥-is-prop : is-prop ⊥
⊥-is-prop = Empty-is-prop
| 17.217391
| 49
| 0.558081
|
7c14a20154c85f0ce738953ff7016e1ede9beeb9
| 193
|
agda
|
Agda
|
test/Succeed/Issue3362.agda
|
mdimjasevic/agda
|
8fb548356b275c7a1e79b768b64511ae937c738b
|
[
"BSD-3-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Succeed/Issue3362.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Succeed/Issue3362.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
postulate
A : Set
P : A → Set
variable
x : A
y : P x
data D₁ {x : A} : P x → Set where
z : D₁ y
s : D₁ y → D₁ y
data D₂ : {x : A} → P x → Set where
z : D₂ y
s : D₂ y → D₂ y
| 11.352941
| 35
| 0.46114
|
1483060a245f294efdf80d345c16b468f5315e19
| 135
|
agda
|
Agda
|
README.agda
|
guilhermehas/Equality
|
e1104012d85d2072318656f6c6d31acff75c9460
|
[
"MIT"
] | 1
|
2021-10-01T06:04:21.000Z
|
2021-10-01T06:04:21.000Z
|
README.agda
|
guilhermehas/Equality
|
e1104012d85d2072318656f6c6d31acff75c9460
|
[
"MIT"
] | null | null | null |
README.agda
|
guilhermehas/Equality
|
e1104012d85d2072318656f6c6d31acff75c9460
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --cubical --cumulativity #-}
open import leibniz public
open import equalities public
open import leibniz-equality public
| 22.5
| 40
| 0.785185
|
1368240b5bedd3bce83c91d3fb154582558f6b39
| 722
|
agda
|
Agda
|
theorems/groups/Image.agda
|
AntoineAllioux/HoTT-Agda
|
1037d82edcf29b620677a311dcfd4fc2ade2faa6
|
[
"MIT"
] | 294
|
2015-01-09T16:23:23.000Z
|
2022-03-20T13:54:45.000Z
|
theorems/groups/Image.agda
|
AntoineAllioux/HoTT-Agda
|
1037d82edcf29b620677a311dcfd4fc2ade2faa6
|
[
"MIT"
] | 31
|
2015-03-05T20:09:00.000Z
|
2021-10-03T19:15:25.000Z
|
theorems/groups/Image.agda
|
AntoineAllioux/HoTT-Agda
|
1037d82edcf29b620677a311dcfd4fc2ade2faa6
|
[
"MIT"
] | 50
|
2015-01-10T01:48:08.000Z
|
2022-02-14T03:03:25.000Z
|
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
module groups.Image where
module _ {i j k} {G : Group i} {H : Group j}
{K : Group k} (φ : H →ᴳ K) (ψ : G →ᴳ H) where
abstract
im-sub-im-∘ : is-surjᴳ ψ → im-propᴳ φ ⊆ᴳ im-propᴳ (φ ∘ᴳ ψ)
im-sub-im-∘ ψ-is-surj k = Trunc-rec
(λ{(h , φh=k) → Trunc-rec
(λ{(g , ψg=h) → [ g , ap (GroupHom.f φ) ψg=h ∙ φh=k ]})
(ψ-is-surj h)})
im-∘-sub-im : im-propᴳ (φ ∘ᴳ ψ) ⊆ᴳ im-propᴳ φ
im-∘-sub-im k = Trunc-rec
(λ{(g , φψg=k) → [ GroupHom.f ψ g , φψg=k ]})
im-iso-im-pre∘ : is-surjᴳ ψ → Im φ ≃ᴳ Im (φ ∘ᴳ ψ)
im-iso-im-pre∘ ψ-is-surj = Subgroup-emap-r
(im-propᴳ φ) (im-propᴳ (φ ∘ᴳ ψ))
(im-sub-im-∘ ψ-is-surj) im-∘-sub-im
| 28.88
| 63
| 0.51662
|
fd9e4c7b74a0e4396f0e1cc5bcfdca246269121f
| 4,846
|
agda
|
Agda
|
examples/GUIgeneric/GUIFeaturesPart5.agda
|
stephanadls/state-dependent-gui
|
2bc84cb14a568b560acb546c440cbe0ddcbb2a01
|
[
"MIT"
] | 2
|
2020-07-31T15:37:39.000Z
|
2020-07-31T17:20:59.000Z
|
examples/GUIgeneric/GUIFeaturesPart5.agda
|
stephanadls/state-dependent-gui
|
2bc84cb14a568b560acb546c440cbe0ddcbb2a01
|
[
"MIT"
] | null | null | null |
examples/GUIgeneric/GUIFeaturesPart5.agda
|
stephanadls/state-dependent-gui
|
2bc84cb14a568b560acb546c440cbe0ddcbb2a01
|
[
"MIT"
] | null | null | null |
-- {-# OPTIONS --allow-unsolved-metas #-}
module GUIgeneric.GUIFeaturesPart5 where
open import GUIgeneric.Prelude renaming (addButton to addButton')
open import GUIgeneric.GUIDefinitions renaming (add to add'; add' to add)
open import GUIgeneric.GUI
open import GUIgeneric.GUIExampleLib
open import StateSizedIO.GUI.WxGraphicsLibLevel3 renaming (addButton to addButton')
open import GUIgeneric.GUIFeatures
open import GUIgeneric.GUIFeaturesPart2 hiding ( main ; main1 )
open import GUIgeneric.GUIFeaturesPart3 hiding ( main ; Tea ; Cancel)
open import GUIgeneric.GUIFeaturesPart4 hiding ( main ; cancelNewStateSM ; cancelStateAdded ; cancelFeatureAdded )
open import GUIgeneric.GUIExample hiding (main )
data StatesBasicVM : Set where
pay change soda serveSoda open' close : StatesBasicVM
basicVM : FMachine StatesBasicVM
basicVM .Features = ⊤
basicVM .AddStateF = ⊥
basicVM .GUIF f (inj₁ pay) =
simpleSMState "Pay" (inj₁ change)
basicVM .GUIF f (inj₁ change) =
simpleSMState "Get Change" (inj₁ soda)
basicVM .GUIF f (inj₁ soda) =
simpleSMState "Soda" (inj₁ serveSoda)
basicVM .GUIF f (inj₁ serveSoda) =
simpleSMState "Serve Soda" (inj₁ open')
basicVM .GUIF f (inj₁ open') =
simpleSMState "Open" (inj₁ close)
basicVM .GUIF f (inj₁ close) =
simpleSMState "Close" (inj₁ pay)
basicVM .GUIF f (inj₂ ())
newState : {A B : Set} → A ⊎ B ⊎ ⊤
newState = (inj₂ (inj₂ tt))
{- handler for the new state to be added to the tea machine -}
teaNewStateSM : (fm : FMachine StatesBasicVM)
→ SMachineState
(StatesBasicVM ⊎ fm .AddStateF ⊎ ⊤)
newState
teaNewStateSM fm = simpleSMState "Serve Tea" (inj₁ open')
{- add the new state to the feature machine -}
TeaMAddNewState : FMachine StatesBasicVM
→ FMachine StatesBasicVM
TeaMAddNewState fm =
addOneStateFMachine fm (teaNewStateSM fm)
{- add a dummy feature "FeatureTea" to the feature machine -}
TeaMAddFeature : FMachine StatesBasicVM
→ FMachine StatesBasicVM
TeaMAddFeature fm = addDummyFeatures
(TeaMAddNewState fm)
FeatureTea
{- redefine in the feature machine one button -}
Tea : FMachine StatesBasicVM
→ FMachine StatesBasicVM
Tea fm .Features = TeaMAddFeature fm .Features
Tea fm .AddStateF = TeaMAddFeature fm .AddStateF
Tea fm .GUIF (f , yesTea) (inj₁ soda) =
addBtn2StateMachine
( TeaMAddFeature fm .GUIF
(f , yesTea) (inj₁ soda))
"Tea" newState
Tea fm .GUIF f s = TeaMAddFeature fm .GUIF f s
{- handler for the new state to be added to the cancel machine -}
cancelNewStateSM : (fm : FMachine StatesBasicVM) →
SMachineState (StatesBasicVM ⊎ fm .AddStateF ⊎ ⊤) newState
cancelNewStateSM fm = simpleSMState "Cancelling" (inj₁ pay)
{- add the state to the old feature machine -}
cancelStateAdded : FMachine StatesBasicVM → FMachine StatesBasicVM
cancelStateAdded fm = addOneStateFMachine fm (cancelNewStateSM fm)
{- add a dummy feature "FeatureCancel" to the feature machine -}
cancelFeatureAdded : FMachine StatesBasicVM → FMachine StatesBasicVM
cancelFeatureAdded fm = addDummyFeatures
(cancelStateAdded fm)
FeatureCancel
{- redefine in the feature machine one button -}
Cancel : FMachine StatesBasicVM
→ FMachine StatesBasicVM
Cancel fm .Features = cancelFeatureAdded fm .Features
Cancel fm .AddStateF = cancelFeatureAdded fm .AddStateF
Cancel fm .GUIF (f , yesCancel) (inj₁ soda) =
addBtn2StateMachine (cancelFeatureAdded fm .GUIF (f , yesCancel) (inj₁ soda))
"Cancel" newState
Cancel fm .GUIF f s = cancelFeatureAdded fm .GUIF f s
{- add the Dummy free feature -}
FreeMAddFeature : FMachine StatesBasicVM
→ FMachine StatesBasicVM
FreeMAddFeature fm = addDummyFeatures fm FeatureFree
{- redefine the pay button to free in case feature free is yesFree -}
Free : FMachine StatesBasicVM
→ FMachine StatesBasicVM
Free fm .Features = FreeMAddFeature fm .Features
Free fm .AddStateF = FreeMAddFeature fm .AddStateF
Free fm .GUIF (f , yesFree) (inj₁ pay) =
simpleSMState "Free" (inj₁ soda)
Free fm .GUIF (f , yesFree) (inj₁ open') =
simpleSMState "Skip" (inj₁ pay)
Free fm .GUIF f s = FreeMAddFeature fm .GUIF f s
main1 : NativeIO Unit
main1 = compileFeatureVM (Tea (Cancel basicVM)) ((_ , yesCancel) , yesTea) (inj₁ pay)
main2 : NativeIO Unit
main2 = compileFeatureVM (Free basicVM) (_ , yesFree) (inj₁ pay) --
multiFeatureMachine : FMachine StatesBasicVM
multiFeatureMachine = Free (Cancel (Tea basicVM))
main : NativeIO Unit
main = compileFeatureVM
multiFeatureMachine
(((_ , yesTea) , yesCancel) , noFree) (inj₁ pay)
| 38.15748
| 115
| 0.693974
|
73c520572b718f9b643f01f03ad0cb8bd173cffb
| 104
|
agda
|
Agda
|
test/Fail/Issue4638-2.agda
|
cagix/agda
|
cc026a6a97a3e517bb94bafa9d49233b067c7559
|
[
"BSD-2-Clause"
] | 1,989
|
2015-01-09T23:51:16.000Z
|
2022-03-30T18:20:48.000Z
|
test/Fail/Issue4638-2.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 4,066
|
2015-01-10T11:24:51.000Z
|
2022-03-31T21:14:49.000Z
|
test/Fail/Issue4638-2.agda
|
Seanpm2001-languages/agda
|
9911f73061e21a87fad76c662463257afe02c861
|
[
"BSD-2-Clause"
] | 371
|
2015-01-03T14:04:08.000Z
|
2022-03-30T19:00:30.000Z
|
{-# OPTIONS --without-K --safe #-}
data E (@0 A : Set) : Set where
c₁ c₂ : A → E A
@0 c₃ : A → E A
| 17.333333
| 34
| 0.480769
|
cce1042f90b39cc0b6971e529648af428946e361
| 43,147
|
agda
|
Agda
|
BTA9.agda
|
luminousfennell/polybta
|
ef878f7fa5afa51fb7a14cd8f7f75da0af1b9deb
|
[
"BSD-3-Clause"
] | 1
|
2019-10-15T04:35:29.000Z
|
2019-10-15T04:35:29.000Z
|
BTA9.agda
|
luminousfennell/polybta
|
ef878f7fa5afa51fb7a14cd8f7f75da0af1b9deb
|
[
"BSD-3-Clause"
] | null | null | null |
BTA9.agda
|
luminousfennell/polybta
|
ef878f7fa5afa51fb7a14cd8f7f75da0af1b9deb
|
[
"BSD-3-Clause"
] | 1
|
2019-10-15T09:01:37.000Z
|
2019-10-15T09:01:37.000Z
|
module BTA9 where
----------------------------------------------
-- Preliminaries: Imports and List-utilities
----------------------------------------------
open import Data.Nat hiding (_<_;_⊔_;_*_;equal)
open import Data.Bool hiding (_∧_;_∨_)
open import Function using (_∘_)
open import Data.List
open import Data.Nat.Properties
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Data.Empty
open import Lib
---------------------------------------
-- Start of the development:
---------------------------------------
-- Intro/Objective:
-------------------
-- The following development defines a (verified) specializer/partial
-- evaluator for a simply typed lambda calculus embedded in Agda using
-- deBruijn indices.
-- The residual language.
-------------------------
-- The residual language is a standard simply typed λ-calculus. The
-- types are integers,functions,pairs,and sums.
data Type : Set where
Int : Type
Fun : Type → Type → Type
--pair type on the residual type level
_•_ : Type → Type → Type
--sum type on the residual type level
_⊎_ : Type → Type → Type
Ctx = List Type
-- The type Exp describes the typed residual expressions. Variables
-- are represented by deBruijn indices that form references into the
-- typing context. The constructors and typing constraints are
-- standard.
-- TODO: citations for ``as usual'' and ``standard''
-- what?
data Exp (Γ : Ctx) : Type → Set where
EVar : ∀ {τ} → τ ∈ Γ → Exp Γ τ
EInt : ℕ → Exp Γ Int
EAdd : Exp Γ Int → Exp Γ Int -> Exp Γ Int
ELam : ∀ {τ τ'} → Exp (τ ∷ Γ) τ' → Exp Γ (Fun τ τ')
EApp : ∀ {τ τ'} → Exp Γ (Fun τ τ') → Exp Γ τ → Exp Γ τ'
_,_ : ∀ {τ τ'} → Exp Γ τ → Exp Γ τ' → Exp Γ (τ • τ')
Tl : ∀ {τ τ'} → Exp Γ τ → Exp Γ (τ ⊎ τ')
Tr : ∀ {τ τ'} → Exp Γ τ' → Exp Γ (τ ⊎ τ')
EFst : ∀ {τ τ'} → Exp Γ (τ • τ') → Exp Γ τ
ESnd : ∀ {τ τ'} → Exp Γ (τ • τ') → Exp Γ τ'
ECase : ∀ {τ τ' τ''} → Exp Γ (τ ⊎ τ') → Exp (τ ∷ Γ) τ'' → Exp (τ' ∷ Γ) τ'' → Exp Γ τ''
-- The standard functional semantics of the residual expressions.
-- TODO: citations for ``as usual'' and ``standard''
-- what?
module Exp-Eval where
-- interpretation of Exp types
EImp : Type → Set
EImp Int = ℕ
EImp (Fun ty ty₁) = EImp ty → EImp ty₁
EImp (ty • ty₁) = EImp ty * EImp ty₁
EImp (ty ⊎ ty₁) = EImp ty ⨄ EImp ty₁
-- Environments containing values for free variables. An environment
-- is indexed by a typing context that provides the types for the
-- contained values.
data Env : Ctx → Set where
[] : Env []
_∷_ : ∀ {τ Γ} → EImp τ → Env Γ → Env (τ ∷ Γ)
-- Lookup a value in the environment, given a reference into the
-- associated typing context.
lookupE : ∀ { τ Γ } → τ ∈ Γ → Env Γ → EImp τ
lookupE hd (x ∷ env) = x
lookupE (tl v) (x ∷ env) = lookupE v env
-- Evaluation of residual terms, given a suitably typed environment.
ev : ∀ {τ Γ} → Exp Γ τ → Env Γ → EImp τ
ev (EVar x) env = lookupE x env
ev (EInt x) env = x
ev (EAdd e e₁) env = ev e env + ev e₁ env
ev (ELam e) env = λ x → ev e (x ∷ env)
ev (EApp e e₁) env = ev e env (ev e₁ env)
ev (e , e₁) env = ev e env , (ev e₁ env)
ev (Tl e) env = tl (ev e env)
ev (Tr e) env = tr (ev e env)
ev (EFst e) env = fst (ev e env)
ev (ESnd e) env = snd (ev e env)
ev (ECase e e₁ e₂) env with ev e env
ev (ECase e e₁ e₂) env | tl c = (λ x → ev e₁ (x ∷ env)) c
ev (ECase e e₁ e₂) env | tr c = (λ x → ev e₂ (x ∷ env)) c
-- The binding-time-annotated language.
---------------------------------------
-- The type of a term determines the term's binding time. The type
-- constructors with an A-prefix denote statically bound integers and
-- functions. Terms with dynamic binding time have a `D' type. The `D'
-- type constructor simply wraps up a residual type.
data AType : Set where
AInt : AType
AFun : AType → AType → AType
D : Type → AType
--pair type on the annotated type level
_•_ : AType → AType → AType
--sum type on the annotated type level
_⊎_ : AType → AType → AType
ACtx = List AType
-- The mapping from annotated types to residual types is straightforward.
typeof : AType → Type
typeof AInt = Int
typeof (AFun α₁ α₂) = Fun (typeof α₁) (typeof α₂)
typeof (D x) = x
typeof (α₁ • α₂) = typeof α₁ • typeof α₂
typeof (α₁ ⊎ α₂) = typeof α₁ ⊎ typeof α₂
-- The typed annotated terms: The binding times of variables is
-- determined by the corresponding type-binding in the context. In the
-- other cases, the A- and D-prefixes on term constructors inidicate
-- the corresponding binding times for the resulting terms.
------------------------------------------------------------------------------------------------
-- Now the typed annotated terms are extended to inculde dynamic terms whose subterms are static
------------------------------------------------------------------------------------------------
---------------
--Some examples
---------------
--a. first-order static value in a dynamic environment
-- DAdd (DInt 1) (AAdd (AInt 2) (AInt 3)) where AAdd (AInt 2) (AInt 3) : AExp [] AInt
-- DAdd (DInt 1) (AApp (ALam (Var hd)) (AInt 5)) where AApp (ALam (Var hd)) (AInt 5) : AExp [] AInt
--b. higher-order static value in a dynamic environment
-- DApp (ALam (Var hd)) (DInt 5) where ALam (Var hd) : AExp [] (AFun (D Int) (D Int))
-- DApp (ALam (ALam (AInt 0))) (DInt 5) where ALam (ALam (AInt 0)) : AExp [] (AFun (AFun (D Int) (D Int)) AInt)
-- DApp (ALam (ALam (DInt 0))) (DInt 5) where ALam (ALam (DInt 0)) : AExp [] (AFun (AFun AInt (D Int)) (D Int))
--Clearly these terms are not well-typed and we need to modify [AExp] such that they have the right types which are
--compatible with the dynamic environment,or we can "lift" their static types to dynamic types so that they can be
--used as dynamic sub-terms to be filled in the right dynamic environment. This,however,brings new difficulty when
--we try to partially evaluate term who contains "lifted" subterms.
----------------
--new difficulty
----------------
--Consider the evaluation of the following term
--DAdd (DInt 1) (Lift (AAdd (AInt 2) (AInt 3))) : AExp [] AInt
--the expected type after evaluation is,
--EAdd (EInt 1) ? : Exp [] Int where ? : Exp [] Int
--and one good candidate for "?" as,
--EInt (pe (AAdd (AInt 2) (AInt 3)) []) : Exp [] Int
--where we wrap up the partial evaluation of the static subterm so
--that it fits with the rest of evaluation.
--However,we can not always "wrap up" a evaluated higher-order static
--value so that it has the required residual type,
--ALam (Var hd) : AExp [] (AFun AInt AInt)
--the required type of its lifted term as,
--? : Exp [] (Fun Int Int)
--which can not be constructed from [λ Γ↝Γ' x → x : []↝Γ' → ℕ → ℕ]
--for the input of the static function is evaluated to be a natural
--number which can not be matched with the type of the input of the
--required residual term. It is then clear that we need to impose
--restriction upon terms to be lifted.
-------------------------
--restriction for lifting
-------------------------
-------------------------------------------------------------
-- The interpretation of annotated types.
Imp : Ctx → AType → Set
Imp Γ (AInt) = ℕ
Imp Γ (AFun α₁ α₂) = ∀ {Γ'} → Γ ↝ Γ' → (Imp Γ' α₁ → Imp Γ' α₂)
Imp Γ (D σ) = Exp Γ σ
Imp Γ (α₁ • α₂) = (Imp Γ α₁) * (Imp Γ α₂)
Imp Γ (α₁ ⊎ α₂) = (Imp Γ α₁) ⨄ (Imp Γ α₂)
elevate-var : ∀ {Γ Γ'} {τ : Type} → Γ ↝ Γ' → τ ∈ Γ → τ ∈ Γ'
elevate-var ↝-refl x = x
elevate-var (↝-extend Γ↝Γ') x = tl (elevate-var Γ↝Γ' x)
elevate-var2 : ∀ {Γ Γ' Γ'' τ} → Γ ↝ Γ' ↝ Γ'' → τ ∈ Γ → τ ∈ Γ''
elevate-var2 (↝↝-base x) x₁ = elevate-var x x₁
elevate-var2 (↝↝-extend Γ↝Γ'↝Γ'') hd = hd
elevate-var2 (↝↝-extend Γ↝Γ'↝Γ'') (tl x) = tl (elevate-var2 Γ↝Γ'↝Γ'' x)
elevate : ∀ {Γ Γ' Γ'' τ} → Γ ↝ Γ' ↝ Γ'' → Exp Γ τ → Exp Γ'' τ
elevate Γ↝Γ'↝Γ'' (EVar x) = EVar (elevate-var2 Γ↝Γ'↝Γ'' x)
elevate Γ↝Γ'↝Γ'' (EInt x) = EInt x
elevate Γ↝Γ'↝Γ'' (EAdd e e₁) = EAdd (elevate Γ↝Γ'↝Γ'' e) (elevate Γ↝Γ'↝Γ'' e₁)
elevate Γ↝Γ'↝Γ'' (ELam e) = ELam (elevate (↝↝-extend Γ↝Γ'↝Γ'') e)
elevate Γ↝Γ'↝Γ'' (EApp e e₁) = EApp (elevate Γ↝Γ'↝Γ'' e) (elevate Γ↝Γ'↝Γ'' e₁)
elevate Γ↝Γ'↝Γ'' (e , e₁) = ((elevate Γ↝Γ'↝Γ'' e) , (elevate Γ↝Γ'↝Γ'' e₁))
elevate Γ↝Γ'↝Γ'' (Tl e) = Tl (elevate Γ↝Γ'↝Γ'' e)
elevate Γ↝Γ'↝Γ'' (Tr e) = Tr (elevate Γ↝Γ'↝Γ'' e)
elevate Γ↝Γ'↝Γ'' (EFst e) = EFst (elevate Γ↝Γ'↝Γ'' e)
elevate Γ↝Γ'↝Γ'' (ESnd e) = ESnd (elevate Γ↝Γ'↝Γ'' e)
elevate Γ↝Γ'↝Γ'' (ECase c e₁ e₂) = ECase (elevate Γ↝Γ'↝Γ'' c) (elevate (↝↝-extend Γ↝Γ'↝Γ'') e₁) (elevate (↝↝-extend Γ↝Γ'↝Γ'') e₂)
liftE : ∀ {τ Γ Γ'} → Γ ↝ Γ' → Exp Γ τ → Exp Γ' τ
liftE Γ↝Γ' e = elevate (↝↝-base Γ↝Γ') e
-------------------------------------------------------------
-- --case 1. a first-order static value in a dynamic environment
-- lift1 : AExp [] AInt
-- lift1 = (AInt 0)
-- e1 : Imp [] AInt
-- e1 = 0
-- lifted1 : Exp [] (typeof AInt)
-- lifted1 = EInt e1
-- --case 2. higher-order static function in a dynamic environment
-- --a. a function whose input argument is of static integer
-- --lift2 : AExp [] (AFun AInt AInt)
-- --lift2 = ALam (Var hd)
-- --e2 : Imp [] (AFun AInt AInt)
-- --e2 = λ Γ↝Γ' x → x
-- --lifted2 : Exp [] (typeof (AFun AInt AInt))
-- --lifted2 = ELam {!!}
-- --Note that as explained above it is impossible to construct the right term using [e2]
-- --to fill in the above hole!
-- --b. a function whose input argument is of dynamic integer
-- --b.1. when return type is of dynamic integer
-- lift3 : AExp [] (AFun (D Int) (D Int))
-- lift3 = ALam (Var hd)
-- e3 : Imp [] (AFun (D Int) (D Int))
-- e3 = λ Γ↝Γ' x → x
-- liftede3 : Exp [] (typeof (AFun (D Int) (D Int)))
-- liftede3 = ELam (e3 (↝-extend ↝-refl) (EVar hd))
-- --b.2. when return type is of static integer
-- lift4 : AExp [] (AFun (D Int) AInt)
-- lift4 = ALam (AInt 0)
-- e4 : Imp [] (AFun (D Int) AInt)
-- e4 = λ Γ↝Γ' x → 0
-- liftede4 : Exp [] (typeof (AFun (D Int) AInt))
-- liftede4 = ELam ( EInt {Int ∷ []} (e4 (↝-extend ↝-refl) (EVar hd)))
-- --c. a function whose input argument is of static function type
-- --c.1. static function type returns a static integer
-- --lift5 : AExp [] (AFun (AFun AInt AInt) AInt)
-- --lift5 = ALam (AApp (Var hd) (AInt 0))
-- --e5 : Imp [] (AFun (AFun AInt AInt) AInt)
-- --e5 = λ Γ↝Γ' x → x ↝-refl 0
-- --liftede5 : Exp [] (typeof ( AFun (AFun AInt AInt) AInt))
-- --liftede5 = ELam (EInt (e5 (↝-extend {τ = Fun Int Int} ↝-refl) (λ Γ↝Γ' e' → {!!})))
-- --Note that again it is impossible to construct the right residual term
-- --c.2. static function type returns a dynamic integer
-- --c.2.1. the input of the function type is of static integer
-- lift6 : AExp [] (AFun (AFun AInt (D Int)) (D Int))
-- lift6 = ALam (AApp (Var hd) (AInt 0))
-- e6 : Imp [] (AFun (AFun AInt (D Int)) (D Int))
-- e6 = λ Γ↝Γ' x → x ↝-refl 0
-- liftede6 : Exp [] (typeof ( AFun (AFun AInt (D Int)) (D Int)))
-- liftede6 = ELam ((e6 (↝-extend {τ = Fun Int Int} ↝-refl)
-- (λ Γ↝Γ' e' → EApp (liftE Γ↝Γ' (EVar {Fun Int Int ∷ []} hd)) (EInt e'))))
-- --c.2.1. the input of the function type is of dynamic integer
-- lift7 : AExp [] (AFun (AFun (D Int) (D Int)) (D Int))
-- lift7 = ALam (AApp (Var hd) (DInt 0))
-- e7 : Imp [] (AFun (AFun (D Int) (D Int)) (D Int))
-- e7 = λ Γ↝Γ' x → x ↝-refl (EInt 0)
-- liftede7 : Exp [] (typeof ( AFun (AFun (D Int) (D Int)) (D Int)))
-- liftede7 = ELam ((e7 (↝-extend {τ = Fun Int Int} ↝-refl)
-- (λ Γ↝Γ' e' → EApp (liftE Γ↝Γ' (EVar {Fun Int Int ∷ []} hd)) e')))
-- --c.3. the output of the function type is of higher-order static value
-- --c.3.1 the return value has one static integer as input
-- -- lift8 : AExp [] (AFun (D Int) (AFun AInt (D Int)))
-- -- lift8 = ALam (ALam (Var (tl hd)))
-- -- e8 : Imp [] (AFun (D Int) (AFun AInt (D Int)))
-- -- e8 = λ Γ↝Γ' x Γ'↝Γ'' y → liftE Γ'↝Γ'' x
-- -- liftede8 : Exp [] (typeof ( AFun (D Int) (AFun AInt (D Int))))
-- -- liftede8 = ELam (ELam (e8 (↝-extend (↝-extend ↝-refl)) (EVar (tl hd)) ↝-refl {!!}))
-- --c.3.2 the return value has one dynamic integer as input
-- lift9 : AExp [] (AFun (D Int) (AFun (D Int) (D Int)))
-- lift9 = ALam (ALam (Var (tl hd)))
-- e9 : Imp [] (AFun (D Int) (AFun (D Int) (D Int)))
-- e9 = λ Γ↝Γ' x Γ'↝Γ'' y → liftE Γ'↝Γ'' x
-- liftede9 : Exp [] (typeof ( AFun (D Int) (AFun (D Int) (D Int))))
-- liftede9 = ELam (ELam (e9 (↝-extend (↝-extend ↝-refl)) (EVar (tl hd)) ↝-refl (EVar hd)))
-- --d. static pairs and sums in dynamic environment
-- --d.1. identity function with static sum as its input
-- lift10 : AExp [] (AFun ((D Int) ⊎ (D Int)) ((D Int) ⊎ (D Int)))
-- lift10 = ALam (Var hd)
-- e10 : Imp [] (AFun ((D Int) ⊎ (D Int)) ((D Int) ⊎ (D Int)))
-- e10 = λ Γ↝Γ' x → x
-- liftede10 : Exp [] (typeof (AFun ((D Int) ⊎ (D Int)) ((D Int) ⊎ (D Int))))
-- liftede10 = ELam {!e10!}
-- --d.1. identity function with static sum as its input
-- lift11 : AExp [] (AFun ((D Int) • (D Int)) ((D Int) • (D Int)))
-- lift11 = ALam (Var hd)
-- e11 : Imp [] (AFun ((D Int) • (D Int)) ((D Int) • (D Int)))
-- e11 = λ Γ↝Γ' x → x
-- liftede11 : Exp [] (typeof (AFun ((D Int) • (D Int)) ((D Int) • (D Int))))
-- liftede11 = ELam (fst (e11 (↝-extend ↝-refl) (EFst (EVar hd) , ESnd (EVar hd))) ,
-- snd (e11 (↝-extend ↝-refl) (EFst (EVar hd) , ESnd (EVar hd))))
--Note that the above two examples in section "d" clearly shows that
--"static functions with inputs of static sum type are not liftable
-- while with inputs of static pair type are liftable ".
---------------------------
--summary on liftable terms
---------------------------
--a. Regarding static first-order static value (static integer) in dynamic environment
-- All terms of static integer type are liftable
--b. Regarding static higher-order static value in dynamic environment
--b.1. given that output value is liftable
-- • when input is of first-order dynamic type,liftable
-- • when input is of higher-order static type and output
-- of that input is of dynamic type,liftable
--b.2. given that input value is liftable
-- • when output is of first-order type,liftable
-- • when output is of higher-order type and inputs
-- of that type are of dynamic type,liftable
-------------------------------------------
--specification of the liftable restriction
-------------------------------------------
mutual
data Liftable : AType → Set where
D : ∀ τ → Liftable (D τ)
AInt : Liftable AInt
_⊎_ : ∀ {α₁ α₂} → Liftable α₁ → Liftable α₂ → Liftable (α₁ ⊎ α₂)
_•_ : ∀ {α₁ α₂} → Liftable α₁ → Liftable α₂ → Liftable (α₁ • α₂)
AFun : ∀ {α₁ α₂} → Liftable⁻ α₁ → Liftable α₂ → Liftable (AFun α₁ α₂)
data Liftable⁻ : AType → Set where
D : ∀ τ → Liftable⁻ (D τ)
_•_ : ∀ {α₁ α₂} → Liftable⁻ α₁ → Liftable⁻ α₂ → Liftable⁻ (α₁ • α₂)
AFun : ∀ {α₁ α₂} → Liftable α₁ → Liftable⁻ α₂ → Liftable⁻ (AFun α₁ α₂)
----------------------------------------
--[AExp] with liftable terms
----------------------------------------
data AExp (Δ : ACtx) : AType → Set where
Var : ∀ {α} → α ∈ Δ → AExp Δ α
AInt : ℕ → AExp Δ AInt
AAdd : AExp Δ AInt → AExp Δ AInt → AExp Δ AInt
ALam : ∀ {α₁ α₂} → AExp (α₁ ∷ Δ) α₂ → AExp Δ (AFun α₁ α₂)
AApp : ∀ {α₁ α₂} → AExp Δ (AFun α₂ α₁) → AExp Δ α₂ → AExp Δ α₁
DInt : ℕ → AExp Δ (D Int)
DAdd : AExp Δ (D Int) → AExp Δ (D Int) → AExp Δ (D Int)
DLam : ∀ {σ₁ σ₂} → AExp ((D σ₁) ∷ Δ) (D σ₂) → AExp Δ (D (Fun σ₁ σ₂))
DApp : ∀ {α₁ α₂} → AExp Δ (D (Fun α₂ α₁)) → AExp Δ (D α₂) → AExp Δ (D α₁)
-- Static pairs and sums
_,_ : ∀ {α₁ α₂} → AExp Δ α₁ → AExp Δ α₂ → AExp Δ (α₁ • α₂)
Tl : ∀ {α₁ α₂} → AExp Δ α₁ → AExp Δ (α₁ ⊎ α₂)
Tr : ∀ {α₁ α₂} → AExp Δ α₂ → AExp Δ (α₁ ⊎ α₂)
Fst : ∀ {α₁ α₂} → AExp Δ (α₁ • α₂) → AExp Δ α₁
Snd : ∀ {α₁ α₂} → AExp Δ (α₁ • α₂) → AExp Δ α₂
Case : ∀ {α₁ α₂ α₃} → AExp Δ (α₁ ⊎ α₂) → AExp (α₁ ∷ Δ) α₃ → AExp (α₂ ∷ Δ) α₃ → AExp Δ α₃
-- Dynamic pairs and sums
_ḋ_ : ∀ {σ₁ σ₂} → AExp Δ (D σ₁) → AExp Δ (D σ₂) → AExp Δ (D (σ₁ • σ₂))
DTl : ∀ {σ₁ σ₂} → AExp Δ (D σ₁) → AExp Δ (D (σ₁ ⊎ σ₂))
DTr : ∀ {σ₁ σ₂} → AExp Δ (D σ₂) → AExp Δ (D (σ₁ ⊎ σ₂))
DFst : ∀ {σ₁ σ₂} → AExp Δ (D (σ₁ • σ₂)) → AExp Δ (D σ₁)
DSnd : ∀ {σ₁ σ₂} → AExp Δ (D (σ₁ • σ₂)) → AExp Δ (D σ₂)
DCase : ∀ {σ₁ σ₂ σ₃} → AExp Δ (D (σ₁ ⊎ σ₂)) → AExp ((D σ₁) ∷ Δ) (D σ₃) → AExp ((D σ₂) ∷ Δ) (D σ₃) → AExp Δ (D σ₃)
-- Liftable static terms
↑ : ∀ {α} → Liftable α → AExp Δ α → AExp Δ (D (typeof α))
-- The terms of AExp assign a binding time to each subterm. For
-- program specialization, we interpret terms with dynamic binding
-- time as the programs subject to specialization, and their subterms
-- with static binding time as statically known inputs. A partial
-- evaluation function (or specializer) then compiles the program into
-- a residual term for that is specialized for the static inputs. The
-- main complication when defining partial evaluation as a total,
-- primitively recursive function will be the treatment of the De
-- Bruijn variables of non-closed residual expressions.
lift : ∀ {Γ Γ'} α → Γ ↝ Γ' → Imp Γ α → Imp Γ' α
lift AInt p v = v
lift (AFun x x₁) Γ↝Γ' v = λ Γ'↝Γ'' → v (↝-trans Γ↝Γ' Γ'↝Γ'')
lift (D x₁) Γ↝Γ' v = elevate (↝↝-base Γ↝Γ') v
lift (α₁ • α₂) Γ↝Γ' (v₁ , v₂) = (lift α₁ Γ↝Γ' v₁) , (lift α₂ Γ↝Γ' v₂)
lift (α₁ ⊎ α₂) Γ↝Γ' (tl v) = tl (lift α₁ Γ↝Γ' v)
lift (α₁ ⊎ α₂) Γ↝Γ' (tr v) = tr (lift α₂ Γ↝Γ' v)
module SimpleAEnv where
-- A little weaker, but much simpler
data AEnv (Γ : Ctx) : ACtx → Set where
[] : AEnv Γ []
--cons : ∀ {Δ} (α : AType) → Imp Γ α → AEnv Γ Δ → AEnv Γ (α ∷ Δ)
cons : ∀ {Δ} {α : AType} → Imp Γ α → AEnv Γ Δ → AEnv Γ (α ∷ Δ)
lookup : ∀ {α Δ Γ} → AEnv Γ Δ → α ∈ Δ → Imp Γ α
lookup [] ()
--lookup {α} (cons .α x aenv) hd = x
--lookup {α} (cons .y x aenv) (tl {.α} {y} id) = lookup aenv id
lookup {α} (cons x aenv) hd = x
lookup {α} (cons x aenv) (tl {.α} {y} id) = lookup aenv id
liftEnv : ∀ {Γ Γ' Δ} → Γ ↝ Γ' → AEnv Γ Δ → AEnv Γ' Δ
liftEnv Γ↝Γ' [] = []
--liftEnv Γ↝Γ' (cons α x env) = cons α (lift α Γ↝Γ' x) (liftEnv Γ↝Γ' env)
liftEnv Γ↝Γ' (cons {α = α} x env) = cons {α = α} (lift α Γ↝Γ' x) (liftEnv Γ↝Γ' env)
consD : ∀ {Γ Δ} σ → AEnv Γ Δ → AEnv (σ ∷ Γ) (D σ ∷ Δ)
--consD σ env = (cons (D σ) (EVar hd) (liftEnv (↝-extend {τ = σ} ↝-refl) env))
consD σ env = (cons {α = D σ} (EVar hd) (liftEnv (↝-extend {τ = σ} ↝-refl) env))
----------------------------------------------
-- Helper for the evaluation of liftable terms
----------------------------------------------
mutual
lift' : ∀ {Γ α} → Liftable α → Imp Γ α → (Exp Γ (typeof α))
lift' (D τ) v = v
lift' AInt v = EInt v
lift' (ty ⊎ ty₁) (tl a) = Tl (lift' ty a)
lift' (ty ⊎ ty₁) (tr b) = Tr (lift' ty₁ b)
lift' (ty • ty₁) (ffst , ssnd) = lift' ty ffst , lift' ty₁ ssnd
lift' {Γ} (AFun {α₁} ty₁ ty₂) v = ELam
((λ x → lift' ty₂ (v (↝-extend {τ = typeof α₁} ↝-refl) x))
(embed ty₁ (EVar {Γ = typeof α₁ ∷ Γ} hd)))
embed : ∀ {Γ α} → Liftable⁻ α → Exp Γ (typeof α) → (Imp Γ α)
embed (D τ) e = e
-- embed (ty ⊎ ty₁) e = {! (ECase e (EVar hd) ?)!}
-- embed (ty ⊎ ty₁) (EVar x) = {!!}
-- embed (ty ⊎ ty₁) (EApp e e₁) = {!!}
-- embed (ty ⊎ ty₁) (Tl e) = tl (embed ty e)
-- embed (ty ⊎ ty₁) (Tr e) = tr (embed ty₁ e)
-- embed (ty ⊎ ty₁) (EFst e) = {!!}
-- embed (ty ⊎ ty₁) (ESnd e) = {!!}
-- embed (ty ⊎ ty₁) (ECase e e₁ e₂) = {!!}
embed (ty • ty₁) e = embed ty (EFst e) , embed ty₁ (ESnd e)
embed {Γ} (AFun {α} ty₁ ty₂) e =
λ Γ↝Γ' v₁ → embed ty₂ (EApp (liftE Γ↝Γ' e) (lift' ty₁ v₁))
--------------------
-- Partial Evaluator
--------------------
pe : ∀ {α Δ Γ} → AExp Δ α → AEnv Γ Δ → Imp Γ α
pe (Var x) env = lookup env x
pe (AInt x) env = x
pe (AAdd e e₁) env = pe e env + pe e₁ env
pe (ALam {α} e) env = λ Γ↝Γ' → λ y → pe e (cons {α = α} y (liftEnv Γ↝Γ' env))
pe (AApp e e₁) env = pe e env ↝-refl (pe e₁ env)
pe (DInt x) env = EInt x
pe (DAdd e e₁) env = EAdd (pe e env) (pe e₁ env)
pe (DLam {σ} e) env = ELam (pe e (consD σ env))
pe (DApp e e₁) env = EApp (pe e env) (pe e₁ env)
pe {Γ = Γ} (e , e₁) env = pe {Γ = Γ} e env , pe {Γ = Γ} e₁ env
pe {α = α₁ ⊎ α₂} {Γ = Γ} (Tl e) env = tl (pe {α = α₁} {Γ = Γ} e env)
pe {α = α₁ ⊎ α₂} {Γ = Γ} (Tr e) env = tr (pe {α = α₂} {Γ = Γ} e env)
pe {Γ = Γ} (Fst e) env = fst (pe {Γ = Γ} e env)
pe {Γ = Γ} (Snd e) env = snd (pe {Γ = Γ} e env)
pe {Γ = Γ} (Case e e₁ e₂) env with pe {Γ = Γ} e env
pe {Γ = Γ} (Case {α₁ = α} e e₁ e₂) env | tl y = (λ Γ↝Γ' → λ y → pe e₁ (cons {α = α} y (liftEnv Γ↝Γ' env))) ↝-refl y
pe {Γ = Γ} (Case {α₂ = α} e e₁ e₂) env | tr y = (λ Γ↝Γ' → λ y → pe e₂ (cons {α = α} y (liftEnv Γ↝Γ' env))) ↝-refl y
pe (e ḋ e₁) env = pe e env , pe e₁ env
pe (DTl e) env = Tl (pe e env)
pe (DTr e) env = Tr (pe e env)
pe (DFst e) env = EFst (pe e env)
pe (DSnd e) env = ESnd (pe e env)
pe (DCase {σ₁} {σ₂} e e₁ e₂) env = ECase (pe e env) (pe e₁ (consD σ₁ env)) (pe e₂ (consD σ₂ env))
pe (↑ x e) env = lift' x (pe e env)
-- Correctness proof
module Correctness where
open SimpleAEnv
open Exp-Eval
-- TODO: rename occurences of stripα to typeof
stripα = typeof
stripΔ : ACtx → Ctx
stripΔ = map stripα
strip-lookup : ∀ { α Δ} → α ∈ Δ → stripα α ∈ stripΔ Δ
strip-lookup hd = hd
strip-lookup (tl x) = tl (strip-lookup x)
strip : ∀ {α Δ} → AExp Δ α → Exp (stripΔ Δ) (stripα α)
strip (Var x) = EVar (strip-lookup x)
strip (AInt x) = EInt x
strip (AAdd e e₁) = EAdd (strip e) (strip e₁)
strip (ALam e) = ELam (strip e)
strip (AApp e e₁) = EApp (strip e) (strip e₁)
strip (DInt x) = EInt x
strip (DAdd e e₁) = EAdd (strip e) (strip e₁)
strip (DLam e) = ELam (strip e)
strip (DApp e e₁) = EApp (strip e) (strip e₁)
strip (e , e₁) = strip e , strip e₁
strip (Tl e) = Tl (strip e)
strip (Tr e) = Tr (strip e)
strip (Fst e) = EFst (strip e)
strip (Snd e) = ESnd (strip e)
strip (Case e e₁ e₂) = ECase (strip e) (strip e₁) (strip e₂)
strip (e ḋ e₁) = strip e , strip e₁
strip (DTl e) = Tl (strip e)
strip (DTr e) = Tr (strip e)
strip (DFst e) = EFst (strip e)
strip (DSnd e) = ESnd (strip e)
strip (DCase e e₁ e₂) = ECase (strip e) (strip e₁) (strip e₂)
strip (↑ x e) = strip e
--liftE : ∀ {τ Γ Γ'} → Γ ↝ Γ' → Exp Γ τ → Exp Γ' τ
--liftE Γ↝Γ' e = elevate (↝↝-base Γ↝Γ') e
stripLift : ∀ {α Δ Γ} → stripΔ Δ ↝ Γ → AExp Δ α → Exp Γ (stripα α)
stripLift Δ↝Γ = liftE Δ↝Γ ∘ strip
-- --------------------------------
-- --"lift-strip" equivalence lemma
-- --------------------------------
-- ↑≡↓ : ∀ x e env env' aenv → Equiv-Env env' aenv env → ev (lift' x (pe e aenv)) env' ≡ ev (strip e) env
-- ↑≡↓ x e env env' aenv eqenv = {!!}
-- We want to show that pe preserves the semantics of the
-- program. Roughly, Exp-Eval.ev-ing a stripped program is
-- equivalent to first pe-ing a program and then Exp-Eval.ev-ing the
-- result. But as the pe-result of a static function ``can do more''
-- than the (ev ∘ strip)ped function we need somthing more refined.
module Equiv where
open import Relation.Binary.PropositionalEquality
-- Extending a value environment according to an extension of a
-- type environment
data _⊢_↝_ {Γ} : ∀ {Γ'} → Γ ↝ Γ' → Env Γ → Env Γ' → Set where
refl : ∀ env → ↝-refl ⊢ env ↝ env
extend : ∀ {τ Γ' env env'} → {Γ↝Γ' : Γ ↝ Γ'} →
(v : EImp τ) → (Γ↝Γ' ⊢ env ↝ env') →
↝-extend {Γ = Γ} {Γ' = Γ'} {τ = τ} Γ↝Γ' ⊢ env ↝ (v ∷ env')
env↝trans : ∀ {Γ Γ' Γ''} {Γ↝Γ' : Γ ↝ Γ'} {Γ'↝Γ'' : Γ' ↝ Γ''}
{env env' env''} →
Γ↝Γ' ⊢ env ↝ env' → Γ'↝Γ'' ⊢ env' ↝ env'' →
let Γ↝Γ'' = ↝-trans Γ↝Γ' Γ'↝Γ'' in
Γ↝Γ'' ⊢ env ↝ env''
env↝trans {Γ} {.Γ''} {Γ''} {Γ↝Γ'} {.↝-refl} {env} {.env''} {env''} env↝env' (refl .env'') = env↝env'
env↝trans env↝env' (extend v env'↝env'') = extend v (env↝trans env↝env' env'↝env'')
-- Equivalent Imp Γ α and EImp τ values (where τ = stripα α). As
-- (v : Imp Γ α) is not necessarily closed, equivalence is defined for
-- the closure (Env Γ, ImpΓ α)
Equiv : ∀ {α Γ} → Env Γ → Imp Γ α → EImp (stripα α) → Set
Equiv {AInt} env av v = av ≡ v
Equiv {AFun α₁ α₂} {Γ} env av v = ∀ {Γ' env' Γ↝Γ'} →
(Γ↝Γ' ⊢ env ↝ env') →
{av' : Imp Γ' α₁} →
{v' : EImp (stripα α₁)} →
Equiv {α₁} {Γ'} env' av' v' → Equiv {α₂} env' (av Γ↝Γ' av') (v v')
Equiv {D x} env av v = ev av env ≡ v
Equiv {α • α₁} env (ffst , ssnd) (ffst₁ , ssnd₁) = (Equiv {α} env ffst ffst₁) ∧ (Equiv {α₁} env ssnd ssnd₁)
Equiv {α ⊎ α₁} env (tl a) (tl a₁) = Equiv {α} env a a₁
--------------------------------------------------------------------
Equiv {α ⊎ α₁} env (tl a) (tr b) = ⊥ -- Interesting case!
Equiv {α ⊎ α₁} env (tr b) (tl a) = ⊥ -- Interesting case!
--------------------------------------------------------------------
Equiv {α ⊎ α₁} env (tr b) (tr b₁) = Equiv {α₁} env b b₁
-- Equiv {AInt} env av v = av ≡ v
-- Equiv {AFun α₁ α₂} {Γ} env av v = -- extensional equality, given -- an extended context
-- ∀ {Γ' env' Γ↝Γ'} → (Γ↝Γ' ⊢ env ↝ env') →
-- {av' : Imp Γ' α₁} → {v' : EImp (stripα α₁)} →
-- Equiv env' av' v' → Equiv env' (av Γ↝Γ' av') (v v')
-- Equiv {D x} {Γ} env av v = ev av env ≡ v -- actually we mean extensional equality
-- TODO: Define a proper equivalence for EImps
-- Equivalence of AEnv and Env environments. They need to provide
-- Equivalent bindings for a context Δ/stripΔ Δ. Again, the
-- equivalence is defined for a closure (Env Γ', AEnv Γ' Δ).
data Equiv-Env {Γ' : _} (env' : Env Γ') :
∀ {Δ} → let Γ = stripΔ Δ in
AEnv Γ' Δ → Env Γ → Set where
[] : Equiv-Env env' [] []
cons : ∀ {α Δ} → let τ = stripα α
Γ = stripΔ Δ in
{env : Env Γ} → {aenv : AEnv Γ' Δ} →
Equiv-Env env' aenv env →
(va : Imp (Γ') α) → (v : EImp τ) →
Equiv {α} {Γ'} env' va v →
--Equiv-Env env' (cons α va (aenv)) (v ∷ env)
Equiv-Env env' (cons {α = α} va (aenv)) (v ∷ env)
--------------------------------
--"lift-strip" equivalence lemma
--------------------------------
-- ↑≡↓ : ∀ {Γ' Δ α} x e env env' aenv → Equiv-Env {Γ'} env' {Δ} aenv env → ev (lift' {Γ = Γ'} {α = α} x (pe e aenv)) env' ≡ ev (strip e) env
-- ↑≡↓ x e env env' aenv eqenv = {!!}
-- Now for the proof...
module Proof where
open Equiv
open import Relation.Binary.PropositionalEquality
-- Extensional equality as an axiom to prove the Equivalence of
-- function values. We could (should?) define it locally for
-- Equiv.
postulate ext : ∀ {τ₁ τ₂} {f g : EImp τ₁ → EImp τ₂} →
(∀ x → f x ≡ g x) → f ≡ g
-- Ternary helper relation for environment extensions, analogous to _↝_↝_ for contexts
data _⊢_↝_↝_⊣ : ∀ { Γ Γ' Γ''} → Γ ↝ Γ' ↝ Γ'' → Env Γ → Env Γ' → Env Γ'' → Set where
refl : ∀ {Γ Γ''} {Γ↝Γ'' : Γ ↝ Γ''} { env env'' } →
Γ↝Γ'' ⊢ env ↝ env'' →
↝↝-base Γ↝Γ'' ⊢ env ↝ [] ↝ env'' ⊣
extend : ∀ {Γ Γ' Γ'' τ} {Γ↝Γ'↝Γ'' : Γ ↝ Γ' ↝ Γ''} { env env' env'' } →
Γ↝Γ'↝Γ'' ⊢ env ↝ env' ↝ env'' ⊣ →
(v : EImp τ) → ↝↝-extend {Γ = Γ} {Γ' = Γ'} {Γ'' = Γ''} {τ = τ} Γ↝Γ'↝Γ'' ⊢ (v ∷ env) ↝ (v ∷ env') ↝ (v ∷ env'') ⊣
-- the following lemmas are strong versions of the shifting
-- functions, proving that consistent variable renaming preserves
-- equivalence (and not just typing).
lookup-elevate-≡ : ∀ {τ Γ Γ'} {Γ↝Γ' : Γ ↝ Γ'}
{env : Env Γ} {env' : Env Γ'} →
Γ↝Γ' ⊢ env ↝ env' →
(x : τ ∈ Γ) → lookupE x env ≡ lookupE (elevate-var Γ↝Γ' x) env'
lookup-elevate-≡ {τ} {.Γ'} {Γ'} {.↝-refl} {.env'} {env'} (refl .env') x = refl
lookup-elevate-≡ (extend v env↝env') x = lookup-elevate-≡ env↝env' x
lookup-elevate2-≡ : ∀ {τ Γ Γ' Γ''} {Γ↝Γ'↝Γ'' : Γ ↝ Γ' ↝ Γ''}
{env : Env Γ} {env' : Env Γ'} {env'' : Env Γ''} →
Γ↝Γ'↝Γ'' ⊢ env ↝ env' ↝ env'' ⊣ →
(x : τ ∈ Γ) → lookupE x env ≡ lookupE (elevate-var2 Γ↝Γ'↝Γ'' x) env''
lookup-elevate2-≡ (refl Γ↝Γ') x = lookup-elevate-≡ Γ↝Γ' x
lookup-elevate2-≡ (extend env↝env'↝env'' v) hd = refl
lookup-elevate2-≡ (extend env↝env'↝env'' _) (tl x)
rewrite lookup-elevate2-≡ env↝env'↝env'' x = refl
lem-elevate-≡ : ∀ {τ Γ Γ' Γ''}
{Γ↝Γ'↝Γ'' : Γ ↝ Γ' ↝ Γ''}
{env : Env Γ} {env' : Env Γ'} {env'' : Env Γ''} →
Γ↝Γ'↝Γ'' ⊢ env ↝ env' ↝ env'' ⊣ →
(e : Exp Γ τ) →
ev e env ≡ ev (elevate Γ↝Γ'↝Γ'' e) env''
lem-elevate-≡ env↝env' (EVar x) = lookup-elevate2-≡ env↝env' x
lem-elevate-≡ env↝env' (EInt x) = refl
lem-elevate-≡ env↝env' (EAdd e e₁) with lem-elevate-≡ env↝env' e | lem-elevate-≡ env↝env' e₁
... | IA1 | IA2 = cong₂ _+_ IA1 IA2
lem-elevate-≡ {Fun τ₁ τ₂} {Γ↝Γ'↝Γ'' = Γ↝Γ'↝Γ''}
{env = env}
{env'' = env''}
env↝env' (ELam e) = ext {τ₁} {τ₂} lem-elevate-≡-body
where lem-elevate-≡-body : ∀ x → ev e (x ∷ env) ≡ ev (elevate (↝↝-extend Γ↝Γ'↝Γ'') e) (x ∷ env'')
lem-elevate-≡-body x = lem-elevate-≡ (extend env↝env' x) e
lem-elevate-≡ env↝env' (EApp e e₁) with lem-elevate-≡ env↝env' e | lem-elevate-≡ env↝env' e₁
... | IA1 | IA2 = cong₂ (λ f₁ x → f₁ x) IA1 IA2
lem-elevate-≡ env↝env' (e , e₁) with lem-elevate-≡ env↝env' e | lem-elevate-≡ env↝env' e₁
... | IA1 | IA2 = cong₂ (λ x y → x , y) IA1 IA2
lem-elevate-≡ env↝env' (Tl e) with lem-elevate-≡ env↝env' e
... | IA = cong (λ x → tl x) IA
lem-elevate-≡ env↝env' (Tr e) with lem-elevate-≡ env↝env' e
... | IA = cong (λ x → tr x) IA
lem-elevate-≡ env↝env' (EFst e) with lem-elevate-≡ env↝env' e
... | IA = cong (λ x → fst x) IA
lem-elevate-≡ env↝env' (ESnd e) with lem-elevate-≡ env↝env' e
... | IA = cong (λ x → snd x) IA
lem-elevate-≡ {Γ↝Γ'↝Γ'' = Γ↝Γ'↝Γ''}
{env = env}
{env'' = env''}
env↝env' (ECase e e₁ e₂) with ev e env | ev (elevate Γ↝Γ'↝Γ'' e) env'' | lem-elevate-≡ env↝env' e
... | tl c | tl c' | IA rewrite (→tl {x' = c} {y' = c'} (tl c) (tl c') IA refl refl) = lem-elevate-≡-body c'
where lem-elevate-≡-body : ∀ x → ev e₁ (x ∷ env) ≡ ev (elevate (↝↝-extend Γ↝Γ'↝Γ'') e₁) (x ∷ env'')
lem-elevate-≡-body x = lem-elevate-≡ (extend env↝env' x) e₁
... | tl c | tr c' | ()
... | tr c | tl c' | ()
... | tr c | tr c' | IA rewrite (→tr {x' = c} {y' = c'} (tr c) (tr c') IA refl refl) = lem-elevate-≡-body c'
where lem-elevate-≡-body : ∀ x → ev e₂ (x ∷ env) ≡ ev (elevate (↝↝-extend Γ↝Γ'↝Γ'') e₂) (x ∷ env'')
lem-elevate-≡-body x = lem-elevate-≡ (extend env↝env' x) e₂
lem-lift-refl-id : ∀ {α Γ} → let τ = stripα α in
(env : Env Γ) →
(v : EImp τ) (va : Imp Γ α) →
Equiv {α} {Γ} env va v →
Equiv {α} {Γ} env (lift α ↝-refl va) v
lem-lift-refl-id {AInt} env v va eq = eq
lem-lift-refl-id {AFun α α₁} {Γ} env v va eq = body
where body : ∀ {Γ'} {env' : Env Γ'} {Γ↝Γ' : Γ ↝ Γ'} →
Γ↝Γ' ⊢ env ↝ env' →
{av' : Imp Γ' α} {v' : EImp (stripα α)} →
Equiv {α} {Γ'} env' av' v' → Equiv {α₁} {Γ'} env' (va (↝-trans ↝-refl Γ↝Γ') av') (v v')
body {Γ↝Γ' = Γ↝Γ'} env↝env' eq' rewrite sym (lem-↝-refl-id Γ↝Γ') = eq env↝env' eq'
lem-lift-refl-id {D x} env v va eq rewrite sym eq = sym (lem-elevate-≡ (refl (refl env)) va)
lem-lift-refl-id {α • α₁} env (ffst , ssnd) (ffst₁ , ssnd₁) (∧-intro x x₁) =
∧-intro (lem-lift-refl-id {α} env ffst ffst₁ x)
(lem-lift-refl-id {α₁} env ssnd ssnd₁ x₁)
lem-lift-refl-id {α ⊎ α₁} env (tl a) (tl a₁) eq = lem-lift-refl-id {α} env a a₁ eq
lem-lift-refl-id {α ⊎ α₁} env (tl a) (tr b) ()
lem-lift-refl-id {α ⊎ α₁} env (tr b) (tl a) ()
lem-lift-refl-id {α ⊎ α₁} env (tr b) (tr b₁) eq = lem-lift-refl-id {α₁} env b b₁ eq
-- lifting an Imp does not affect equivalence
lem-lift-equiv : ∀ {α Γ Γ'} → let τ = stripα α in
{Γ↝Γ' : Γ ↝ Γ'} →
(va : Imp Γ α) (v : EImp τ) →
{env : Env Γ} {env' : Env Γ'} →
Γ↝Γ' ⊢ env ↝ env' →
Equiv {α} {Γ} env va v →
Equiv {α} {Γ'} env' (lift α Γ↝Γ' va) v
lem-lift-equiv {α} va v {.env'} {env'} (refl .env') eq = lem-lift-refl-id {α} env' v va eq
lem-lift-equiv {AInt} va v (extend v₁ env↝env') eq = eq
lem-lift-equiv {AFun α α₁} va v (extend v₁ env↝env') eq =
λ v₁env₁↝env' eq₁ → eq (env↝trans (extend v₁ env↝env') v₁env₁↝env') eq₁
lem-lift-equiv {D x} va v (extend v₁ env↝env') eq rewrite sym eq = sym (lem-elevate-≡ (refl (extend v₁ env↝env')) va)
lem-lift-equiv {α • α₁} (ffst , ssnd) (ffst₁ , ssnd₁) (extend v₁ env↝env') (∧-intro x x₁) =
∧-intro (lem-lift-equiv {α} ffst ffst₁ (extend v₁ env↝env') x)
(lem-lift-equiv {α₁} ssnd ssnd₁ (extend v₁ env↝env') x₁)
lem-lift-equiv {α ⊎ α₁} (tl a) (tl a₁) (extend v₁ env↝env') eq = lem-lift-equiv {α} a a₁ (extend v₁ env↝env') eq
lem-lift-equiv {α ⊎ α₁} (tl a) (tr b) (extend v₁ env↝env') ()
lem-lift-equiv {α ⊎ α₁} (tr b) (tl a) (extend v₁ env↝env') ()
lem-lift-equiv {α ⊎ α₁} (tr b) (tr b₁) (extend v₁ env↝env') eq = lem-lift-equiv {α₁} b b₁ (extend v₁ env↝env') eq
lem-equiv-lookup : ∀ {α Δ Γ'} → let Γ = stripΔ Δ in
{ aenv : AEnv Γ' Δ } {env : Env Γ} →
(env' : Env Γ') →
Equiv-Env env' aenv env →
∀ (x : α ∈ Δ) → Equiv {α} env' (lookup aenv x) (lookupE (strip-lookup x) env)
lem-equiv-lookup env' [] ()
lem-equiv-lookup env' (cons enveq va v eq) hd = eq
lem-equiv-lookup env' (cons enveq va v eq) (tl x) = lem-equiv-lookup env' enveq x
lem-equiv-env-lift-extend :
∀ {σ Γ' Δ} (env' : Env Γ') → let Γ = stripΔ Δ in
{env : Env Γ} {aenv : AEnv Γ' Δ} →
Equiv-Env env' aenv env → (x : EImp σ) →
Equiv-Env {σ ∷ Γ'} (x ∷ env') (liftEnv (↝-extend ↝-refl) aenv) env
lem-equiv-env-lift-extend _ [] x = []
lem-equiv-env-lift-extend env' (cons {α} eqenv va v x) x₁ =
cons (lem-equiv-env-lift-extend env' eqenv x₁)
(lift α (↝-extend ↝-refl) va) v (lem-lift-equiv {α} va v (extend x₁ (refl env')) x)
lem-equiv-env-lift-lift :
∀ {Γ' Γ'' Δ} → let Γ = stripΔ Δ in
{Γ↝Γ' : Γ' ↝ Γ''}
{env' : Env Γ'} {env'' : Env Γ''}
(env'↝env'' : Γ↝Γ' ⊢ env' ↝ env'') →
{env : Env Γ} {aenv : AEnv Γ' Δ} →
Equiv-Env env' aenv env →
Equiv-Env env'' (liftEnv Γ↝Γ' aenv) env
lem-equiv-env-lift-lift env'↝env'' [] = []
lem-equiv-env-lift-lift {Γ↝Γ' = Γ↝Γ'} env'↝env'' (cons {α} eqenv va v x)
with lem-equiv-env-lift-lift env'↝env'' eqenv
... | IA = cons IA (lift α Γ↝Γ' va) v (lem-lift-equiv {α} va v env'↝env'' x)
--------------------------------
--"lift-correct" equivalence lemma
--------------------------------
open import Data.Product
mutual
lift-correct : ∀ {Γ α} (lft : Liftable α) (env : Env Γ) (av : Imp Γ α) (v : EImp (typeof α)) →
Equiv {α} {Γ} env av v → (Equiv {D (typeof α)} {Γ} env (lift' lft av) v)
lift-correct (D τ) env av v eq = eq
lift-correct AInt env av v eq = eq
lift-correct (lft ⊎ lft₁) env (tl a) (tl a₁) eq with lift-correct lft env a a₁
... | IA rewrite IA eq = refl
lift-correct (lft ⊎ lft₁) env (tr b) (tl a) ()
lift-correct (lft ⊎ lft₁) env (tl a) (tr b) ()
lift-correct (lft ⊎ lft₁) env (tr b) (tr b₁) eq with lift-correct lft₁ env b b₁
... | IA rewrite IA eq = refl
lift-correct (lft • lft₁) env (ffst , ssnd) (ffst₁ , ssnd₁) (∧-intro x x₁)
rewrite lift-correct lft env ffst ffst₁ x | lift-correct lft₁ env ssnd ssnd₁ x₁ = refl
lift-correct {Γ} {AFun x lft} (AFun y y') env av v eq =
ext {typeof x} {typeof lft} (λ x₁ →
lift-correct y' (x₁ ∷ env)
(av (↝-extend ↝-refl) (embed y (EVar hd))) (v x₁) (eq (extend x₁ (refl env)) (embed-correct {typeof x ∷ Γ} {x} y (x₁ ∷ env) (EVar hd) x₁ refl)))
embed-correct : ∀ {Γ α} (lft : Liftable⁻ α) (env : Env Γ) → (e : Exp Γ (typeof α)) → (v : EImp (typeof α)) →
ev e env ≡ v → Equiv {α} {Γ} env (embed lft e) v
embed-correct (D τ) env e v eq rewrite eq = refl
embed-correct (lft • lft₁) env e (fstv , sndv) eq = ∧-intro (embed-correct lft env (EFst e) fstv (subst (λ x → ffst x ≡ fstv) (sym eq) refl))
(embed-correct lft₁ env (ESnd e) sndv
(subst (λ x → ssnd x ≡ sndv) (sym eq) refl))
embed-correct {α = AFun α₁ α₂} (AFun x lft) env e v eq = f
where
f : ∀ {Γ' env' Γ↝Γ'} (x₁ : Γ↝Γ' ⊢ env ↝ env') {x₂ : Imp Γ' α₁} {x₃ : EImp (typeof α₁)}
(x₄ : Equiv {α₁} {Γ'} env' x₂ x₃) →
Equiv {α₂} {Γ'} env'
(embed lft (EApp (elevate (↝↝-base Γ↝Γ') e) (lift' x x₂))) (v x₃)
f {Γ'} {env'} {Γext} envext {av'} {v'} eq' =
embed-correct lft env' (EApp (elevate (↝↝-base Γext) e) (lift' x av')) (v v') g
where g : ev (elevate (↝↝-base Γext) e) env' (ev (lift' x av') env') ≡ v v'
g rewrite lift-correct x env' av' v' eq'
| sym (cong (λ f → f v') (lem-elevate-≡ (refl envext) e))
| (cong (λ f → f v') eq) = refl
--g = {!!}
---------------------------------------
--Correctness proof with liftable terms
---------------------------------------
-- When we partially evaluate somthing under an environment , it
-- will give equivalent results to a ``complete'' evaluation under
-- an equivalent environment
pe-correct : ∀ { α Δ Γ' } → (e : AExp Δ α) →
let Γ = stripΔ Δ in
{aenv : AEnv Γ' Δ} → {env : Env Γ} →
(env' : Env Γ') →
Equiv-Env env' aenv env →
Equiv {α} {Γ'} env' (pe e aenv) (ev (strip e) env)
pe-correct (Var x) env' eqenv = lem-equiv-lookup env' eqenv x
pe-correct (AInt x) env' eqenv = refl
pe-correct (AAdd e e₁) env' eqenv
rewrite pe-correct e env' eqenv | pe-correct e₁ env' eqenv = refl
pe-correct (ALam e) env' eqenv =
λ {_} {env''} env'↝env'' {av'} {v'} eq →
let eqenv' : _
eqenv' = lem-equiv-env-lift-lift env'↝env'' eqenv
eqenv'' : _
eqenv'' = cons eqenv' av' v' eq
in pe-correct e env'' eqenv''
pe-correct (AApp e e₁) env' eqenv
with pe-correct e env' eqenv | pe-correct e₁ env' eqenv
... | IAe | IAf = IAe (refl env') IAf
pe-correct (DInt x) env' eqenv = refl
pe-correct (DAdd e e₁) env' eqenv
rewrite pe-correct e env' eqenv | pe-correct e₁ env' eqenv = refl
pe-correct {α = D (Fun σ₁ σ₂)} (DLam e) env' eqenv =
ext {σ₁} {σ₂}
(λ x →
let eqenv₁ : _
eqenv₁ = lem-equiv-env-lift-extend env' eqenv x
eqenv₂ : _
eqenv₂ = cons eqenv₁ (EVar hd) x refl
in pe-correct e (x ∷ env') eqenv₂)
pe-correct (DApp e e₁) env' eqenv
with pe-correct e₁ env' eqenv | pe-correct e env' eqenv
... | IA' | IA = cong₂ (λ f x → f x) IA IA'
pe-correct (e , e₁) env' eqenv = ∧-intro (pe-correct e env' eqenv) (pe-correct e₁ env' eqenv)
pe-correct (Tl e) env' eqenv = pe-correct e env' eqenv
pe-correct (Tr e) env' eqenv = pe-correct e env' eqenv
pe-correct (Fst (e , e₁)) env' eqenv = pe-correct e env' eqenv
pe-correct (Fst e) {aenv = aenv} {env = env} env' eqenv with pe e aenv | ev (strip e) env | pe-correct e env' eqenv
... | e₁ , e₂ | e₁' , e₂' | ∧-intro A B = A
pe-correct (Snd (e , e₁)) env' eqenv = pe-correct e₁ env' eqenv
pe-correct (Snd e) {aenv = aenv} {env = env} env' eqenv with pe e aenv | ev (strip e) env | pe-correct e env' eqenv
... | e₁ , e₂ | e₁' , e₂' | ∧-intro A B = B
pe-correct {α} (Case e e₁ e₂) {aenv = aenv} {env = env} env' eqenv with pe e aenv | ev (strip e) env | pe-correct e env' eqenv
... | tl c | tl c' | L = pe-correct e₁ {aenv = cons c (liftEnv ↝-refl aenv)}
{env = c' ∷ env} env'
(cons (lem-equiv-env-lift-lift (refl env') eqenv) c c' L)
... | tr c | tr c' | R = pe-correct e₂ {aenv = cons c (liftEnv ↝-refl aenv)}
{env = c' ∷ env} env'
(cons (lem-equiv-env-lift-lift (refl env') eqenv) c c' R)
... | tr c | tl c' | ()
... | tl c | tr c' | ()
pe-correct (e ḋ e₁) env' eqenv with pe-correct e env' eqenv | pe-correct e₁ env' eqenv
... | IA | IA' rewrite IA | IA' = refl
pe-correct (DTl e) env' eqenv with pe-correct e env' eqenv
... | IA rewrite IA = refl
pe-correct (DTr e) env' eqenv with pe-correct e env' eqenv
... | IA rewrite IA = refl
pe-correct (DFst e) env' eqenv with pe-correct e env' eqenv
... | IA rewrite IA = refl
pe-correct (DSnd e) env' eqenv with pe-correct e env' eqenv
... | IA rewrite IA = refl
pe-correct (DCase e e₁ e₂) {aenv = aenv} {env = env} env' eqenv with ev (pe e aenv) env' | ev (strip e) env | pe-correct e env' eqenv
... | tl c | tl c' | IA rewrite (→tl {x' = c} {y' = c'} (tl c) (tl c') IA refl refl) =
pe-correct e₁
{aenv = cons (EVar hd) (liftEnv (↝-extend ↝-refl) aenv)}
{env = c' ∷ env} (c' ∷ env') (cons (lem-equiv-env-lift-lift (extend c' (refl env')) eqenv) (EVar hd) c' refl)
... | tr c | tr c' | IA rewrite (→tr {x' = c} {y' = c'} (tr c) (tr c') IA refl refl) =
pe-correct e₂
{aenv = cons (EVar hd) (liftEnv (↝-extend ↝-refl) aenv)}
{env = c' ∷ env} (c' ∷ env')
(cons (lem-equiv-env-lift-lift (extend c' (refl env')) eqenv)
(EVar hd) c' refl)
... | tl c | tr c' | ()
... | tr c | tl c' | ()
pe-correct (↑ x e) {aenv = aenv} {env = env} env' eqenv
with pe-correct e env' eqenv
... | IA = lift-correct x env' (pe e aenv) (ev (strip e) env) IA
| 44.758299
| 159
| 0.515192
|
14a11f2496af691122eeac5c57b0300abe89b3d3
| 8,134
|
agda
|
Agda
|
Cubical/Data/DescendingList/Strict/Properties.agda
|
limemloh/cubical
|
df4ef7edffd1c1deb3d4ff342c7178e9901c44f1
|
[
"MIT"
] | null | null | null |
Cubical/Data/DescendingList/Strict/Properties.agda
|
limemloh/cubical
|
df4ef7edffd1c1deb3d4ff342c7178e9901c44f1
|
[
"MIT"
] | null | null | null |
Cubical/Data/DescendingList/Strict/Properties.agda
|
limemloh/cubical
|
df4ef7edffd1c1deb3d4ff342c7178e9901c44f1
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --cubical --safe #-}
open import Cubical.Core.Everything
open import Cubical.Foundations.Everything
open import Agda.Primitive using (lzero)
module Cubical.Data.DescendingList.Strict.Properties
(A : Type₀)
(_>_ : A → A → Type₀)
where
open import Cubical.Data.DescendingList.Strict A _>_
open import Cubical.HITs.ListedFiniteSet renaming (_∈_ to _∈ʰ_)
import Cubical.Data.Empty as Empty
open Empty using (⊥-elim)
open import Cubical.Relation.Nullary.DecidableEq
open import Cubical.Relation.Nullary using (Dec; Discrete) renaming (¬_ to Type¬_)
unsort : SDL → LFSet A
unsort [] = []
unsort (cons x xs x>xs) = x ∷ unsort xs
module _ where
open import Cubical.Relation.Nullary
data Tri (A B C : Set) : Set where
tri-< : A → ¬ B → ¬ C → Tri A B C
tri-≡ : ¬ A → B → ¬ C → Tri A B C
tri-> : ¬ A → ¬ B → C → Tri A B C
module IsoToLFSet
(A-discrete : Discrete A)
(>-isProp : ∀ {x y} → isProp (x > y))
(tri : ∀ x y → Tri (y > x) (x ≡ y) (x > y))
(>-trans : ∀ {x y z} → x > y → y > z → x > z)
(>-irreflexive : ∀ {x} → Type¬ x > x)
where
Tri' : A → A → Set
Tri' x y = Tri (y > x) (x ≡ y) (x > y)
open import Cubical.Foundations.Logic
open import Cubical.HITs.PropositionalTruncation
-- Membership is defined via `LFSet`.
-- This computes just as well as a direct inductive definition,
-- and additionally lets us use the extra `comm` and `dup` paths to prove
-- things about membership.
_∈ˡ_ : A → SDL → hProp lzero
a ∈ˡ l = a ∈ʰ unsort l
Memˡ : SDL → A → hProp lzero
Memˡ l a = a ∈ˡ l
Memʰ : LFSet A → A → hProp lzero
Memʰ l a = a ∈ʰ l
>ᴴ-trans : ∀ x y zs → x > y → y >ᴴ zs → x >ᴴ zs
>ᴴ-trans x y [] x>y y>zs = >ᴴ[]
>ᴴ-trans x y (cons z zs _) x>y (>ᴴcons y>z) = >ᴴcons (>-trans x>y y>z)
≡ₚ-sym : ∀ {A : Set} {x y : A} → [ x ≡ₚ y ] → [ y ≡ₚ x ]
≡ₚ-sym p = recPropTrunc squash (λ p → ∣ sym p ∣) p
>-all : ∀ x l → x >ᴴ l → ∀ a → [ a ∈ˡ l ] → x > a
>-all x (cons y zs y>zs) (>ᴴcons x>y) a a∈l =
⊔-elim (a ≡ₚ y) (a ∈ˡ zs) (λ _ → (x > a) , >-isProp {x} {a})
(λ a≡ₚy → substₚ (λ q → x > q , >-isProp) (≡ₚ-sym a≡ₚy) x>y)
(λ a∈zs → >-all x zs (>ᴴ-trans x y zs x>y y>zs) a a∈zs)
a∈l
>-absent : ∀ x l → x >ᴴ l → [ ¬ (x ∈ˡ l) ]
>-absent x l x>l x∈l = ⊥-elim (>-irreflexive (>-all x l x>l x x∈l))
>ᴴ-isProp : ∀ x xs → isProp (x >ᴴ xs)
>ᴴ-isProp x _ >ᴴ[] >ᴴ[] = refl
>ᴴ-isProp x _ (>ᴴcons p) (>ᴴcons q) = cong >ᴴcons (>-isProp p q)
SDL-isSet : isSet SDL
SDL-isSet = isSetDL.isSetDL A _>_ >-isProp A-discrete where
open import Cubical.Data.DescendingList.Properties
insert : A → SDL → SDL
>ᴴinsert : {x y : A} {u : SDL} → y >ᴴ u → (y > x) → y >ᴴ insert x u
insert x [] = cons x [] >ᴴ[]
insert x (cons y zs good) with tri x y
insert x (cons y zs good) | tri-< x<y _ _ = cons y (insert x zs) (>ᴴinsert good x<y)
insert x (cons y zs good) | tri-≡ _ x≡y _ = cons y zs good
insert x (cons y zs good) | tri-> _ _ x>y = cons x (cons y zs good) (>ᴴcons x>y)
>ᴴinsert >ᴴ[] y>x = >ᴴcons y>x
>ᴴinsert {x} (>ᴴcons {y} y>ys) y>x with tri x y
>ᴴinsert {x} {y} (>ᴴcons {z} z>zs) y>x | tri-< _ _ e = >ᴴcons z>zs
>ᴴinsert {x} (>ᴴcons {y} y>ys) y>x | tri-≡ _ _ e = >ᴴcons y>ys
>ᴴinsert {x} (>ᴴcons {y} y>ys) y>x | tri-> _ _ _ = >ᴴcons y>x
insert-correct : ∀ x ys → unsort (insert x ys) ≡ (x ∷ unsort ys)
insert-correct x [] = refl
insert-correct x (cons y zs y>zs) with tri x y
... | tri-< _ _ _ =
y ∷ unsort (insert x zs) ≡⟨ (λ i → y ∷ (insert-correct x zs i)) ⟩
y ∷ x ∷ unsort zs ≡⟨ comm _ _ _ ⟩
x ∷ y ∷ unsort zs ∎
... | tri-≡ _ x≡y _ = sym (dup y (unsort zs)) ∙ (λ i → (x≡y (~ i)) ∷ y ∷ unsort zs)
... | tri-> _ _ _ = refl
insert-correct₂ : ∀ x y zs → unsort (insert x (insert y zs)) ≡ (x ∷ y ∷ unsort zs)
insert-correct₂ x y zs =
insert-correct x (insert y zs)
∙ cong (λ q → x ∷ q) (insert-correct y zs)
abstract
-- for some reason, making [exclude] non-abstract makes
-- typechecking noticeably slower
exclude : A → (A → hProp lzero) → (A → hProp lzero)
exclude x h a = ¬ a ≡ₚ x ⊓ h a
>-excluded : ∀ x xs → x >ᴴ xs → exclude x (Memʰ (x ∷ unsort xs)) ≡ Memˡ xs
>-excluded x xs x>xs = funExt (λ a → ⇔toPath (to a) (from a)) where
import Cubical.Data.Prod as D
import Cubical.Data.Sum as D
from : ∀ a → [ a ∈ˡ xs ] → [ ¬ a ≡ₚ x ⊓ (a ≡ₚ x ⊔ a ∈ˡ xs) ]
from a a∈xs = (recPropTrunc (snd ⊥) a≢x) D., inr a∈xs where
a≢x : Type¬ (a ≡ x)
a≢x = λ a≡x → (>-absent x xs x>xs (transport (λ i → [ a≡x i ∈ˡ xs ]) a∈xs ))
to : ∀ a → [ ¬ a ≡ₚ x ⊓ (a ≡ₚ x ⊔ a ∈ˡ xs) ] → [ a ∈ˡ xs ]
to a (a≢x D., x) = recPropTrunc (snd (a ∈ˡ xs)) (λ {
(D.inl a≡x) → ⊥-elim (a≢x a≡x);
(D.inr x) → x }) x
cons-eq : ∀ x xs x>xs y ys y>ys → x ≡ y → xs ≡ ys → cons x xs x>xs ≡ cons y ys y>ys
cons-eq x xs x>xs y ys y>ys x≡y xs≡ys i = cons (x≡y i) (xs≡ys i)
(>ᴴ-isProp (x≡y i) (xs≡ys i)
(transp (λ j → (x≡y (i ∧ j)) >ᴴ (xs≡ys) (i ∧ j)) (~ i) x>xs)
(transp (λ j → (x≡y (i ∨ ~ j)) >ᴴ (xs≡ys) (i ∨ ~ j)) i y>ys)
i)
Memˡ-inj-cons : ∀ x xs x>xs y ys y>ys → x ≡ y → Memˡ (cons x xs x>xs) ≡ Memˡ (cons y ys y>ys) → Memˡ xs ≡ Memˡ ys
Memˡ-inj-cons x xs x>xs y ys y>ys x≡y e =
Memˡ xs ≡⟨
sym (>-excluded x xs x>xs)
⟩ exclude x (Memʰ (x ∷ unsort xs)) ≡⟨
(λ i → exclude (x≡y i) (e i))
⟩ exclude y (Memʰ (y ∷ unsort ys)) ≡⟨
(>-excluded y ys y>ys)
⟩ Memˡ ys ∎
Memˡ-inj : ∀ l₁ l₂ → Memˡ l₁ ≡ Memˡ l₂ → l₁ ≡ l₂
Memˡ-inj [] [] eq = refl
Memˡ-inj [] (cons y ys y>ys) eq = ⊥-elim (transport (λ i → [ eq (~ i) y ]) (inl ∣ refl ∣))
Memˡ-inj (cons y ys y>ys) [] eq = ⊥-elim (transport (λ i → [ eq i y ]) (inl ∣ refl ∣))
Memˡ-inj (cons x xs x>xs) (cons y ys y>ys) e =
⊔-elim (x ≡ₚ y) (x ∈ʰ unsort ys)
(λ _ → ((cons x xs x>xs) ≡ (cons y ys y>ys)) , SDL-isSet _ _)
(recPropTrunc (SDL-isSet _ _) with-x≡y)
(⊥-elim ∘ x∉ys)
(transport (λ i → [ e i x ]) (inl ∣ refl ∣)) where
xxs = cons x xs x>xs
x∉ys : [ ¬ x ∈ˡ ys ]
x∉ys x∈ys = ⊥-elim (>-irreflexive y>y) where
y>x : y > x
y>x = (>-all y ys y>ys x x∈ys)
y∈xxs : [ y ∈ˡ (cons x xs x>xs) ]
y∈xxs = (transport (λ i → [ e (~ i) y ]) (inl ∣ refl ∣))
y>y : y > y
y>y = >-all y xxs (>ᴴcons y>x) y y∈xxs
with-x≡y : x ≡ y → (cons x xs x>xs) ≡ (cons y ys y>ys)
with-x≡y x≡y = cons-eq x xs x>xs y ys y>ys x≡y r where
r : xs ≡ ys
r = Memˡ-inj _ _ (Memˡ-inj-cons x xs x>xs y ys y>ys x≡y e)
unsort-inj : ∀ x y → unsort x ≡ unsort y → x ≡ y
unsort-inj x y e = Memˡ-inj x y λ i a → a ∈ʰ (e i)
insert-swap : (x y : A) (zs : SDL) → insert x (insert y zs) ≡ insert y (insert x zs)
insert-swap x y zs =
unsort-inj (insert x (insert y zs)) (insert y (insert x zs))
(unsort (insert x (insert y zs))
≡⟨ (λ i → insert-correct₂ x y zs i) ⟩
x ∷ y ∷ unsort zs
≡⟨ (λ i → comm x y (unsort zs) i) ⟩
y ∷ x ∷ unsort zs
≡⟨ (λ i → insert-correct₂ y x zs (~ i)) ⟩
unsort (insert y (insert x zs)) ∎)
insert-dup : (x : A) (ys : SDL) → insert x (insert x ys) ≡ insert x ys
insert-dup x ys = unsort-inj (insert x (insert x ys)) (insert x ys)
(
unsort (insert x (insert x ys))
≡⟨ (λ i → insert-correct₂ x x ys i) ⟩
x ∷ x ∷ unsort ys
≡⟨ dup x (unsort ys) ⟩
x ∷ unsort ys
≡⟨ (λ i → insert-correct x ys (~ i)) ⟩
unsort (insert x ys) ∎
)
sort : LFSet A → SDL
sort = LFSetRec.f [] insert insert-swap insert-dup SDL-isSet
unsort∘sort : ∀ x → unsort (sort x) ≡ x
unsort∘sort =
LFPropElim.f (λ x → unsort (sort x) ≡ x)
refl
(λ x {ys} ys-hyp → insert-correct x (sort ys) ∙ cong (λ q → x ∷ q) ys-hyp)
(λ xs → trunc (unsort (sort xs)) xs)
sort∘unsort : ∀ x → sort (unsort x) ≡ x
sort∘unsort x = unsort-inj (sort (unsort x)) x (unsort∘sort (unsort x))
SDL-LFSet-iso : Iso SDL (LFSet A)
SDL-LFSet-iso = (iso unsort sort unsort∘sort sort∘unsort)
SDL≡LFSet : SDL ≡ LFSet A
SDL≡LFSet = ua (isoToEquiv SDL-LFSet-iso)
| 36.151111
| 115
| 0.526309
|
ed20ae2c4ac9e6b4e9dceac5fcc28fee5e4a0d6e
| 1,105
|
agda
|
Agda
|
Int.agda
|
nickcollins/dependent-dicts-agda
|
db857f3e7dc9a4793f68504e6365d93ed75d7f88
|
[
"MIT"
] | null | null | null |
Int.agda
|
nickcollins/dependent-dicts-agda
|
db857f3e7dc9a4793f68504e6365d93ed75d7f88
|
[
"MIT"
] | null | null | null |
Int.agda
|
nickcollins/dependent-dicts-agda
|
db857f3e7dc9a4793f68504e6365d93ed75d7f88
|
[
"MIT"
] | null | null | null |
open import Prelude
open import Nat
open import Bij
module Int where
data Int : Set where
+_ : Nat → Int
-[1+_] : Nat → Int
int→nat : Int → Nat
int→nat (+ n) = 1+ (n + n)
int→nat -[1+ n ] = n + n
int→nat:inj : ∀{m n} →
int→nat m == int→nat n →
m == n
int→nat:inj {+ m} {+ n} eq rewrite even-inj {m} {n} (1+inj eq) = refl
int→nat:inj {+ m} { -[1+ n ]} eq = abort (even-not-odd {m} {n} eq)
int→nat:inj { -[1+ m ]} {+ n} eq = abort (even-not-odd {n} {m} (! eq))
int→nat:inj { -[1+ m ]} { -[1+ n ]} eq rewrite even-inj {m} {n} eq = refl
int→nat:surj : (n : Nat) → Σ[ m ∈ Int ] (int→nat m == n)
int→nat:surj Z = -[1+ Z ] , refl
int→nat:surj (1+ Z) = (+ Z) , refl
int→nat:surj (1+ (1+ n)) with int→nat:surj n
int→nat:surj (1+ (1+ .(1+ (n + n)))) | (+ n) , refl = (+ 1+ n) , 1+ap (1+ap n+1+m==1+n+m)
int→nat:surj (1+ (1+ .(n + n))) | -[1+ n ] , refl = -[1+ 1+ n ] , 1+ap n+1+m==1+n+m
instance
IntBij : bij Int Nat
IntBij = record {
convert = int→nat;
inj = int→nat:inj;
surj = int→nat:surj}
| 30.694444
| 91
| 0.467873
|
04411c75f3a7191d6d367cc0746c6dc6200d7230
| 3,231
|
agda
|
Agda
|
Cubical/Functions/Fibration.agda
|
cangiuli/cubical
|
d103ec455d41cccf9b13a4803e7d3cf462e00067
|
[
"MIT"
] | null | null | null |
Cubical/Functions/Fibration.agda
|
cangiuli/cubical
|
d103ec455d41cccf9b13a4803e7d3cf462e00067
|
[
"MIT"
] | 1
|
2022-01-27T02:07:48.000Z
|
2022-01-27T02:07:48.000Z
|
Cubical/Functions/Fibration.agda
|
cangiuli/cubical
|
d103ec455d41cccf9b13a4803e7d3cf462e00067
|
[
"MIT"
] | null | null | null |
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Functions.Fibration where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.GroupoidLaws
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Equiv.Properties
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Path
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.Transport
open import Cubical.Data.Sigma
private
variable
ℓ ℓb : Level
B : Type ℓb
module FiberIso {ℓ} (p⁻¹ : B → Type ℓ) (x : B) where
p : Σ B p⁻¹ → B
p = fst
fwd : fiber p x → p⁻¹ x
fwd ((x' , y) , q) = subst (λ z → p⁻¹ z) q y
bwd : p⁻¹ x → fiber p x
bwd y = (x , y) , refl
fwd-bwd : ∀ x → fwd (bwd x) ≡ x
fwd-bwd y = transportRefl y
bwd-fwd : ∀ x → bwd (fwd x) ≡ x
bwd-fwd ((x' , y) , q) i = h (r i)
where h : Σ[ s ∈ singl x ] p⁻¹ (s .fst) → fiber p x
h ((x , p) , y) = (x , y) , sym p
r : Path (Σ[ s ∈ singl x ] p⁻¹ (s .fst))
((x , refl ) , subst p⁻¹ q y)
((x' , sym q) , y )
r = ΣPathP (isContrSingl x .snd (x' , sym q)
, toPathP (transport⁻Transport (λ i → p⁻¹ (q i)) y))
-- HoTT Lemma 4.8.1
fiberEquiv : fiber p x ≃ p⁻¹ x
fiberEquiv = isoToEquiv (iso fwd bwd fwd-bwd bwd-fwd)
open FiberIso using (fiberEquiv) public
module _ {ℓ} {E : Type ℓ} (p : E → B) where
-- HoTT Lemma 4.8.2
totalEquiv : E ≃ Σ B (fiber p)
totalEquiv = isoToEquiv isom
where isom : Iso E (Σ B (fiber p))
Iso.fun isom x = p x , x , refl
Iso.inv isom (b , x , q) = x
Iso.leftInv isom x i = x
Iso.rightInv isom (b , x , q) i = q i , x , λ j → q (i ∧ j)
module _ (B : Type ℓb) (ℓ : Level) where
private
ℓ' = ℓ-max ℓb ℓ
-- HoTT Theorem 4.8.3
fibrationEquiv : (Σ[ E ∈ Type ℓ' ] (E → B)) ≃ (B → Type ℓ')
fibrationEquiv = isoToEquiv isom
where isom : Iso (Σ[ E ∈ Type ℓ' ] (E → B)) (B → Type ℓ')
Iso.fun isom (E , p) = fiber p
Iso.inv isom p⁻¹ = Σ B p⁻¹ , fst
Iso.rightInv isom p⁻¹ i x = ua (fiberEquiv p⁻¹ x) i
Iso.leftInv isom (E , p) i = ua e (~ i) , fst ∘ ua-unglue e (~ i)
where e = totalEquiv p
-- The path type in a fiber of f is equivalent to a fiber of (cong f)
open import Cubical.Foundations.Function
fiberPath : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} {f : A → B} {b : B} (h h' : fiber f b) →
(Σ[ p ∈ (fst h ≡ fst h') ] (PathP (λ i → f (p i) ≡ b) (snd h) (snd h')))
≡ fiber (cong f) (h .snd ∙∙ refl ∙∙ sym (h' .snd))
fiberPath h h' = cong (Σ (h .fst ≡ h' .fst)) (funExt λ p → flipSquarePath ∙ PathP≡doubleCompPathʳ _ _ _ _)
fiber≡ : ∀ {ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} {f : A → B} {b : B} (h h' : fiber f b)
→ (h ≡ h') ≡ fiber (cong f) (h .snd ∙∙ refl ∙∙ sym (h' .snd))
fiber≡ {f = f} {b = b} h h' =
ΣPath≡PathΣ ⁻¹ ∙
fiberPath h h'
FibrationStr : (B : Type ℓb) → Type ℓ → Type (ℓ-max ℓ ℓb)
FibrationStr B A = A → B
Fibration : (B : Type ℓb) → (ℓ : Level) → Type (ℓ-max ℓb (ℓ-suc ℓ))
Fibration {ℓb = ℓb} B ℓ = Σ[ A ∈ Type ℓ ] FibrationStr B A
| 34.37234
| 106
| 0.542866
|
Subsets and Splits
HTML Code Excluding Scripts
The query retrieves a limited set of HTML content entries that are longer than 8 characters and do not contain script tags, offering only basic filtering with minimal analytical value.