Created
December 31, 2021 05:42
-
-
Save amarmaduke/b6e412d25d08095edc37af8df4d0fad3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import stdlib. | |
module ords (U:Nat ➔ ★). | |
opaque U_zero_is_unit : TpEq·(U zero)·Unit = ●. | |
data Ord : ★ = | |
| base : Ord | |
| next : Π n:Nat. U n ➔ Ord. | |
nextProjCode : Ord ➔ Nat | |
= λ o. σ o { | |
| base ➔ zero | |
| next n u ➔ n | |
}. | |
nextProj : Π o:Ord. U (nextProjCode o) | |
= λ o. σ o { | |
| base ➔ cast -U_zero_is_unit.2 unit | |
| next n u ➔ u | |
}. | |
injNextTypeWitness : ∀ na:Nat. ∀ a:U na. ∀ nb:Nat. ∀ b:U nb. | |
{next na a ≃ next nb b} ➾ {na ≃ nb} | |
= Λ na. Λ a. Λ nb. Λ b. Λ e. | |
ρ e @ x. {nextProjCode x ≃ nextProjCode (next nb b)} | |
- β. | |
injNextType : ∀ na:Nat. ∀ a:U na. ∀ nb:Nat. ∀ b:U nb. | |
{next na a ≃ next nb b} ➾ Cast·(U na)·(U nb) | |
= Λ na. Λ a. Λ nb. Λ b. Λ e. | |
ρ (injNextTypeWitness -na -a -nb -b -e) | |
- castRefl·(U nb). | |
injNext : ∀ na:Nat. ∀ a:U na. ∀ nb:Nat. ∀ b:U nb. | |
{next na a ≃ next nb b} ➾ {a ≃ b} | |
= Λ na. Λ a. Λ nb. Λ b. Λ e. | |
ρ e @ x. {nextProj x ≃ nextProj (next nb b)} | |
- β. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment