Closed yutakang closed 4 years ago
So, probably we should tag each term or term occurrence with the number possible alternative cases: int option
in Unique_Node
.
Na.. we already have Takes_N_Arguments
and a case distinction in Isabelle/HOL is a function application.
So, we can just apply Takes_N_Arguments
to, for example, List.list.case_list
.
Maybe we need Takes_N_Minus_One_Arguments
.
Note that the bound term can be of a product type:
@{term "let (x1, x2, x3) = y in z"};
val it =
Const ("HOL.Let", "'a × 'b × 'c ⇒ ('a × 'b × 'c ⇒ 'd) ⇒ 'd") $ Free ("y", "'a × 'b × 'c") $
(Const ("Product_Type.prod.case_prod", "('a ⇒ 'b × 'c ⇒ 'd) ⇒ 'a × 'b × 'c ⇒ 'd") $
Abs ("x1", "'a",
Const ("Product_Type.prod.case_prod", "('b ⇒ 'c ⇒ 'd) ⇒ 'b × 'c ⇒ 'd") $
Abs ("x2", "'b", Abs ("x3", "'c", Free ("z", "'d"))))):
term
But it looks like only variables and contents of product types are permitted.
In that case, we can use the type of HOL.Let
as a hint.
But still, we have to be able to talk about "how many Abs
appears below/above this.
Maybe recursion helps?
Another problem is that x
in let x = y in z
is not really a term,
but a string in Abs ("x", "'a", Free ("z", "'b"))
.
x
may appear as a bound variable Bound n
, though.
Probably we need more supports to deal with Abs
and Bound
For example, Bound_Is_Introduced_By_Let (x)
, for which probably we have the same problem:
we have to be able to talk about "how many Abs appears below/above this.
Maybe recursion helps?
We need an atomic assertion to detect case_
done in 1f0001f10b2abf08745eba27e3195f823c0b272a.
Probably we need a new language construct that takes a term (e.g.
List.list.case_list
) and tells us how many cases we should expect for this term (e.g.2
).