lean4-htt/tests/pkg
Wojciech Różowski 0195fdf9aa
feat: add coinductive command to specify coinductive predicates (#10333)
This PR introduces a `coinductive` keyword, that can be used to define
coinductive predicates via a syntax identical to the one for `inductive`
keyword. The machinery relies on the implementation of elaboration of
inductive types and extracts an endomap on the appropriate space of the
predicates from the definition that is then fed to the
`PartialFixpoint`. Upon elaborating definitions, all the constructors
are declared through automatically generated lemmas.

For example, infinite sequence of transitions in a relation, can be
given by the following:
```lean4
section
variable (α : Type)
coinductive infSeq (r : α → α → Prop) : α → Prop where
  | step : r a b → infSeq r b → infSeq r a
  
/--
info: infSeq.coinduct (α : Type) (r : α → α → Prop) (pred : α → Prop) (hyp : ∀ (x : α), pred x → ∃ b, r x b ∧ pred b)
  (x✝ : α) : pred x✝ → infSeq α r x✝
-/
#guard_msgs in
#check infSeq.coinduct

/--
info: infSeq.step (α : Type) (r : α → α → Prop) {a b : α} : r a b → infSeq α r b → infSeq α r a
-/
#guard_msgs in
#check infSeq.step
end
```
The machinery also supports `mutual` blocks, as well as mixing inductive
and coinductive predicate definitions:
```lean4
mutual
  coinductive tick : Prop where
  | mk : ¬tock → tick

  inductive tock : Prop where
  | mk : ¬tick → tock
end

/--
info: tick.mutual_induct (pred_1 pred_2 : Prop) (hyp_1 : pred_1 → pred_2 → False) (hyp_2 : (pred_1 → False) → pred_2) :
  (pred_1 → tick) ∧ (tock → pred_2)
-/
#guard_msgs in
#check tick.mutual_induct
```

---------

Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>
2025-10-07 18:04:51 +00:00
..
builtin_attr refactor: update built-in tactic error messages (#9633) 2025-07-31 14:16:57 +00:00
debug feat: debug_assert! (#7256) 2025-03-03 16:34:44 +00:00
deriving chore: update tests to account for .lake 2023-11-13 20:31:24 -05:00
frontend feat: lake: support plugins (#7001) 2025-02-14 04:57:31 +00:00
initialize fix: missing unboxing in interpreter when loading initialized value (#4512) 2024-06-20 10:06:24 +00:00
linter_set feat: implement "linter sets" that can be turned on as a group (#8106) 2025-05-14 23:30:42 +00:00
misc fix: local syntax should create private definitions 2025-08-19 14:49:12 -07:00
module fix: allow meta decls in #eval (#10545) 2025-09-26 15:10:33 +00:00
path with spaces fix: calling programs with spaces on Windows (#4515) 2024-07-26 17:35:05 +00:00
prv chore: error messages consistency (#10143) 2025-08-26 17:55:43 +00:00
rebuild refactor: lake: mv tests/examples to top-level tests dir (#10688) 2025-10-06 21:47:57 +00:00
setup feat: server support for new module setup (#8699) 2025-06-23 18:00:14 +00:00
signal feat: add signal handling support using libuv (#9258) 2025-09-15 13:09:50 +00:00
test_extern test: disable flaky test 2025-04-29 17:34:10 +02:00
user_attr chore: upstream Nat material from mathlib (#7971) 2025-04-16 06:55:32 +00:00
user_attr_app feat: add coinductive command to specify coinductive predicates (#10333) 2025-10-07 18:04:51 +00:00
user_ext chore: disable nondeterministic test 2025-04-24 11:30:26 +02:00
user_opt feat: accept user-defined options on the cmdline (#4741) 2024-08-02 12:24:56 +00:00
user_plugin feat: smarter plugin loading (#7090) 2025-02-18 23:03:52 +00:00
.gitignore chore: ignore forgotten Lake test artifacts 2023-11-17 21:25:41 -05:00