Questions tagged [plfa]

9 questions
3
votes
1 answer

Termination checking failed to prove ∃-even′ : ∀ {n : ℕ} → ∃[ m ] ( 2 * m ≡ n) → even n

The PLFA exercise: what if we write the arithmetic more "naturally" in Quantifiers chapter (https://plfa.github.io/Quantifiers/) ? ∃-even′ : ∀ {n : ℕ} → ∃[ m ] ( 2 * m ≡ n) → even n ∃-odd′ : ∀ {n : ℕ} → ∃[ m ] (2 * m + 1 ≡ n) → odd n I have…
jiamo
  • 1,406
  • 1
  • 17
  • 29
3
votes
3 answers

How to prove ¬ 2 < 1 in agda?

I think I must missing something to prove ¬ 2 < 1. I have ¬1<0 : ¬ (1 < 0) ¬1<0 = λ() ¬0<0 : ¬ (0 < 0) ¬0<0 = λ() ¬2<0 : ¬ (2 < 0) ¬2<0 = λ() contraposition : ∀ {A B : Set} → (A → B) ----------- → (¬ B → ¬ A) contraposition f ¬y x = ¬y (f x)…
jiamo
  • 1,406
  • 1
  • 17
  • 29
3
votes
2 answers

How to get around the implicit vs explicit function type error?

This is from the last chapter of PLFA book. import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; sym; trans; cong) open import Data.Product using (_×_; ∃; ∃-syntax; Σ; Σ-syntax) renaming (_,_ to ⟨_,_⟩) infix 0 _≃_ record _≃_…
Marko Grdinić
  • 3,798
  • 3
  • 18
  • 21
3
votes
1 answer

Is functional extensionality with dependent functions consistent?

postulate extensionality : ∀ {A B : Set} {f g : A → B} → (∀ (x : A) → f x ≡ g x) ----------------------- → f ≡ g I know that the above definition is consistent, but what if a little twist on it is made? postulate extensionality' :…
Marko Grdinić
  • 3,798
  • 3
  • 18
  • 21
2
votes
1 answer

Agda: Function for Propositional Equality

I have been working my way through Programming Language Foundations in Agda, and currently I'm up to "Decidable: Booleans and decision procedures". It seems that, at least for the example given in detail, a function for deciding if something is true…
Sam_W
  • 47
  • 4
2
votes
0 answers

How do multiple rewrites expand into with?

I am a beginner in PLFA, when I read the Induction section, I accidentally wrote a +-swap proof that I can't understand: +-suc': ∀ (m n: ℕ) → m + suc n ≡ suc (m + n) +-suc' zero n = refl +-suc' (suc m) n rewrite +-suc' m n = refl +-swap: ∀ (m n p:…
Noah Ma
  • 21
  • 3
2
votes
1 answer

What is a valid type signature for the `Any-∃` exercise?

#### Exercise `Any-∃` Show that `Any P xs` is isomorphic to `∃[ x ∈ xs ] P x`. Leaving aside the fact that ∃[ x ∈ xs ] P x is not even valid syntax - only Σ[ x ∈ xs ] P x could be valid, none of the type signatures I've tried typecheck for that…
Marko Grdinić
  • 3,798
  • 3
  • 18
  • 21
2
votes
1 answer

Agda on windows: `→ ` not in scope

I'm trying to run chapter 1 of Programming Language Foundations in Agda on a Windows machine. This is a fresh install of Agda 2.5.2 and Emacs 25.1.1 from the MSI and untouched Agda code from the textbook. I'm getting this error: Not in scope: Γ寅
Max Heiber
  • 14,346
  • 12
  • 59
  • 97
1
vote
1 answer

Agda error when checking the inferred type

I'm trying to show that the sum of two odd numbers is even. What is wrong with the last line? data odd : ℕ → Set …
Max Heiber
  • 14,346
  • 12
  • 59
  • 97