{-# OPTIONS --allow-unsolved-metas #-}
data Bool : Set where
false true : Bool
data ℕ : Set where
zero : ℕ
succ : ℕ → ℕ
data ⊥ : Set where
data _⊎_ (A B : Set) : Set where
left : A → A ⊎ B
right : B → A ⊎ B
¬ : Set → Set
¬ X = X → ⊥
! : Bool → Bool
! false = true
! true = false
_+_ : ℕ → ℕ → ℕ
zero + b = b
succ a + b = succ (a + b)
_·_ : ℕ → ℕ → ℕ
zero · b = zero
succ a · b = b + (a · b)
pred : ℕ → ℕ
pred zero = zero
pred (succ a) = a
infix 5 _≡_
data _≡_ {X : Set} : X → X → Set where
refl : {a : X} → a ≡ a
{-# BUILTIN EQUALITY _≡_ #-}
infix 3 _∎
infixr 2 _≡⟨_⟩_ _≡⟨⟩_
infix 1 begin_
symm : {A : Set} {x y : A} → x ≡ y → y ≡ x
symm p = {!!}
trans : {A : Set} {x y z : A} → x ≡ y → y ≡ z → x ≡ z
trans p q = {!!}
_≡⟨_⟩_ : {A : Set} {y z : A} → (x : A) → x ≡ y → y ≡ z → x ≡ z
x ≡⟨ p ⟩ q = trans p q
_≡⟨⟩_ : {A : Set} {y : A} → (x : A) → (q : x ≡ y) → x ≡ y
x ≡⟨⟩ q = q
_∎ : {A : Set} → (x : A) → x ≡ x
x ∎ = refl
begin_ : {A : Set} {x y : A} → x ≡ y → x ≡ y
begin p = p
dni : {A B : Set} → A → ((A → ⊥) → ⊥)
dni p = λ f → f p
contraposition : {A B : Set} → (A → B) → (¬ B → ¬ A)
contraposition f p = {!!}
de-morgan₁ : {A B : Set} → ¬ (A ⊎ B) → ¬ A
de-morgan₁ = {!!}
de-morgan₂ : {A B : Set} → ¬ (A ⊎ B) → ¬ B
de-morgan₂ = {!!}
cong : {A B : Set} {x y : A} → (f : A → B) → x ≡ y → f x ≡ f y
cong f p = {!!}
equal→pwequal : {A B : Set} {f g : A → B} {x : A} → f ≡ g → f x ≡ g x
equal→pwequal p = {!!}
transport : {A : Set} {x y : A} → (F : A → Set) → x ≡ y → F x → F y
transport F p s = {!!}
lemma-pred-succ : (a : ℕ) → pred (succ a) ≡ a
lemma-pred-succ a = {!!}
lemma₀ : ! (! true) ≡ true
lemma₀ = refl
lemma₁ : ! (! false) ≡ false
lemma₁ = refl
lemma₂ : (x : Bool) → ! (! x) ≡ x
lemma₂ false = refl
lemma₂ true = refl
lemma₃ : {x : Bool} → ! (! x) ≡ x
lemma₃ {false} = refl
lemma₃ {true} = refl
lemma₄ : ! (! false) ≡ false
lemma₄ = lemma₂ false
lemma₅ : ! (! false) ≡ false
lemma₅ = lemma₃
even? : ℕ → Bool
even? zero = true
even? (succ n) = ! (even? n)
even?' : ℕ → Bool
even?' zero = true
even?' (succ zero) = false
even?' (succ (succ n)) = even?' n
lemma-even?-even?' : (a : ℕ) → even? a ≡ even?' a
lemma-even?-even?' zero = refl
lemma-even?-even?' (succ zero) = refl
lemma-even?-even?' (succ (succ a)) = trans lemma₃ (lemma-even?-even?' a)
lemma-even?-even?'-second-proof : (a : ℕ) → even? a ≡ even?' a
lemma-even?-even?'-second-proof zero = refl
lemma-even?-even?'-second-proof (succ zero) = refl
lemma-even?-even?'-second-proof (succ (succ a)) with even? a with lemma-even?-even?'-second-proof a
... | false | p = p
... | true | p = p
third-proof : (a : ℕ) → even? a ≡ even?' a
third-proof zero = refl
third-proof (succ zero) = refl
third-proof (succ (succ a)) = begin
even? (succ (succ a)) ≡⟨⟩
! (even? (succ a)) ≡⟨⟩
! (! (even? a)) ≡⟨ lemma₃ ⟩
even? a ≡⟨ third-proof a ⟩
even?' a ≡⟨⟩
even?' (succ (succ a)) ∎
lemma-succ-pred : ((a : ℕ) → succ (pred a) ≡ a) → ⊥
lemma-succ-pred f = {!!}
data Positive : ℕ → Set where
succs-are-positive : {n : ℕ} → Positive (succ n)
lemma-succ-pred' : (a : ℕ) → Positive a → succ (pred a) ≡ a
lemma-succ-pred' (succ b) p = refl
lemma-+-zero : (a : ℕ) → (a + zero) ≡ a
lemma-+-zero a = {!!}
lemma-+-succ : (a b : ℕ) → (a + succ b) ≡ succ (a + b)
lemma-+-succ zero b = refl
lemma-+-succ (succ a) b = begin
succ a + succ b ≡⟨⟩
succ (a + succ b) ≡⟨ cong succ (lemma-+-succ a b) ⟩
succ (succ (a + b)) ≡⟨⟩
succ (succ a + b) ∎
lemma-+-commutative : (a b : ℕ) → (a + b) ≡ (b + a)
lemma-+-commutative a b = {!!}
lemma-+-associative : (a b c : ℕ) → (a + (b + c)) ≡ ((a + b) + c)
lemma-+-associative a b c = {!!}
lemma-distributive : (a b c : ℕ) → ((a + b) · c) ≡ ((a · c) + (b · c))
lemma-distributive a b c = {!!}
data Even : ℕ → Set where
base-even : Even zero
step-even : {n : ℕ} → Even n → Even (succ (succ n))
lemma-double-even : (a : ℕ) → Even (a + a)
lemma-double-even a = {!!}
data List (A : Set) : Set where
[] : List A
_∷_ : A → List A → List A
module _ {A : Set} where
_∷ʳ_ : List A → A → List A
[] ∷ʳ y = y ∷ []
(x ∷ xs) ∷ʳ y = x ∷ (xs ∷ʳ y)
reverse : List A → List A
reverse [] = []
reverse (x ∷ xs) = reverse xs ∷ʳ x
lemma-reverse-∷ʳ : (ys : List A) (x : A) → reverse (ys ∷ʳ x) ≡ (x ∷ reverse ys)
lemma-reverse-∷ʳ ys x = {!!}
lemma-reverse-reverse : (xs : List A) → reverse (reverse xs) ≡ xs
lemma-reverse-reverse xs = {!!}
_++_ : List A → List A → List A
[] ++ ys = ys
(x ∷ xs) ++ ys = x ∷ (xs ++ ys)
data _≈_ : List A → List A → Set where
both-empty : [] ≈ []
both-same-cons : {xs ys : List A} {x y : A} → x ≡ y → xs ≈ ys → (x ∷ xs) ≈ (y ∷ ys)
≡→≈ : {xs ys : List A} → xs ≡ ys → xs ≈ ys
≡→≈ p = {!!}
≈→≡ : {xs ys : List A} → xs ≈ ys → xs ≡ ys
≈→≡ p = {!!}
data Vector (A : Set) : ℕ → Set where
[] : Vector A zero
_∷_ : {n : ℕ} → A → Vector A n → Vector A (succ n)
drop : {A : Set} {n : ℕ} (k : ℕ) → Vector A (k + n) → Vector A n
drop zero xs = xs
drop (succ k') (x ∷ xs') = drop k' xs'
take : {A : Set} {n : ℕ} (k : ℕ) → Vector A (k + n) → Vector A k
take zero xs = []
take (succ k') (x ∷ xs') = x ∷ take k' xs'
_++ᵥ_ : {A : Set} {n m : ℕ} → Vector A n → Vector A m → Vector A (n + m)
[] ++ᵥ ys = ys
(x ∷ xs') ++ᵥ ys = x ∷ (xs' ++ᵥ ys)
lemma-take-drop : {A : Set} {n : ℕ} → (k : ℕ) → (xs : Vector A (k + n)) → (take k xs ++ᵥ drop k xs) ≡ xs
lemma-take-drop = {!!}