Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/practice/acronym/Acronym.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Acronym

def abbreviate (phrase : String) : String :=
sorry
sorry --remove this line and implement the function

end Acronym
4 changes: 2 additions & 2 deletions exercises/practice/affine-cipher/AffineCipher.lean
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace AffineCipher

def encode (phrase : String) (a : Nat) (b : Nat) : Option String :=
sorry
sorry --remove this line and implement the function

def decode (phrase : String) (a : Nat) (b : Nat) : Option String :=
sorry
sorry --remove this line and implement the function

end AffineCipher
2 changes: 1 addition & 1 deletion exercises/practice/all-your-base/AllYourBase.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ namespace AllYourBase
def ValidBase := { x : Nat // x >= 2 }

def rebase (inputBase : ValidBase) (digits : List (Fin inputBase.val)) (outputBase : ValidBase) : List (Fin outputBase.val) :=
sorry
sorry --remove this line and implement the function

end AllYourBase
4 changes: 2 additions & 2 deletions exercises/practice/allergies/Allergies.lean
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ inductive Allergen where
deriving BEq, Repr

def allergicTo (allergen : Allergen) (score : Nat) : Bool :=
sorry
sorry --remove this line and implement the function

def list (score : Nat) : List Allergen :=
sorry
sorry --remove this line and implement the function

end Allergies
2 changes: 1 addition & 1 deletion exercises/practice/anagram/Anagram.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Anagram

def findAnagrams (subject : String) : List String -> List String :=
sorry
sorry --remove this line and implement the function

end Anagram
2 changes: 1 addition & 1 deletion exercises/practice/armstrong-numbers/ArmstrongNumbers.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ArmstrongNumbers

def isArmstrongNumber (number : Nat) : Bool :=
sorry
sorry --remove this line and implement the function

end ArmstrongNumbers
4 changes: 2 additions & 2 deletions exercises/practice/atbash-cipher/AtbashCipher.lean
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace AtbashCipher

def encode (phrase : String) : String :=
sorry
sorry --remove this line and implement the function

def decode (phrase : String) : String :=
sorry
sorry --remove this line and implement the function

end AtbashCipher
12 changes: 6 additions & 6 deletions exercises/practice/bank-account/BankAccount.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ structure Account where
-- it must be able to handle parallel transactions

def Account.create : IO Account :=
sorry
sorry --remove this line and implement the function

def Account.open (account : Account) : IO Unit :=
sorry
sorry --remove this line and implement the function

def Account.close (account : Account) : IO Unit :=
sorry
sorry --remove this line and implement the function

def Account.deposit (amount : Nat) (account : Account) : IO Unit :=
sorry
sorry --remove this line and implement the function

def Account.withdraw (amount : Nat) (account : Account) : IO Unit :=
sorry
sorry --remove this line and implement the function

def Account.balance (account : Account) : IO Nat :=
sorry
sorry --remove this line and implement the function

end BankAccount
2 changes: 1 addition & 1 deletion exercises/practice/binary-search/BinarySearch.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace BinarySearch

def find (value : Int) (array : Array Int) : Option Nat :=
sorry
sorry --remove this line and implement the function

end BinarySearch
2 changes: 1 addition & 1 deletion exercises/practice/bob/Bob.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Bob

def response (heyBob : String) : String :=
sorry
sorry --remove this line and implement the function

end Bob
2 changes: 1 addition & 1 deletion exercises/practice/book-store/BookStore.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ namespace BookStore
def Book := { x : Nat // x ≥ 1 ∧ x ≤ 5 }

def total (basket : List Book) : Nat :=
sorry
sorry --remove this line and implement the function

end BookStore
2 changes: 1 addition & 1 deletion exercises/practice/camicia/Camicia.lean
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ structure Result where
deriving BEq, Repr

def simulateGame (playerA playerB : List Card) : Result :=
sorry
sorry --remove this line and implement the function

end Camicia
2 changes: 1 addition & 1 deletion exercises/practice/change/Change.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ inductive Result where
deriving BEq, Repr

def findFewestCoins (coins : Array Nat) (target : Int) : Result :=
sorry
sorry --remove this line and implement the function

end Change
12 changes: 7 additions & 5 deletions exercises/practice/clock/Clock.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ structure Clock where

-- define equality between Clocks
instance : BEq Clock where
beq clock1 clock2 := sorry
beq clock1 clock2 :=
sorry --remove this line and implement the function

-- define how a Clock should be converted to a String
instance : ToString Clock where
toString clock := sorry
toString clock :=
sorry --remove this line and implement the function

def create (hour : Int) (minute : Int) : Clock :=
sorry
sorry --remove this line and implement the function

def add (clock : Clock) (minute : Int) : Clock :=
sorry
sorry --remove this line and implement the function

def subtract (clock : Clock) (minute : Int) : Clock :=
sorry
sorry --remove this line and implement the function

end Clock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ namespace CollatzConjecture
def Positive := { x : Nat // 0 < x }

def steps (n : Positive) : Nat :=
sorry
sorry --remove this line and implement the function

end CollatzConjecture
21 changes: 11 additions & 10 deletions exercises/practice/complex-numbers/ComplexNumbers.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,34 @@ structure ComplexNumber where

/- define how a complex number should be constructed out of a literal number -/
instance {n : Nat} : OfNat ComplexNumber n where
ofNat := sorry
ofNat :=
sorry --remove this line and implement the function

def real (z : ComplexNumber) : Float :=
sorry
sorry --remove this line and implement the function

def imaginary (z : ComplexNumber) : Float :=
sorry
sorry --remove this line and implement the function

def mul (z1 : ComplexNumber) (z2 : ComplexNumber) : ComplexNumber :=
sorry
sorry --remove this line and implement the function

def div (z1 : ComplexNumber) (z2 : ComplexNumber) : ComplexNumber :=
sorry
sorry --remove this line and implement the function

def sub (z1 : ComplexNumber) (z2 : ComplexNumber) : ComplexNumber :=
sorry
sorry --remove this line and implement the function

def add (z1 : ComplexNumber) (z2 : ComplexNumber) : ComplexNumber :=
sorry
sorry --remove this line and implement the function

def abs (z : ComplexNumber) : Float :=
sorry
sorry --remove this line and implement the function

def conjugate (z : ComplexNumber) : ComplexNumber :=
sorry
sorry --remove this line and implement the function

def exp (z : ComplexNumber) : ComplexNumber :=
sorry
sorry --remove this line and implement the function

end ComplexNumbers
2 changes: 1 addition & 1 deletion exercises/practice/connect/Connect.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Connect

def winner (board : Array String) : Char :=
sorry
sorry --remove this line and implement the function

end Connect
2 changes: 1 addition & 1 deletion exercises/practice/crypto-square/CryptoSquare.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace CryptoSquare

def ciphertext (plaintext : String) : String :=
sorry
sorry --remove this line and implement the function

end CryptoSquare
2 changes: 1 addition & 1 deletion exercises/practice/darts/Darts.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Darts

def score (x : Float) (y : Float) : Int :=
sorry
sorry --remove this line and implement the function

end Darts
2 changes: 1 addition & 1 deletion exercises/practice/diamond/Diamond.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Diamond

def rows (letter : Char) : List String :=
sorry
sorry --remove this line and implement the function

end Diamond
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace DifferenceOfSquares

def squareOfSum (number : Nat) : Nat :=
sorry
sorry --remove this line and implement the function

def sumOfSquares (number : Nat) : Nat :=
sorry
sorry --remove this line and implement the function

def differenceOfSquares (number : Nat) : Nat :=
sorry
sorry --remove this line and implement the function

end DifferenceOfSquares
6 changes: 3 additions & 3 deletions exercises/practice/dnd-character/DndCharacter.lean
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ structure Character where
hitpoints : Int

def modifier (score : Nat) : Int :=
sorry
sorry --remove this line and implement the function

def ability {α} [RandomGen α] (generator : α) : (Nat × α) :=
sorry
sorry --remove this line and implement the function

def Character.new {α} [RandomGen α] (generator : α) : (Character × α) :=
sorry
sorry --remove this line and implement the function

end DndCharacter
2 changes: 1 addition & 1 deletion exercises/practice/dominoes/Dominoes.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def Half := { x : Nat // x ≥ 1 ∧ x ≤ 6 }
def Stone := Half × Half

def canChain (dominoes : List Stone) : Bool :=
sorry
sorry --remove this line and implement the function

end Dominoes
2 changes: 1 addition & 1 deletion exercises/practice/eliuds-eggs/EliudsEggs.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EliudsEggs

def eggCount (number : Nat) : Nat :=
sorry
sorry --remove this line and implement the function

end EliudsEggs
2 changes: 1 addition & 1 deletion exercises/practice/etl/Etl.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import Std
namespace Etl

def transform (legacy : Std.HashMap Nat (List Char)) : Std.HashMap Char Nat :=
sorry
sorry --remove this line and implement the function

end Etl
2 changes: 1 addition & 1 deletion exercises/practice/flatten-array/FlattenArray.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ inductive Box (α : Type) : Type where
| many (boxes : Array (Box α))

def flatten (box : Box Int) : Array Int :=
sorry
sorry --remove this line and implement the function

end FlattenArray
2 changes: 1 addition & 1 deletion exercises/practice/forth/Forth.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Forth

def evaluate (instructions : List String) : Except String (List Int) :=
sorry
sorry --remove this line and implement the function

end Forth
2 changes: 1 addition & 1 deletion exercises/practice/game-of-life/GameOfLife.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace GameOfLife

def tick (matrix : Array (Array Bool)) : Array (Array Bool) :=
sorry
sorry --remove this line and implement the function

end GameOfLife
2 changes: 1 addition & 1 deletion exercises/practice/gigasecond/Gigasecond.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import Std.Time
namespace Gigasecond

def add (moment : Std.Time.PlainDateTime) : Std.Time.PlainDateTime :=
sorry
sorry --remove this line and implement the function

end Gigasecond
4 changes: 2 additions & 2 deletions exercises/practice/grains/Grains.lean
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Grains

def grains (square : Int) : Option Nat :=
sorry
sorry --remove this line and implement the function

def totalGrains : Nat :=
sorry
sorry --remove this line and implement the function

end Grains
2 changes: 1 addition & 1 deletion exercises/practice/grep/Grep.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Grep

def grep (args : List String) : IO Unit :=
sorry
sorry --remove this line and implement the function

end Grep
2 changes: 1 addition & 1 deletion exercises/practice/hamming/Hamming.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Hamming

def distance (strand1 : String) (strand2 : String) : Option Nat :=
sorry
sorry --remove this line and implement the function

end Hamming
12 changes: 6 additions & 6 deletions exercises/practice/high-scores/HighScores.lean
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
namespace HighScores

def latestList (scores : List Nat) : Nat :=
sorry
sorry --remove this line and implement the function

def latestArray (scores : Array Nat) : Nat :=
sorry
sorry --remove this line and implement the function

def personalBestList (scores : List Nat) : Nat :=
sorry
sorry --remove this line and implement the function

def personalBestArray (scores : Array Nat) : Nat :=
sorry
sorry --remove this line and implement the function

def personalTopThreeList (scores : List Nat) : List Nat :=
sorry
sorry --remove this line and implement the function

def personalTopThreeArray (scores : Array Nat) : Array Nat :=
sorry
sorry --remove this line and implement the function

end HighScores
2 changes: 1 addition & 1 deletion exercises/practice/house/House.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ namespace House
abbrev VerseIndex := { x : Nat // 1 ≤ x ∧ x ≤ 12 }

def recite (startVerse endVerse : VerseIndex) : String :=
sorry
sorry --remove this line and implement the function

end House
Loading
Loading