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
9 changes: 9 additions & 0 deletions Bib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ def enderton2001 : Article where
volume := inlines!""
number := inlines!""

def nederpelt2014 : Article where
title := inlines!"Type Theory and Formal Proof: An Introduction"
authors := #[inlines!"Rob Nederpelt", inlines!"Herman Geuvers"]
journal := inlines!"Cambridge University Press, Cambridge"
year := 2014
month := none
volume := inlines!""
number := inlines!""

def FAA2025 : Article where
title := inlines!"Formalizing Analysis of Algorithms, Autumn 2025"
authors := #[inlines!"Sorrachai Yingchareonthawornchai"]
Expand Down
8 changes: 4 additions & 4 deletions Book.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import Bib

import CSwL.IntroCS
import CSwL.IntroL
import CSwL.Morphology
import CSwL.Games
import CSwL.Logic
import CSwL.Sets
import CSwL.SeaBattle
import CSwL.Morphology
import CSwL.InfEngine
import CSwL.English

Expand All @@ -29,9 +29,9 @@ set_option verso.code.warnLineLength 80
#doc (Manual) "Semântica computacional com Lean" =>
{include CSwL.IntroCS}
{include CSwL.IntroL}
{include CSwL.Morphology}
{include CSwL.Games}
{include CSwL.Logic}
{include CSwL.Sets}
{include CSwL.SeaBattle}
{include CSwL.Morphology}
{include CSwL.InfEngine}
{include CSwL.English}
44 changes: 5 additions & 39 deletions CSwL/English.lean
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,20 @@ A abreviações são como `def` mas são `unfold` automaticamente.

```lean
abbrev Sentences := List Sentence
```

```lean (name := c2eval37)
#eval Subject.Chomsky
```

```leanOutput c2eval37
English.Subject.Chomsky
```

```lean (name := c2eval38)
#eval Sentence.S Subject.Chomsky
(Predicate.Wrote "Syntactic Structures")
```

```leanOutput c2eval38
English.Sentence.S (English.Subject.Chomsky) (English.Predicate.Wrote "Syntactic Structures")
```

A última saida acima lembra uma árvore, o que iremos chamar de _árvore
sintática_.

```
Sentence
/ \
Subject Predicate
```display
Sentence
|- Subject
|- Predicate
```

O passo inverso é a _geração_, serializar uma estrutura que representa
Expand All @@ -82,19 +70,6 @@ instâncias para `ToString` de nossos tipos. Criar uma instância de uma
classe é implementar os campos que a classe demanda e classes são
`structure`. Algumas variações de sintaxe na declaração das instâncias.

```lean (name := c2print7)
#print ToString
```

```leanOutput c2print7
class ToString.{u} (α : Type u) : Type u
number of parameters: 1
fields:
ToString.toString : α → String
constructor:
ToString.mk.{u} {α : Type u} (toString : α → String) : ToString α
```

```lean
instance : ToString Subject where
toString
Expand All @@ -121,10 +96,6 @@ def makeS (s : Subject) (p : Predicate) : Sentence := .S s p
makeS .Chomsky (makeP "Syntactic Structures")
```

```leanOutput c2eval39
Chomsky wrote "Syntactic Structures"
```


## Por que isso serve à semântica

Expand Down Expand Up @@ -201,15 +172,10 @@ E a sentença, com o sujeito no lugar.

```lean
def dorothyLikesToto : t := likesToto dorothy
```

```lean (name := c3check12)
#check dorothyLikesToto
```

```leanOutput c3check12
English.dorothyLikesToto : t
```

A derivação da sentença é uma sequência de duas aplicações, e cada
passo é conferido pelos tipos. Uma combinação mal formada não chega a
Expand Down Expand Up @@ -299,6 +265,7 @@ entidade: `#check likes "Toto"` não compila, e o erro aponta o
argumento — uma `String` onde se esperava um `e`. É a versão tipada de
dizer que a combinação não é bem formada.


# Um fragmento do inglês

Em seguida, vamos implementar um fragmento um pouco mais realistico do inglês. Ela é deliberadamente básica e grosseira, queremos capturar a sintaxe de sentenças como:
Expand Down Expand Up @@ -789,7 +756,6 @@ O problema é que `rcn4`/`rcn5` não são recursivas: cada uma coordena exatamen
::::



```lean
end English
```
25 changes: 0 additions & 25 deletions CSwL/Games.lean

This file was deleted.

132 changes: 0 additions & 132 deletions CSwL/Games/Mastermind.lean

This file was deleted.

Loading