The limits of type theory: computation vs. interaction
researchblogs.cs.bham.ac.uk
The limits of type theory: computation vs. interaction
1–10 of 70 posts
Re: The limits of type theory: computation vs. interaction
#2Re: The limits of type theory: computation vs. interaction
#3For example, looking at this:
>>> 0 if 1 else 'a'
made me remember one of me older thoughts on this subject, more exactly if the word 2/two from a sentence like this: "there are two apples on the table" should be treated as an Integer or a String. Some would say that we should only treat it as an Integer if we intend to do computations on it (for example adding those 2 apples to another 3 apples), to which I'd ask how come the word's essence (its "transformation" from a String to an Integer) changes depending on the type of action we intend to apply on it? (so to speak, English is not my primary language).
Anyway, things in this domain are damn complicated, and have been so for the last 2500 years at least, starting with Socrates (or was it Plato, in fact?) who was asking about the essence/idea of a table (i.e about its type), i.e. is a table still a table if it only has 3 legs remaining? what about two?, and continuing with Aristotle's categories and closer to our days with Frege and Cantor (somehow the table problem can be connected to the latter's continuum hypothesis, but I digress). So one of my points is that this is not only a computer science problem.
Re: The limits of type theory: computation vs. interaction
#4I'm in a no way a computer-science expert, just a mere programmer, but by the looks of it this discussion all boils down to the (quite big, I'd say) impedance mismatch between real life ("computer programs" in this article) and us, as humans, trying to understand said life and applying rules to it (by in this case applying "type theory"). For example, looking at this: >>> 0 if 1 else 'a' made me remember one of me ol…
Re: The limits of type theory: computation vs. interaction
#5> People who think they understand something about the theory of programming languages, including me, tend to agree that what Python does is wrong.
> In fact you can program heterogeneous lists in dependently typed languages, but it’s unreasonably complicated.
Here's some Agda code that shows that both heterogeneous if statements and lists make sense and are easy to work with in type theory.
data Bool : Set where
true false : Bool
if : ∀ {ℓ} {P : Bool → Set ℓ} (b : Bool) → P true → P false → P b
if true t f = t
if false t f = f
postulate Char : Set
{-# BUILTIN CHAR Char #-}
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
{-# BUILTIN NATURAL ℕ #-}
ex₁ : ℕ
ex₁ = if {P = λ b → if b ℕ Char} true 0 'a'
infixr 5 _∷_
data List {a} (A : Set a) : Set a where
[] : List A
_∷_ : A → List A → List A
data HList : List Set → Set where
[] : HList []
_∷_ : ∀ {A As} → A → HList As → HList (A ∷ As)
ex₂ : HList (ℕ ∷ Char ∷ (ℕ → ℕ) ∷ [])
ex₂ = 1 ∷ 'a' ∷ suc ∷ []Re: The limits of type theory: computation vs. interaction
#6I feel the same way. Uniqueness typing can work as the clue between component and upper lever abstraction.
Re: The limits of type theory: computation vs. interaction
#7I'd disagree with the two statements: > People who think they understand something about the theory of programming languages, including me, tend to agree that what Python does is wrong. > In fact you can program heterogeneous lists in dependently typed languages, but it’s unreasonably complicated. Here's some Agda code that shows that both heterogeneous if statements and lists make sense and are easy to work with in…
Re: The limits of type theory: computation vs. interaction
#8Re: The limits of type theory: computation vs. interaction
#9I'd disagree with the two statements: > People who think they understand something about the theory of programming languages, including me, tend to agree that what Python does is wrong. > In fact you can program heterogeneous lists in dependently typed languages, but it’s unreasonably complicated. Here's some Agda code that shows that both heterogeneous if statements and lists make sense and are easy to work with in…
Re: The limits of type theory: computation vs. interaction
#10The program will need to keep track of the types at runtime, but that's also true of Python, so what?