forked from thanhnguyen-aws/plausible
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathListRelations.lean
More file actions
39 lines (33 loc) · 1.38 KB
/
Copy pathListRelations.lean
File metadata and controls
39 lines (33 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/-- List membership expressed as an inductive relation:
`InList x l` means `x ∈ l`. -/
inductive InList : Nat → List Nat → Prop where
| Here : ∀ x l, InList x (x::l)
| There : ∀ x y l, InList x l → InList x (y::l)
-- Thanks to Chase Johnson for providing the example inductive relations in this file!
/-- Example inductive relation involving pattern-matching on just one input -/
inductive MinOk : List Nat → List Nat → Prop where
| MO_empty : MinOk [] []
| MO_present : ∀ x l l',
MinOk l l' →
InList x l →
MinOk l (x::l')
/-- Example inductive relation involving simultaneous pattern-matching on multiple inputs -/
inductive MinEx : Nat → List Nat → List Nat → Prop where
| ME_empty : MinEx .zero [] []
| ME_present : ∀ x l n l',
MinEx n l l' →
InList x l →
MinEx (Nat.succ n) l (x::l')
/-- Example inductive relation involving a non-trivial function call
(`l'' = [x] + l'`) in the conclusion -/
inductive MinEx2 : Nat → List Nat → List Nat → Prop where
| ME_empty : MinEx2 .zero [] []
| ME_present : ∀ x l l',
MinEx2 x l l' →
MinEx2 (Nat.succ x) l ([x] ++ l')
/-- Example inductive relation involving a non-trivial function call
(e.g. `[x] ++ l`) in the conclusion -/
inductive MinEx3 : Nat → List Nat → List Nat → Prop where
| ME_empty : MinEx3 .zero [] []
| ME_present : ∀ x l,
MinEx3 x l ([x] ++ l)