Skip to content

Commit ea86c67

Browse files
authored
chore: simplify the DFA example (#430)
The `deriving Fintype` machinery in mathlib already does the hard work here, and the `Finite` theorems were useless.
1 parent b39710e commit ea86c67

1 file changed

Lines changed: 4 additions & 22 deletions

File tree

CslibTests/DFA.lean

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,19 @@ open Cslib.Automata
1515
inductive Floor where
1616
| one
1717
| two
18-
deriving DecidableEq
19-
20-
def Floor.fintype : Fintype Floor := {
21-
elems := {.one, .two}
22-
complete floor := by grind [Floor]
23-
}
24-
25-
theorem Floor.finite : Finite Floor := Floor.fintype.finite
18+
deriving DecidableEq, Fintype
2619

2720
inductive Direction where
2821
| up
2922
| down
30-
deriving DecidableEq
31-
32-
def Direction.fintype : Fintype Direction := {
33-
elems := {.up, .down}
34-
complete dir := by grind [Direction]
35-
}
23+
deriving DecidableEq, Fintype
3624

37-
theorem Direction.finite : Finite Direction := Direction.fintype.finite
38-
39-
def tr (floor : Floor) (dir : Direction) : Floor :=
40-
match floor, dir with
25+
def elevator : DA Floor Direction where
26+
tr
4127
| .one, .up => .two
4228
| .one, .down => .one
4329
| .two, .up => .two
4430
| .two, .down => .one
45-
46-
def elevator : DA Floor Direction := {
47-
tr := tr
4831
start := .one
49-
}
5032

5133
end CslibTests

0 commit comments

Comments
 (0)