181 lines
4.0 KiB
Coq
181 lines
4.0 KiB
Coq
(* non-narcissist version by Olivier Laurent *)
|
|
Section baby.
|
|
Variable person : Set.
|
|
Variable loves : person -> person -> Prop.
|
|
|
|
Axiom nonNarcissism : forall p1 p2:person,
|
|
loves p1 p2 -> p1 <> p2.
|
|
|
|
Axiom mybaby me : person.
|
|
Axiom everyoneLovesMybaby : forall p:person,
|
|
p <> mybaby -> loves p mybaby.
|
|
Axiom mybabyLovesMe : loves mybaby me.
|
|
Axiom mybabyLovesOnlyMe : forall p:person,
|
|
(loves mybaby p) -> p = me.
|
|
Theorem mybabyIsNotMe : mybaby <> me.
|
|
Proof.
|
|
apply nonNarcissism.
|
|
exact mybabyLovesMe.
|
|
Qed.
|
|
End baby.
|
|
|
|
(* trivial version *)
|
|
(* TODO *)
|
|
|
|
|
|
(*
|
|
There's a post-apocalyptic model where it's only you and your baby left in the world.
|
|
*)
|
|
|
|
Section baby.
|
|
|
|
Inductive person : Set := Me | Baby.
|
|
Variable loves : person -> person -> Prop.
|
|
|
|
Axiom babyLovesBaby : loves Baby Baby.
|
|
Axiom meLovesBaby : loves Me Baby.
|
|
Axiom babyLovesOnlyMe : forall p:person,
|
|
p <> Baby -> loves Baby p -> p = Me.
|
|
Theorem mybabyIsMe : Me <> Baby.
|
|
Proof.
|
|
pose proof (babyLovesOnlyMe Me).
|
|
|
|
Qed.
|
|
|
|
|
|
End baby.
|
|
|
|
|
|
Hadn't know about `Variant`. Is the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(* SSFT22 version *)
|
|
Section baby.
|
|
Variable Person : Set.
|
|
Variable loves : Person -> Person -> Prop.
|
|
|
|
Axiom mybaby me : Person.
|
|
Axiom everyoneLovesMybaby : forall person:Person,
|
|
loves person mybaby.
|
|
Axiom mybabyLovesOnlyMe : forall person:Person,
|
|
person <> me -> not (loves mybaby person).
|
|
Theorem mybabyIsMe : mybaby = me.
|
|
Proof.
|
|
pose proof (everyoneLovesMybaby mybaby).
|
|
pose proof (mybabyLovesOnlyMe mybaby).
|
|
|
|
destruct H0.
|
|
- intro HH.
|
|
|
|
|
|
destruct (mybabyLovesOnlyMe mybaby).
|
|
- intro H.
|
|
|
|
|
|
(* Another attempt at accuracy *)
|
|
Section baby.
|
|
Variable Person : Set.
|
|
Variable loves : Person -> Person -> Prop.
|
|
|
|
Axiom mybaby me : Person.
|
|
Axiom everyoneLovesMybaby : forall person:Person,
|
|
person <> mybaby -> loves person mybaby. (* baby cannot love himself *)
|
|
Axiom mybabyLovesOnlyMe : forall person:Person,
|
|
loves mybaby person -> person = me.
|
|
Theorem mybabyIsMe : mybaby <> me.
|
|
Proof.
|
|
|
|
|
|
(* Attempt at accurate framing *)
|
|
Section baby.
|
|
Variable Person : Set.
|
|
Variable loves : Person -> Person -> Prop.
|
|
|
|
Axiom mybaby me : Person.
|
|
Axiom everyoneLovesMybaby : forall person:Person,
|
|
loves person mybaby. (* baby can love himself too *)
|
|
Axiom mybabyLovesOnlyMe : forall person:Person,
|
|
loves mybaby person -> person = me \/ person = mybaby.
|
|
Theorem mybabyIsMe : mybaby <> me.
|
|
Proof.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(* backward reasoning *)
|
|
Section baby.
|
|
Variable Person : Set.
|
|
Variable loves : Person -> Person -> Prop.
|
|
|
|
Axiom mybaby me : Person.
|
|
Axiom everyoneLovesMybaby : forall person:Person,
|
|
loves person mybaby.
|
|
Axiom mybabyLovesOnlyMe : forall person:Person,
|
|
loves mybaby person -> person = me.
|
|
Theorem mybabyIsMe : mybaby = me.
|
|
Proof.
|
|
rewrite (mybabyLovesOnlyMe mybaby).
|
|
- reflexivity.
|
|
- apply (everyoneLovesMybaby mybaby).
|
|
Show Proof.
|
|
(*
|
|
(eq_ind_r (fun p : Person => p = me) eq_refl
|
|
(mybabyLovesOnlyMe mybaby (everyoneLovesMybaby mybaby)))
|
|
*)
|
|
Restart.
|
|
exact (mybabyLovesOnlyMe mybaby (everyoneLovesMybaby mybaby)).
|
|
Show Proof.
|
|
(*
|
|
(mybabyLovesOnlyMe mybaby (everyoneLovesMybaby mybaby))
|
|
*)
|
|
Qed.
|
|
End baby.
|
|
Print mybabyIsMe.
|
|
|
|
(* forward reasoning *)
|
|
Section baby.
|
|
Parameter Person : Set.
|
|
Parameter loves : Person -> Person -> Prop.
|
|
|
|
Axiom mybaby' me' : Person.
|
|
Axiom everyoneLovesMybaby' : forall person:Person,
|
|
loves person mybaby'.
|
|
Axiom mybabyLovesOnlyMe' : forall person:Person,
|
|
loves mybaby' person -> person = me'.
|
|
Theorem mybabyIsMe' : mybaby = me.
|
|
Proof.
|
|
pose proof everyoneLovesMybaby'.
|
|
specialize (H me').
|
|
pose proof mybabyLovesOnlyMe.
|
|
specialize (H0 _ loves me').
|
|
(*
|
|
#+BEGIN_OUTPUT (Goal)
|
|
1 subgoal
|
|
|
|
Person : Set
|
|
loves : Person -> Person -> Prop
|
|
H : loves me' mybaby'
|
|
H0 : loves (mybaby Person) me' -> me' = me Person
|
|
|
|
========================= (1 / 1)
|
|
|
|
mybaby = me
|
|
#+END_OUTPUT (Goal) *)
|
|
|
|
specialize (H0 _ loves mybaby).
|
|
specialize (H0 _ loves me').
|
|
specialize (H0 nat).
|
|
exact
|
|
specialize H0.
|
|
rewrite (mybabyLovesOnlyMe mybaby).
|
|
- reflexivity.
|
|
- apply (everyoneLovesMybaby mybaby).
|
|
Qed.
|
|
End baby.
|