I defined this inductive type for representing JSON elements
inductive JSON where
| null
| bool (value : Bool)
| string (value : String)
| number (value : Float)
| object (data : AssocList String JSON)
| array (elements : List JSON)
Which results in the following definition of JSON.rec
:
recursor JSON.rec.{u} :
{motive_1 : JSON → Sort u} →
{motive_2 : AssocList String JSON → Sort u} →
{motive_3 : List JSON → Sort u} →
motive_1 JSON.null →
((value : Bool) → motive_1 (JSON.bool value)) →
((value : String) → motive_1 (JSON.string value)) →
((value : Float) → motive_1 (JSON.number value)) →
((data : AssocList String JSON) → motive_2 data → motive_1 (JSON.object data)) →
((elements : List JSON) → motive_3 elements → motive_1 (JSON.array elements)) →
motive_2 AssocList.nil →
((key : String) → (value : JSON) → (tail : AssocList String JSON) →
motive_1 value → motive_2 tail → motive_2 (AssocList.cons key value tail)) →
motive_3 [] →
((head : JSON) → (tail : List JSON) → motive_1 head → motive_3 tail → motive_3 (head :: tail)) →
(t : JSON) → motive_1 t
Can someone explain the various arguments that go into this? I can see that each constructor gets an argument, like church encoding of the data type, but why are there arguments for nil and cons for AssocList and List? Why 3 motives instead of 1?