Commit 0c3101e8ff20ee32caa63d68789fc41455290eee

Thomas de Grivel 2023-07-25T22:59:08

unary operator ! not

diff --git a/lib/c3/0.1/c3.facts b/lib/c3/0.1/c3.facts
index 3027711..848759c 100644
--- a/lib/c3/0.1/c3.facts
+++ b/lib/c3/0.1/c3.facts
@@ -53,6 +53,7 @@ add {C3.>, :cfn, cfn :bool "tag_gt" (:tag, :tag)}
 add {C3.>, :is_a, :operator}
 add {C3.>, :operator_precedence, 3}
 add {C3.>, :operator_associativity, :left}
+add {C3.!, :arity, 1}
 add {C3.!, :cfn, cfn :bool "tag_not" (:tag)}
 add {C3.!, :is_a, :operator}
 add {C3.!, :operator_precedence, 4}
diff --git a/libc3/env.c b/libc3/env.c
index 322dda7..da72bfd 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -563,19 +563,24 @@ bool env_operator_is_unary(s_env *env, const s_ident *op)
   s_facts_with_cursor cursor;
   s8 r;
   s_tag tag_ident;
+  s_tag tag_is_a;
   s_tag tag_arity;
   s_tag tag_one;
+  s_tag tag_operator;
   s_ident tmp;
   assert(env);
   assert(op);
   tmp = *op;
   ident_resolve_module(&tmp, env);
   tag_init_ident(&tag_ident, &tmp);
+  tag_init_1(    &tag_is_a, ":is_a");
+  tag_init_1(    &tag_operator, ":operator");
   tag_init_1(    &tag_arity, ":arity");
   tag_init_1(    &tag_one, "1");
   facts_with(&env->facts, &cursor, (t_facts_spec) {
-      &tag_ident, &tag_arity, &tag_one,
-      NULL, NULL });
+      &tag_ident, &tag_is_a, &tag_operator,
+                  &tag_arity, &tag_one,
+                  NULL, NULL });
   r = facts_with_cursor_next(&cursor) ? true : false;
   facts_with_cursor_clean(&cursor);
   return r;
diff --git a/test/ic3/bool.out.expected b/test/ic3/bool.out.expected
index 73958e8..4e01ccd 100644
--- a/test/ic3/bool.out.expected
+++ b/test/ic3/bool.out.expected
@@ -15,4 +15,6 @@ true
 true
 true
 true
+
 false
+