12 axiom leq_refl: ∀A. A ⊆ A.
13 axiom leq_antisym: ∀A,B. A ⊆ B → B ⊆ A → A=B.
14 axiom leq_tran: ∀A,B,C. A ⊆ B → B ⊆ C → A ⊆ C.
16 axiom i_contrattivita: ∀A. i A ⊆ A.
17 axiom i_idempotenza: ∀A. i (i A) = i A.
18 axiom i_monotonia: ∀A,B. A ⊆ B → i A ⊆ i B.
19 axiom c_espansivita: ∀A. A ⊆ c A.
20 axiom c_idempotenza: ∀A. c (c A) = c A.
21 axiom c_monotonia: ∀A,B. A ⊆ B → c A ⊆ c B.
22 axiom m_antimonotonia: ∀A,B. A ⊆ B → m B ⊆ m A.
23 axiom m_saturazione: ∀A. A ⊆ m (m A).
24 axiom m_puntofisso: ∀A. m A = m (m (m A)).
25 axiom th1: ∀A. c (m A) ⊆ m (i A).
26 axiom th2: ∀A. i (m A) ⊆ m (c A).
27 lemma l1: ∀A,B. i A ⊆ B → i A ⊆ i B.
28 lemma l2: ∀A,B. A ⊆ c B → c A ⊆ c B.
35 (List.map (function I -> "i" | C -> "c" | M -> "-") w)
38 let print_eqclass eqc =
39 let eqc = List.sort compare eqc in
40 prerr_endline (String.concat "=" (List.map print_w eqc))
43 let print = List.iter print_eqclass;;
47 let apply_rule_at_beginning (lhs,rhs) l =
51 | x::lhs,x'::l when x = x' -> aux (lhs,l)
52 | _,_ -> raise NoMatch
57 let (@@) l1 ll2 = List.map (function l2 -> l1 @ l2) ll2
60 let rec apply_rule rule w =
62 [apply_rule_at_beginning rule w]
67 | he::tl -> [he] @@ apply_rule rule tl
74 | he::tl -> aux (if List.mem he l then l else he::l) tl
83 | rule::rules -> apply_rule rule w @ aux rules
89 List.for_all (fun x -> List.mem x l2) l1
92 let (===) l1 l2 = subseteq l1 l2 && subseteq l2 l1;;
96 let l' = uniq (List.flatten (List.map apply_rules l)) in
97 if l === l' then l else aux l'
102 let combine_class_with_classes l1 =
107 if List.exists (fun x -> List.mem x l2) l1 then
115 let combine_classes l =
119 | he::tl -> aux (combine_class_with_classes he acc) tl
124 let step (s : eqclass list) =
126 List.iter (function eqc -> ns := eqc::!ns) s;
131 let eqc = simplify ([x] @@ eqc) in
132 if not (List.exists (fun eqc' -> eqc === eqc') !ns) then
139 let classes = step (step (step (step [[[]]]))) in
140 prerr_endline ("Numero di classi trovate: " ^ string_of_int (List.length classes));