1

Assume that p is a map defined as nat ⇒ string list or nat ⇀ string list and I want to append all string list in p's image

As the similar question, if p is a map defined as nat ⇒ string set or nat ⇀ string set and I want to union all string list in p's image.

For example, for p: 0 -> ["0.0"]; 1 -> ["1.0","1,1"], I want to get the result as ["0.0", "1.0", "1.1"]

for p: 0 -> {"0.0"}; 1 -> {"1.0","1,1"}, I want to get the result as {"0.0", "1.0", "1.1"}

It seems that in Isabelle has to deal with the set union, but I can't find anything about append a set of lists.

Maëlan
  • 3,586
  • 1
  • 15
  • 35
Huan Sun
  • 147
  • 6
  • 1
    I have no idea what you want. For `p: 0 -> ["0.0"]; 1 -> ["1.0","1,1"]`. What do you want to have? "0.01.01.1"? – Mathias Fleury Jun 22 '22 at 05:51
  • 1
    Maybe that: definition h :: "(nat ⇒ string set) ⇒ string set" where "h p = ⋃ (p ` UNIV)" – Mathias Fleury Jun 22 '22 at 06:01
  • I mean if `p: 0 -> ["0.0"]; 1 -> ["1.0","1,1"]`, I want to get the result as `["0.0", "1.0", "1.1"]` – Huan Sun Jun 22 '22 at 06:09
  • 1
    I have provided the set version. For lists, this is not possible, because lists are always finite (take `p: _ -> ["0"]`). – Mathias Fleury Jun 22 '22 at 06:18
  • 1
    If you really really need lists and you know things are finite, something like `fold (@) (map (the o p) (sorted_list_of_set (dom p))) []` might work, but (i) it will be annoying to work with, (ii) it is not executable, and (iii) it will be very very annoying to work with (sledgehammer won't like, auto won't like it, and so on). I strongly advise against, unless really required. – Mathias Fleury Jun 22 '22 at 06:32

0 Answers0